[asterisk-users] Caller ID Rewrite

Edwin Lam elam at officegeneral.com
Fri Dec 1 16:43:50 MST 2006


David Bath wrote:
> Hi,
> 
> Thanks for quick response.
> 
> I changed it as you suggested, but it has the same effect:
> 
> In the console I get:
> 
> --Executing
> Set("SIP/604625-b79140a8",CALLERID(number)=44${CALLERID(number)}") in
> new stack
> 
> It's running the IF code correctly, but in the "true" it's just not
> evaluating the variable...

since the REGEX returns 1 if match. try this instead:

exten=>123456,1,Set(CALLERID(number)=
${IF($[REGEX("^0[1-9][0-9]\{9\}$" ${CALLERID(number)}) = 1]?
44${CALLERID(number):1}:${CALLERID(number)})})

> 
> Cheers,
> 
> Dave
> 
> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com
> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Anselm
> Martin Hoffmeister
> Sent: 01 December 2006 20:26
> To: Asterisk Users Mailing List - Non-Commercial Discussion
> Subject: RE: [asterisk-users] Caller ID Rewrite
> 
> Am Freitag, den 01.12.2006, 20:03 +0000 schrieb David Bath:
> 
>>Hi Anselm,
>>
>>Thanks for the help...
>>
>>I'm slightly confused as to your response.
>>
>>Wouldn't that look for a /dialled/ number in the format _0<number> try
>>and jump to another extension 0044<number> with priority 1?
>>
>>If so, that's not what I'm trying to achieve.
> 
> 
> Sorry, my brain is in need for a weekend off work. I obviously
> understood your question wrong. My fault.
> 
> 
>>I've made a bit more progress... and my current diaplan entry looks
> 
> like
> 
>>this:
>>
>>exten=>123456,1,Set(${IF(REGEX("^0[1-9][0-9]\{9\}$"
>>{CALLERID(number)})?CALLERID(number)=44${CALLERID(number):1})})
>>exten => 123456,2,Goto(sipinternal,101,1)
>>
>>BUT! There's a very odd problem (and I'm sure it's my fault..) the
>>second callerid function is not being evaluated...
> 
> 
> I _think_ the IF is a string evaluation, so the format should be like
> SET MYVARIABLE =  [IF condition? value1 : value2]
> 
> (see http://www.voip-info.org/wiki/index.php?page=Asterisk+func+if )
> 
> Try
> exten=>123456,1,Set(CALLERID(number)=
> ${IF(REGEX("^0[1-9][0-9]\{9\}$" ${CALLERID(number)})?
> 44${CALLERID(number):1}:${CALLERID(number)})})
> 
> (two linebreaks to be removed)
> 
> HTH,
> 
> Anselm
> 
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users


-- 
Edwin Lam <edwin at officegeneral.com>
Systems Engineer, Office General, Inc.
Ph: +1 415 439 4988 Fax: +1 415 283 3370
http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0xD6506D20



More information about the asterisk-users mailing list