Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Master] - PROD-210: Add INVITE format to strip + #6512

Merged
merged 12 commits into from
May 1, 2020
2 changes: 1 addition & 1 deletion applications/crossbar/doc/connectivity.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Key | Description | Type | Default | Required | Support Level
`servers.[].options.hunt_account_id` | When using local resources, use this account instead of the account making the call (useful for resellers) | `string()` | | `false` |
`servers.[].options.hunt_non_reconcilable` | Whether to allow routing to continue on a non-reconcilable TO number | `boolean()` | `false` | `false` |
`servers.[].options.ignore_early_media` | | `boolean()` | | `false` |
`servers.[].options.inbound_format` | Determines how the INVITE is sent to the server | `string('e164' | 'npan' | '1npan' | 'username')` | `npan` | `false` |
`servers.[].options.inbound_format` | Determines how the INVITE is sent to the server | `string('e164' | 'npan' | '1npan' | 'username' | 'strip_plus')` | `npan` | `false` |
`servers.[].options.ip` | IP (sip) address for this device | `string()` | | `false` |
`servers.[].options.media_handling` | Determine whether the switch should be in the media path or not | `string('process' | 'bypass')` | `bypass` | `false` |
`servers.[].options.port` | Port to send SIP traffic for the remote device | `integer()` | | `false` |
Expand Down
2 changes: 1 addition & 1 deletion applications/crossbar/doc/devices.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Key | Description | Type | Default | Required | Support Level
`sip.expire_seconds` | The time, in seconds, sent to the provisioner for the registration period that the device should be configured with. | `integer()` | `300` | `false` | `supported`
`sip.forward` | Forward IP to use | `string()` | | `false` |
`sip.ignore_completed_elsewhere` | When set to false the phone should not consider ring group calls answered elsewhere as missed | `boolean()` | | `false` |
`sip.invite_format` | The SIP request URI invite format | `string('username' | 'npan' | '1npan' | 'e164' | 'route' | 'contact')` | `contact` | `false` | `supported`
`sip.invite_format` | The SIP request URI invite format | `string('username' | 'npan' | '1npan' | 'e164' | 'route' | 'strip_plus' | 'contact')` | `contact` | `false` | `supported`
`sip.ip` | IP address for this device | `string()` | | `false` | `supported`
`sip.method` | Method of authentication | `string('password' | 'ip')` | `password` | `false` | `supported`
`sip.number` | The number used if the invite format is 1npan, npan, or e164 (if not set the dialed number is used) | `string()` | | `false` |
Expand Down
2 changes: 1 addition & 1 deletion applications/crossbar/doc/ref/connectivity.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Key | Description | Type | Default | Required | Support Level
`servers.[].options.hunt_account_id` | When using local resources, use this account instead of the account making the call (useful for resellers) | `string()` | | `false` |
`servers.[].options.hunt_non_reconcilable` | Whether to allow routing to continue on a non-reconcilable TO number | `boolean()` | `false` | `false` |
`servers.[].options.ignore_early_media` | | `boolean()` | | `false` |
`servers.[].options.inbound_format` | Determines how the INVITE is sent to the server | `string('e164' | 'npan' | '1npan' | 'username')` | `npan` | `false` |
`servers.[].options.inbound_format` | Determines how the INVITE is sent to the server | `string('e164' | 'npan' | '1npan' | 'username' | 'strip_plus')` | `npan` | `false` |
`servers.[].options.ip` | IP (sip) address for this device | `string()` | | `false` |
`servers.[].options.media_handling` | Determine whether the switch should be in the media path or not | `string('process' | 'bypass')` | `bypass` | `false` |
`servers.[].options.port` | Port to send SIP traffic for the remote device | `integer()` | | `false` |
Expand Down
2 changes: 1 addition & 1 deletion applications/crossbar/doc/ref/devices.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Key | Description | Type | Default | Required | Support Level
`sip.expire_seconds` | The time, in seconds, sent to the provisioner for the registration period that the device should be configured with. | `integer()` | `300` | `false` | `supported`
`sip.forward` | Forward IP to use | `string()` | | `false` |
`sip.ignore_completed_elsewhere` | When set to false the phone should not consider ring group calls answered elsewhere as missed | `boolean()` | | `false` |
`sip.invite_format` | The SIP request URI invite format | `string('username' | 'npan' | '1npan' | 'e164' | 'route' | 'contact')` | `contact` | `false` | `supported`
`sip.invite_format` | The SIP request URI invite format | `string('username' | 'npan' | '1npan' | 'e164' | 'route' | 'strip_plus' | 'contact')` | `contact` | `false` | `supported`
`sip.ip` | IP address for this device | `string()` | | `false` | `supported`
`sip.method` | Method of authentication | `string('password' | 'ip')` | `password` | `false` | `supported`
`sip.number` | The number used if the invite format is 1npan, npan, or e164 (if not set the dialed number is used) | `string()` | | `false` |
Expand Down
2 changes: 1 addition & 1 deletion applications/crossbar/doc/ref/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Key | Description | Type | Default | Required | Support Level
`gateways.[].force_port` | Allow request only from this port | `boolean()` | `false` | `false` |
`gateways.[].format_from_uri` | When set to true requests to this resource gateway will have a reformatted SIP From Header | `boolean()` | | `false` |
`gateways.[].from_uri_realm` | When formatting SIP From on outbound requests this can be used to override the realm | `string()` | | `false` |
`gateways.[].invite_format` | The format of the DID needed by the underlying hardware/gateway | `string('route' | 'username' | 'e164' | 'npan' | '1npan')` | `route` | `false` |
`gateways.[].invite_format` | The format of the DID needed by the underlying hardware/gateway | `string('route' | 'username' | 'e164' | 'npan' | '1npan' | 'strip_plus')` | `route` | `false` |
`gateways.[].invite_parameters.dynamic.[]` | | `string()|string()|string('zone')|object()` | | |
`gateways.[].invite_parameters.dynamic` | A list of properties that, if found on the inbound call, should be added as an INVITE parameter | `array()` | | `false` |
`gateways.[].invite_parameters.static.[]` | | `string()` | | `false` |
Expand Down
2 changes: 1 addition & 1 deletion applications/crossbar/doc/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Key | Description | Type | Default | Required | Support Level
`gateways.[].force_port` | Allow request only from this port | `boolean()` | `false` | `false` |
`gateways.[].format_from_uri` | When set to true requests to this resource gateway will have a reformatted SIP From Header | `boolean()` | | `false` |
`gateways.[].from_uri_realm` | When formatting SIP From on outbound requests this can be used to override the realm | `string()` | | `false` |
`gateways.[].invite_format` | The format of the DID needed by the underlying hardware/gateway | `string('route' | 'username' | 'e164' | 'npan' | '1npan')` | `route` | `false` |
`gateways.[].invite_format` | The format of the DID needed by the underlying hardware/gateway | `string('route' | 'username' | 'e164' | 'npan' | '1npan' | 'strip_plus')` | `route` | `false` |
`gateways.[].invite_parameters.dynamic.[]` | | `string()|string()|string('zone')|object()` | | |
`gateways.[].invite_parameters.dynamic` | A list of properties that, if found on the inbound call, should be added as an INVITE parameter | `array()` | | `false` |
`gateways.[].invite_parameters.static.[]` | | `string()` | | `false` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@
"number_manager.bandwidth2.site_id": "number_manager.bandwidth2 site id",
"number_manager.carrier_modules": "carrier modules to perform number search & ordering from",
"number_manager.classifiers": "regular expressions & billing names for numbers",
"number_manager.converters": "suffix for the KNM module to use for E164, NPAN and 1NPAN normalization of numbers",
"number_manager.converters": "suffix for the KNM module to use for E164, NPAN, 1NPAN and strip_plus normalization of numbers",
"number_manager.dash_e911.auth_password": "number_manager.dash_e911 auth password",
"number_manager.dash_e911.auth_username": "number_manager.dash_e911 auth username",
"number_manager.dash_e911.debug": "number_manager.dash_e911 debug",
Expand Down
12 changes: 9 additions & 3 deletions applications/crossbar/priv/api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -5408,7 +5408,8 @@
"e164",
"npan",
"1npan",
"username"
"username",
"strip_plus"
],
"type": "string"
},
Expand Down Expand Up @@ -5858,6 +5859,7 @@
"1npan",
"e164",
"route",
"strip_plus",
"contact"
],
"type": "string"
Expand Down Expand Up @@ -13948,6 +13950,7 @@
"npan",
"1npan",
"route",
"strip_plus",
"loopback",
"contact"
],
Expand Down Expand Up @@ -26461,6 +26464,7 @@
"npan",
"1npan",
"route",
"strip_plus",
"loopback",
"contact"
],
Expand Down Expand Up @@ -31499,7 +31503,8 @@
"username",
"e164",
"npan",
"1npan"
"1npan",
"strip_plus"
],
"type": "string"
},
Expand Down Expand Up @@ -37147,7 +37152,7 @@
"default": [
"regex"
],
"description": "suffix for the KNM module to use for E164, NPAN and 1NPAN normalization of numbers",
"description": "suffix for the KNM module to use for E164, NPAN, 1NPAN and strip_plus normalization of numbers",
"items": {
"type": "string"
},
Expand Down Expand Up @@ -39587,6 +39592,7 @@
"e164",
"npan",
"1npan",
"strip_plus",
"username"
],
"type": "string"
Expand Down
3 changes: 2 additions & 1 deletion applications/crossbar/priv/couchdb/schemas/connectivity.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@
"e164",
"npan",
"1npan",
"username"
"username",
"strip_plus"
],
"type": "string"
},
Expand Down
1 change: 1 addition & 0 deletions applications/crossbar/priv/couchdb/schemas/devices.json
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@
"1npan",
"e164",
"route",
"strip_plus",
"contact"
],
"support_level": "supported",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"npan",
"1npan",
"route",
"strip_plus",
"loopback",
"contact"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"npan",
"1npan",
"route",
"strip_plus",
"loopback",
"contact"
],
Expand Down
3 changes: 2 additions & 1 deletion applications/crossbar/priv/couchdb/schemas/resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@
"username",
"e164",
"npan",
"1npan"
"1npan",
"strip_plus"
],
"type": "string"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"default": [
"regex"
],
"description": "suffix for the KNM module to use for E164, NPAN and 1NPAN normalization of numbers",
"description": "suffix for the KNM module to use for E164, NPAN, 1NPAN and strip_plus normalization of numbers",
"items": {
"type": "string"
},
Expand Down
1 change: 1 addition & 0 deletions applications/crossbar/priv/couchdb/schemas/trunkstore.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
"e164",
"npan",
"1npan",
"strip_plus",
"username"
],
"type": "string"
Expand Down
6 changes: 5 additions & 1 deletion applications/crossbar/priv/oas3/oas3-schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4285,6 +4285,7 @@
- npan
- 1npan
- username
- strip_plus
'type': string
'ip':
'description': IP (sip) address for this device
Expand Down Expand Up @@ -4651,6 +4652,7 @@
- 1npan
- e164
- route
- strip_plus
- contact
'type': string
'x-support_level': supported
Expand Down Expand Up @@ -8104,6 +8106,7 @@
- e164
- npan
- 1npan
- strip_plus
'type': string
'invite_parameters':
'additionalProperties': false
Expand Down Expand Up @@ -12468,7 +12471,7 @@
'default':
- regex
'description': |-
suffix for the KNM module to use for E164, NPAN and 1NPAN normalization of numbers
suffix for the KNM module to use for E164, NPAN, 1NPAN and strip_plus normalization of numbers
'items':
'type': string
'type': array
Expand Down Expand Up @@ -14452,6 +14455,7 @@
- e164
- npan
- 1npan
- strip_plus
- username
'type': string
'media_handling':
Expand Down
8 changes: 8 additions & 0 deletions applications/ecallmgr/src/ecallmgr_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,12 @@ build_freetdm_channel(#bridge_endpoint{invite_format = <<"1npan">>
,channel_selection=ChannelSelection
}) ->
{'ok', <<"freetdm/", Span/binary, "/", ChannelSelection/binary, "/", (knm_converters:to_1npan(Number))/binary>>};
build_freetdm_channel(#bridge_endpoint{invite_format = <<"strip_plus">>
,number=Number
,span=Span
,channel_selection=ChannelSelection
}) ->
{'ok', <<"freetdm/", Span/binary, "/", ChannelSelection/binary, "/", (knm_converters:to_strip_plus(Number))/binary>>};
build_freetdm_channel(#bridge_endpoint{number=Number
,span=Span
,channel_selection=ChannelSelection
Expand Down Expand Up @@ -1142,6 +1148,8 @@ maybe_format_user(Contact, #bridge_endpoint{invite_format = <<"npan">>, number=N
re:replace(Contact, "^[^\@]+", knm_converters:to_npan(Number), [{'return', 'binary'}]);
maybe_format_user(Contact, #bridge_endpoint{invite_format = <<"1npan">>, number=Number}) ->
re:replace(Contact, "^[^\@]+", knm_converters:to_1npan(Number), [{'return', 'binary'}]);
maybe_format_user(Contact, #bridge_endpoint{invite_format = <<"strip_plus">>, number=Number}) ->
re:replace(Contact, "^[^\@]+", knm_converters:to_strip_plus(Number), [{'return', 'binary'}]);
maybe_format_user(Contact, _) -> Contact.

-spec maybe_set_interface(kz_term:ne_binary(), bridge_endpoint()) -> kz_term:ne_binary().
Expand Down
21 changes: 9 additions & 12 deletions applications/trunkstore/src/ts_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,11 @@ invite_format(<<"e164">>, To) ->
[{<<"Invite-Format">>, <<"e164">>}
,{<<"To-DID">>, knm_converters:normalize(To)}
];
invite_format(<<"e164_without_plus">>, To) ->
case knm_converters:normalize(To) of
<<$+, PluslessDID/binary>> ->
lager:info("while processing 'e164_without_plus' flag, DID ~s converted to E.164 with truncated '+': ~s",[To, PluslessDID]),
[{<<"Invite-Format">>, <<"e164">>}
,{<<"To-DID">>, PluslessDID}
];
AsIsDID ->
[{<<"Invite-Format">>, <<"e164">>}
,{<<"To-DID">>, AsIsDID}
]
end;
invite_format(<<"e164_without_plus">>=Format, To) ->
lager:debug("~p: changing legacy format ~p to strip_plus", [?MODULE, Format]),
[{<<"Invite-Format">>, <<"strip_plus">>}
,{<<"To-DID">>, knm_converters:to_strip_plus(To)}
];
invite_format(<<"1npanxxxxxx">>, To) ->
[{<<"Invite-Format">>, <<"1npan">>}
,{<<"To-DID">>, knm_converters:to_1npan(To)}
Expand All @@ -287,6 +280,10 @@ invite_format(<<"npan">>, To) ->
[{<<"Invite-Format">>, <<"npan">>}
,{<<"To-DID">>, knm_converters:to_npan(To)}
];
invite_format(<<"strip_plus">>, To) ->
[{<<"Invite-Format">>, <<"strip_plus">>}
,{<<"To-DID">>, knm_converters:to_strip_plus(To)}
];
invite_format(_, _) ->
[{<<"Invite-Format">>, <<"username">>}].

Expand Down
1 change: 1 addition & 0 deletions core/kazoo_amqp/src/api/kapi_dialplan.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
,<<"route">>, <<"loopback">>
,<<"contact">>
,<<"endpoint">>, <<"forward">>
,<<"strip_plus">>
]
}).

Expand Down
Loading