[asterisk-users] Global number rewriting rules affecting ALL headers?

Joshua C. Colp jcolp at sangoma.com
Tue Nov 19 05:08:52 CST 2019


On Tue, Nov 19, 2019 at 6:11 AM Benoit Panizzon <benoit.panizzon at imp.ch>
wrote:

> Hi List
>
> One more Problem I stumbled upon.
>
> Using Asterisk in a TSP environement.
>
> Incomming IC Calls are e164 and have a NPRN (Routing Number) prefixed.
>
> Example: +4198055615995555
> +41 country prefix
> 98055 Routing Prefix
> 615995555 effective phone number
>
> Calls routed to Customers need to be put in the 'local' format.
>
> 0615995555
>
> This is also the format of the From / To / Invite header recieved from
> customers.
>
> Phone Numbers originating from customers have again to get manipulated:
>
> If this is a ported number to another TSP, the destination TSP NPRN has
> to be inserted so it can correctly be routed in transit.
>
> If it is a emergency phone number, a location based routing prefix has
> to be added.
>
> If it is a value added number, the NPRN of the operator AND and ID
> designating the originator TSP of the call has to be prefixed for
> billing.
>
> In the Dialplan (also with help of some AGI Magic doing screening and
> routing) it is easy to correctly set the Request User, From and To
> Headers.
> Setting the PAI correctly was also doable via a pre-dial handler.
>
> But now I am stuck with the Diversion: header.
>
> If the call is being redirected by a SIP 301 from a customer, asterisk
> is setting a Diversion: Header in the 181 message alerting the caller
> of the Diversion and I am absolutely at a loss how I can correctly
> rewrite that phone number in this header.
>
> So I start to wonder, if there is some mechanism within
> asterisk on which I could apply correct phone number translations for
> each endpoint which would apply to ALL possible headers.
>

There is no hook to apply to everything, you have to write dialplan logic
in various places to do so. There are some cases where there are hooks -
redirecting (diversion) and connected line updates[1][2].

[1]
https://wiki.asterisk.org/wiki/display/AST/Party+ID+Interception+Macros+and+Routines
[2]
https://wiki.asterisk.org/wiki/display/AST/Manipulating+Party+ID+Information

-- 
Joshua C. Colp
Digium - A Sangoma Company | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.sangoma.com & www.asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20191119/b6838174/attachment.html>


More information about the asterisk-users mailing list