Is it possible to strip the plus sign from the ${EXTEN} var on an incoming call? We have our system setup to deal with incoming calls to numbers without a plus sign, lots of AGIs and databases we don't want to have to change. We have seen things like this ${EXTEN:1} which you can use in the dial command but we want to basically change the ${EXTEN} var right off when it comes into extensions.conf before we do anything else. I have read that since this is a built in Asterisk variable and it can only be read, not written to. We know there are other ways to handle this but we were just hoping for a simple solution like resetting the variable. Any help would be appreciated.
Eric "ManxPower" Wieling
2006-Nov-17 23:15 UTC
[asterisk-users] strip + sign from incoming ${EXTEN} var?
voiplist wrote:> Is it possible to strip the plus sign from the ${EXTEN} var on an > incoming call? > > We have our system setup to deal with incoming calls to numbers > without a plus sign, lots of AGIs and databases we don't want to have > to change. > > We have seen things like this ${EXTEN:1} which you can use in the dial > command but we want to basically change the ${EXTEN} var right off > when it comes into extensions.conf before we do anything else. > > I have read that since this is a built in Asterisk variable and it can > only be read, not written to. > > We know there are other ways to handle this but we were just hoping > for a simple solution like resetting the variable. > > Any help would be appreciated.exten => _+NXXNXXXXXX,1,Goto(${EXTEN:1},1)
Benny Amorsen
2006-Nov-18 02:21 UTC
[asterisk-users] Re: strip + sign from incoming ${EXTEN} var?
>>>>> "EW" == Eric \"ManxPower\" Wieling <Eric> writes:EW> exten => _+NXXNXXXXXX,1,Goto(${EXTEN:1},1) You are assuming a fixed-length number here... The basic problem is to ensure that the extension gets run first, since asterisk has its very own ideas about what goes first. So put the incoming calls in context removeplus instead of incoming, and do: [removeplus] _+!,1,Goto(incoming,${EXTEN:1},1) _X!,1,Goto(incoming,${EXTEN},1) This assumes that ${EXTEN} starts with either a number or a plus. If it can start with other things, you can do _!,1,Goto(incoming,${EXTEN},1) for the second line, but then you are relying on asterisks extension ordering again. /Benny