[asterisk-users] Changing CALLERIDNUM on the fly

Doug Crompton doug at crompton.com
Tue Dec 19 11:03:53 MST 2006


Thanks Anselm, That did it!

Doug

On Tue, 19 Dec 2006, Anselm Martin Hoffmeister wrote:

> Am Dienstag, den 19.12.2006, 01:11 -0500 schrieb Doug Crompton:
> > Is what I am trying to do in this context possible. That is changing the
> > incoming CALLERIDNUM. In this case if the incoming CALLERIDNUM is not
> > preceeded by a "1" I want to add a "1". Often calls come in without the
> > preceeding "1" and this plays havoc with my redial if the 3 digit area
> > code matches a local 3 digit extension. All my outside calls are 10 digits
> > or 1+10 digits.
> >
> > Doug
> >
> >
> > [from-pstn]
> > exten => s,1,set(TEST=${CALLERIDNUM::1})    >>>> test for first digit1
> > exten => s,2,GotoIf($[ ${TEST} = 1 ]?4:3)
> > exten => s,3,set(__CALLERIDNUM=1${CALLERIDNUM})  >>>> if not add 1
> > exten => s,4,noop(${CALLERIDNUM})  >>>>> and this still displays without
>
> Replace CALLERIDNUM with CALLERID(num) on all occasions, and you will
> not need underscores because this is a special variable anyway.
> CALLERIDNUM is obsolete.
>
> You could get along with one line less:
> exten => s,1,GotoIf($[A${CALLERID(num):0:1} = A1]?3:2)
> exten => s,2,Set(CALLERID(num)=1${CALLERID(num)})
> exten => s,3,NOOP(Continue in Dialplan)
>
> Note that my GotoIf contains the two additional "A" letters which is
> important to avoid syntax errors if the CALLERID(num) is empty for
> whatever reason. I do not know what ends up in your CALLERID(num) if the
> number of the caller is not available (like "anonymous" or "withheld") -
> anyway, with this statement it will end up being prepended by "1". You
> migth want to have a special case for that.
>
> If your phones happen to also display CALLERID(name) you can use this to
> lookup the phone number in a phone book (here in Germany there is an
> online service for number reverse lookup which works for about 50% of my
> callers) and set the variable.
>
> BR
> 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
>


"Those that sacrifice essential liberty to obtain a little temporary safety
 deserve neither liberty nor safety."  -- Ben Franklin (1759)

****************************
*  Doug Crompton	   *
*  Richboro, PA 18954	   *
*  215-431-6307		   *
*		  	   *
* doug at crompton.com        *
* http://www.crompton.com  *
****************************




More information about the asterisk-users mailing list