[asterisk-users] adding area code

Steve Edwards asterisk.org at sedwards.com
Mon Apr 27 19:45:22 CDT 2015


On Mon, 27 Apr 2015, Chad Wallace wrote:

> On Mon, 27 Apr 2015 14:30:07 -0700 (PDT)
> Steve Edwards <asterisk.org at sedwards.com> wrote:
>
>> On Mon, 27 Apr 2015, Bryant Zimmerman wrote:
>>
>>> exten => _9XXXXXXX,n,Set(dialnumber=${l_HomeAreaCode}${EXTEN-1})
>>
>> Missing a colon?
>>
>>  	${EXTEN:-1}

> Does that work?

No. I was so focused on the tree, I missed the forest :)

   	${EXTEN:-x} means 'return the last x digits'

  	${EXTEN:x} means 'return all but the first x digits'

So, ${EXTEN:1} is correct for this use.

Something like (tested!):

         exten = _9nxxxxxx,1,            verbose(The 'raw' exten is ${EXTEN})
         same = n,                       set(MY-AREA-CODE=760)
         same = n,                       set(DNIS=${MY-AREA-CODE}${EXTEN:1})
         same = n,                       verbose(The full DNIS is ${DNIS})
         same = n,                       dial(sip/1${DNIS}@vitel-outbound,60,r)
         same = n,                       hangup()

is closer to what the OP needs. Note the 'n' in the pattern.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



More information about the asterisk-users mailing list