Benoit Panizzon
2019-Nov-19 10:10 UTC
[asterisk-users] Global number rewriting rules affecting ALL headers?
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. Mit freundlichen Grüssen -Benoît Panizzon- -- I m p r o W a r e A G - Leiter Commerce Kunden ______________________________________________________ Zurlindenstrasse 29 Tel +41 61 826 93 00 CH-4133 Pratteln Fax +41 61 826 93 01 Schweiz Web http://www.imp.ch ______________________________________________________
Joshua C. Colp
2019-Nov-19 11:08 UTC
[asterisk-users] Global number rewriting rules affecting ALL headers?
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>
Benoit Panizzon
2019-Nov-19 13:24 UTC
[asterisk-users] Global number rewriting rules affecting ALL headers?
Hi Joshua I had a shot at your suggestion, bug still no success. I fear the 181 is sent before the macro is called. I want to change the Diversion Header in the 181 message sent back to the caller to put the number it contains in the correct e164 format (stripping the 0 and adding +41 for Switzerland) but just any 'dialplan set' value would do for an example :-) Could you please make an example how to do that? PS: CONNECTED_LINE_CALLER_SEND_MACRO is depreciated and should be replaced by: CONNECTED_LINE_CALLER_SEND_SUB Do I have to call my routine [sub-routine] and end with ExitSub? Mit freundlichen Grüssen -Benoît Panizzon- -- I m p r o W a r e A G - Leiter Commerce Kunden ______________________________________________________ Zurlindenstrasse 29 Tel +41 61 826 93 00 CH-4133 Pratteln Fax +41 61 826 93 01 Schweiz Web http://www.imp.ch ______________________________________________________