[asterisk-users] How to modify incoming DNIS?
Chris Ziomkowski
cziom at jsg.co.th
Tue Aug 22 00:36:43 MST 2006
Hello everyone,
I have a question that seems simple, but I am stumped. Basically, I have
several incoming SIP trunk from gateways connected to physical E1 lines
around the world. Everything works, but the DNIS that comes in are non
standard and sometimes conflict. It varies not only by country, but also
by carrier within a country and even by switch within a carrier. I want
the complete E.164 number, but I rarely get this.
What I would like to do is modify the incoming number as soon as it
enters Asterisk. What happens now is that DNIS 12345678 from SIP trunk A
maps to the same extension as 12345678 from SIP trunk B, even though one
number is actually from Europe and the other from Asia. This causes
many, many conflicts. I want to remap the incoming DNIS to 4412345678
and 6012345678.
Unfortunately, the simple solution doesn't seem to work. The following
fails
(CALLERID(num) is updated correctly, but EXTEN never gets changed.)
[from-sip-trunk-A]
exten => _1234XXXX,1,Set(EXTEN=44${EXTEN})
exten => _1234XXXX,2,Set(CALLERID(num)=44${CALLERID(num)})
exten => _1234XXXX,3,Goto(s,1)
exten => s,1,Goto(incoming-call,${EXTEN},1)
[from-sip-trunk-B]
exten => _1234XXXX,1,Set(EXTEN=60${EXTEN})
exten => _1234XXXX,2,Set(CALLERID(num)=60${CALLERID(num)})
exten => _1234XXXX,2,Goto(s,1)
exten => s,1,Goto(incoming-call,${EXTEN},1)
No error messages are generated, but the EXTEN variable is never
updated! Right after changing it, I print it out with a NoOP and the
value is not updated.
The incoming-call context makes extensive use of macros and other
applications which assume EXTEN will be set correctly. How can I force
EXTEN to be set to the value I want instead of the value that arrives on
the trunk?
Please help. This sounds so simple but I am now very frustrated. The
idea of rewriting every application in the system because EXTEN can't be
changed is very unappealing. I'm already 4 days late getting this up and
running.
Thank you for any assistance,
Chris
More information about the asterisk-users
mailing list