asterisk2billing.org
http://forum.asterisk2billing.org/

Can I re-write/change the received DID to something else?
http://forum.asterisk2billing.org/viewtopic.php?f=33&t=11643
Page 1 of 1

Author:  netizen [ Sat May 23, 2015 9:23 am ]
Post subject:  Can I re-write/change the received DID to something else?

Hello,

My provider sends their DIDs with a prefix number and # before the number, for example 1234567#123456789123.
This is how is received in sip:

From: <sip:[email protected]>;tag=1041231023-212435
To: 1234567#123456789123 <sip:1234567#[email protected]>

Does anybody know how can I change the DID in order to show only the number (i.e 123456789123)?
Using the did with the static prefix 1234567# is not easy or practical as I need to refer to that format inside a2b as well.
It would be more sensible to only use the did number alone.

Any ideas?

N

Author:  bucasia [ Mon May 25, 2015 2:28 pm ]
Post subject:  Re: Can I re-write/change the received DID to something else?

If you have a search around there are quite a few dialplan snippets for removing a plus sign from the front of an incoming call, like this - http://orourketech.com/elastix-plus-sig ... ng-things/

You should be able to do the same sort of thing to strip the number off the front. Run the dial plan before passing the call to the a2billing PHP

Author:  bucasia [ Mon May 25, 2015 2:30 pm ]
Post subject:  Re: Can I re-write/change the received DID to something else?

Actually that link was for removing it from the caller ID. You want something like this - http://www.freepbx.org/support/document ... alled-numb - for stripping it from EXTEN (the number called)

Author:  netizen [ Tue May 26, 2015 6:48 am ]
Post subject:  Re: Can I re-write/change the received DID to something else?

bucasia wrote:
Actually that link was for removing it from the caller ID. You want something like this - http://www.freepbx.org/support/document ... alled-numb - for stripping it from EXTEN (the number called)


It worked! I am providing below the working custom context for others to refer in the future.

[FROM-PROVIDER-CUSTOM]
exten => _1234567#X!,1,Noop(Stripping 1234567# from start of DID number received)
exten => _1234567#X!,n,Goto(from-trunk,${EXTEN:8},1)
exten => _[*0-9]!,1,Goto(from-trunk,${EXTEN},1)
exten => h,1,Hangup()

I have however another task now which is to playback a certain audio file to outside callers that reached a DID which is not –yet- assigned to a user. I have created the following extension which works fine if I call it directly however I am not sure how to combine it with the above context, when the DID received is not in use. Any ideas?

[custom-unassigned-number]
; This extension plays a message to the caller, notifying them that the number is not currently assigned to a user.

exten => 1244,1,Progress()
exten => 1244,n,Wait(1)
exten => 1244,n,Set(VOLUME(TX)=0)
exten => 1244,n,Playback(unassigned-number,noanswer)
exten => 1244,n,Hangup()

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/