Skip to content

Commit

Permalink
Im services 4.3 (#6192)
Browse files Browse the repository at this point in the history
* backport kazoo im

* more updates

* kazoo_numbers / kazoo_number_manager

* code checks

* more 4.3 compat things

* more updates

* make fmt

* more fmt

* make dialyzer happy. james did it.
  • Loading branch information
lazedo authored and k-anderson committed Dec 12, 2019
1 parent 37c3e4b commit 9a1fd9d
Show file tree
Hide file tree
Showing 80 changed files with 4,831 additions and 4,399 deletions.
45 changes: 45 additions & 0 deletions applications/crossbar/priv/api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -23515,6 +23515,9 @@
"Force-Fax": {
"type": "string"
},
"From": {
"type": "string"
},
"From-Realm": {
"type": "string"
},
Expand Down Expand Up @@ -23605,6 +23608,9 @@
"Timeout": {
"type": "string"
},
"To": {
"type": "string"
},
"To-Realm": {
"type": "string"
},
Expand Down Expand Up @@ -23819,6 +23825,9 @@
"Account-ID": {
"type": "string"
},
"Application-ID": {
"type": "string"
},
"Body": {
"type": "string"
},
Expand Down Expand Up @@ -23891,6 +23900,12 @@
"Orig-Port": {
"type": "string"
},
"Originator-Flags": {
"type": "string"
},
"Originator-Properties": {
"type": "string"
},
"Request": {
"type": "string"
},
Expand All @@ -23916,6 +23931,12 @@
"System-ID": {
"type": "string"
},
"Target-Flags": {
"type": "string"
},
"Target-Properties": {
"type": "string"
},
"To": {
"type": "string"
},
Expand Down Expand Up @@ -30530,6 +30551,11 @@
"description": "doodle inbound queue name",
"type": "string"
},
"listeners": {
"default": 1,
"description": "doodle listeners",
"type": "integer"
},
"min_bucket_cost": {
"default": 1,
"description": "doodle minimum bucket cost",
Expand Down Expand Up @@ -32029,6 +32055,25 @@
},
"type": "object"
},
"system_config.kazoo_im": {
"description": "Schema for kazoo_im system_config",
"properties": {
"connector": {
"properties": {
"connections": {
"description": "kazoo_im connector connections",
"type": "object"
}
}
},
"onnet_listeners": {
"default": 1,
"description": "kazoo_im onnet_listeners",
"type": "integer"
}
},
"type": "object"
},
"system_config.keys": {
"description": "Schema for DTMF keys system_config",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@
"Force-Fax": {
"type": "string"
},
"From": {
"type": "string"
},
"From-Realm": {
"type": "string"
},
Expand Down Expand Up @@ -206,6 +209,9 @@
"Timeout": {
"type": "string"
},
"To": {
"type": "string"
},
"To-Realm": {
"type": "string"
},
Expand Down
15 changes: 15 additions & 0 deletions applications/crossbar/priv/couchdb/schemas/kapi.sms.outbound.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"Account-ID": {
"type": "string"
},
"Application-ID": {
"type": "string"
},
"Body": {
"type": "string"
},
Expand Down Expand Up @@ -78,6 +81,12 @@
"Orig-Port": {
"type": "string"
},
"Originator-Flags": {
"type": "string"
},
"Originator-Properties": {
"type": "string"
},
"Request": {
"type": "string"
},
Expand All @@ -103,6 +112,12 @@
"System-ID": {
"type": "string"
},
"Target-Flags": {
"type": "string"
},
"Target-Properties": {
"type": "string"
},
"To": {
"type": "string"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
"description": "doodle inbound queue name",
"type": "string"
},
"listeners": {
"default": 1,
"description": "doodle listeners",
"type": "integer"
},
"min_bucket_cost": {
"default": 1,
"description": "doodle minimum bucket cost",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"_id": "system_config.kazoo_im",
"description": "Schema for kazoo_im system_config",
"properties": {
"connector": {
"properties": {
"connections": {
"description": "kazoo_im connector connections",
"type": "object"
}
}
},
"onnet_listeners": {
"default": 1,
"description": "kazoo_im onnet_listeners",
"type": "integer"
}
},
"type": "object"
}
18 changes: 18 additions & 0 deletions applications/crossbar/src/cb_context.erl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

%% Getters / Setters
,setters/2
,validators/2
,new/0

,account_id/1, set_account_id/2
Expand Down Expand Up @@ -461,6 +462,23 @@ setters_fold({F, V}, C) -> F(C, V);
setters_fold({F, K, V}, C) -> F(C, K, V);
setters_fold(F, C) when is_function(F, 1) -> F(C).

%%------------------------------------------------------------------------------
%% @doc Loop over a list of functions and values to validate `cb_context()'.
%% @end
%%------------------------------------------------------------------------------
-spec validators(context(), setters()) -> context().
validators(#cb_context{}=Context, []) -> Context;
validators(#cb_context{}=Context, [_|_]=Setters) ->
validators_fold(Context, Setters).

-spec validators_fold(context(), setters()) -> context().
validators_fold(Context, []) -> Context;
validators_fold(Context, [Setter | Setters]) ->
NewContext = setters_fold(Setter, Context),
case resp_status(NewContext) of
'success' -> validators_fold(NewContext, Setters);
'error' -> NewContext
end.

-spec set_account_id(context(), kz_term:ne_binary()) -> context().
set_account_id(#cb_context{}=Context, AcctId) ->
Expand Down
Loading

0 comments on commit 9a1fd9d

Please sign in to comment.