Skip to content

Commit

Permalink
[4.2] KAZOO-6027: support custom_sip_headers on device/user actions (2…
Browse files Browse the repository at this point in the history
…600hz#5425)

* KAZOO-6027: support custom_sip_headers on device/user actions

* KAZOO-6027: make apis
  • Loading branch information
k-anderson authored and swysor committed Jan 17, 2019
1 parent 63e6036 commit a83f0aa
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions applications/callflow/doc/device.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Key | Description | Type | Default | Required | Support Level
--- | ----------- | ---- | ------- | -------- | -------------
`can_call_self` | Toggle whether devices of the same owner can call each other | `boolean()` | | `false` | `supported`
`can_text_self` | Toggle whether devices of the same owner can text each other | `boolean()` | | `false` | `alpha`
`custom_sip_headers` | KV Object where the name is the SIP header and the value is the SIP field | `object()` | | `false` |
`delay` | How long to delay ringing the device, in seconds | `integer()` | `0` | `false` |
`dial_strategy` | Dial strategy for the device | `string('simultaneous' | 'single')` | `simultaneous` | `false` |
`id` | Device ID | `string()` | | `false` |
Expand Down
1 change: 1 addition & 0 deletions applications/callflow/doc/ref/device.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Key | Description | Type | Default | Required | Support Level
--- | ----------- | ---- | ------- | -------- | -------------
`can_call_self` | Toggle whether devices of the same owner can call each other | `boolean()` | | `false` | `supported`
`can_text_self` | Toggle whether devices of the same owner can text each other | `boolean()` | | `false` | `alpha`
`custom_sip_headers` | KV Object where the name is the SIP header and the value is the SIP field | `object()` | | `false` |
`delay` | How long to delay ringing the device, in seconds | `integer()` | `0` | `false` |
`dial_strategy` | Dial strategy for the device | `string('simultaneous' | 'single')` | `simultaneous` | `false` |
`id` | Device ID | `string()` | | `false` |
Expand Down
1 change: 1 addition & 0 deletions applications/callflow/doc/ref/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Key | Description | Type | Default | Required | Support Level
--- | ----------- | ---- | ------- | -------- | -------------
`can_call_self` | Toggle whether devices of this use can call each other | `boolean()` | | `false` |
`can_text_self` | Toggle whether devices of this use can text each other | `boolean()` | | `false` |
`custom_sip_headers` | KV Object where the name is the SIP header and the value is the SIP field | `object()` | | `false` |
`delay` | How long to delay the endpoint(s) before bridging | `integer()` | `0` | `false` |
`fail_on_single_reject` | If any leg rejects the call, cancel all other legs | `boolean()` | | `false` |
`id` | User ID | `string()` | | `false` |
Expand Down
1 change: 1 addition & 0 deletions applications/callflow/doc/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Key | Description | Type | Default | Required | Support Level
--- | ----------- | ---- | ------- | -------- | -------------
`can_call_self` | Toggle whether devices of this use can call each other | `boolean()` | | `false` |
`can_text_self` | Toggle whether devices of this use can text each other | `boolean()` | | `false` |
`custom_sip_headers` | KV Object where the name is the SIP header and the value is the SIP field | `object()` | | `false` |
`delay` | How long to delay the endpoint(s) before bridging | `integer()` | `0` | `false` |
`fail_on_single_reject` | If any leg rejects the call, cancel all other legs | `boolean()` | | `false` |
`id` | User ID | `string()` | | `false` |
Expand Down
3 changes: 2 additions & 1 deletion applications/callflow/src/module/cf_device.erl
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ bridge_to_endpoints(Data, Call) ->
FailOnSingleReject = kz_json:is_true(<<"fail_on_single_reject">>, Data, 'undefined'),
Timeout = kz_json:get_integer_value(<<"timeout">>, Data, ?DEFAULT_TIMEOUT_S),
IgnoreEarlyMedia = kz_endpoints:ignore_early_media(Endpoints),
CustomHeaders = kz_json:get_ne_json_value(<<"custom_sip_headers">>, Data),

kapps_call_command:b_bridge(Endpoints, Timeout, Strategy, IgnoreEarlyMedia
,'undefined', 'undefined', <<"false">>, FailOnSingleReject, Call
,'undefined', CustomHeaders, <<"false">>, FailOnSingleReject, Call
)
end.
3 changes: 2 additions & 1 deletion applications/callflow/src/module/cf_user.erl
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ handle(Data, Call) ->
Timeout = kz_json:get_integer_value(<<"timeout">>, Data, ?DEFAULT_TIMEOUT_S),
Strategy = kz_json:get_ne_binary_value(<<"strategy">>, Data, <<"simultaneous">>),
IgnoreEarlyMedia = kz_endpoints:ignore_early_media(Endpoints),
CustomHeaders = kz_json:get_ne_json_value(<<"custom_sip_headers">>, Data),

lager:info("attempting ~b user devices with strategy ~s", [length(Endpoints), Strategy]),
case length(Endpoints) > 0
andalso kapps_call_command:b_bridge(Endpoints, Timeout, Strategy, IgnoreEarlyMedia
,'undefined', 'undefined', <<"false">>, FailOnSingleReject, Call
,'undefined', CustomHeaders, <<"false">>, FailOnSingleReject, Call
)
of
'false' ->
Expand Down
8 changes: 8 additions & 0 deletions applications/crossbar/priv/api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1939,6 +1939,10 @@
"description": "Toggle whether devices of the same owner can text each other",
"type": "boolean"
},
"custom_sip_headers": {
"description": "KV Object where the name is the SIP header and the value is the SIP field",
"type": "object"
},
"delay": {
"default": 0,
"description": "How long to delay ringing the device, in seconds",
Expand Down Expand Up @@ -3551,6 +3555,10 @@
"description": "Toggle whether devices of this use can text each other",
"type": "boolean"
},
"custom_sip_headers": {
"description": "KV Object where the name is the SIP header and the value is the SIP field",
"type": "object"
},
"delay": {
"default": 0,
"description": "How long to delay the endpoint(s) before bridging",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
"support_level": "alpha",
"type": "boolean"
},
"custom_sip_headers": {
"description": "KV Object where the name is the SIP header and the value is the SIP field",
"type": "object"
},
"delay": {
"default": 0,
"description": "How long to delay ringing the device, in seconds",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
"description": "Toggle whether devices of this use can text each other",
"type": "boolean"
},
"custom_sip_headers": {
"description": "KV Object where the name is the SIP header and the value is the SIP field",
"type": "object"
},
"delay": {
"default": 0,
"description": "How long to delay the endpoint(s) before bridging",
Expand Down

0 comments on commit a83f0aa

Please sign in to comment.