[asterisk-users] Caller ID Rewrite

David Bath david.bath at triaddo.com
Fri Dec 1 13:03:52 MST 2006


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.

I have an external SIP provider, and the extension is a 6 digit number,
e.g. 123456.  When calls come in, they are always "TO:" this 6 digit
number..

Hence, the dialplan has 

exten => 123456,1,Goto(sipinternal,<myphoneextension>,1)

at the moment, all incoming calls are forwarded directly to my
deskphone.

What I'm trying to do is first mangle the incoming caller id (i.e. the
FROM: field) so that all numbers come in countrycode + number.

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.e if the "true" condition is met in the IF statement, the command
should distil down to 

Set(CALLERID(number)=44${CALLERID(number):1}

Which it does... but, "44${CALLERID(number):1}" appears as a string,
instead of being evaluated!

Any ideas why ??

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 19:40
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Caller ID Rewrite

Am Freitag, den 01.12.2006, 14:26 +0000 schrieb David Bath:
> So onto the problem... I'm trying to write a quick on-liner which will
> fix up incoming UK format numbers (0 + 10digits) into (44 + 9 digits).
> I got as far as this:
> 
>  
> 
> exten => <incoming extension>,1,Set(foo=${IF(REGEX("^0[1-9][0-9]\{9
> \}$" {CALLERID(number)})?Set(CALLERID(number)=44
> ${CALLERID(number):1})})

I would try something like

exten => _0[1-9]X.,1,Goto(0044${EXTEN:1},1)
(All numbers beginning "null" "not-null" will be rewritten to 0044 plus
the number without the leading zero)

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


More information about the asterisk-users mailing list