[asterisk-users] Set CALLERID(num) to a specific number only if ${CALLERID(num)} is not an NANP number

C F shmaltz at gmail.com
Thu Aug 16 11:39:49 CDT 2007


I Believe this should work (untested):
exten => _X./NXXNXXXXXX,1,Noop(we got an NANP cid or a lookalike, but
anything else will goto otherecids context)
exten => _X./NXXNXXXXXX,n,GotoIf($[${CALLERID(num):0:1}=8]?tfcheck);possible
tollfree number
exten => _X./NXXNXXXXXX,n,GotoIf($[${CALLERID(num):0:1}=9]?900chceck);possible
900 number
exten => _X./NXXNXXXXXX,n,GotoIf($[${CALLERID(num):1:2}=11]?invalidcid);invalid
NANP
exten => _X./NXXNXXXXXX,n(validnanp),Noop(not setting CID number since
it appears to be valid as: ${CALLERID(num)})
exten => _X./NXXNXXXXXX,n(tfcheck),continue testing here for 888,877,800,866
exten => _X./NXXNXXXXXX,n(900check),test here for 900

include => othercids
[otherecids]
exten => _X.,1,Set(CALLERID(num)=whatever);set to NANP number here

I think the above should take care of it, like I said I didn't test
it, but it should work.


On 8/16/07, Daryl G. Jurbala <daryl at introspect.net> wrote:
> Im trying to figure out the base way to check the callerID being sent
> to my Asterisk box and use it if it is a valid NANP number, but
> replace it with a static NANP number if it is not.  (Why?  I have a
> few carriers that require this, and a few international users - if it
> happens to take one of the carriers that require it, I want it to set
> a static number that is valid).
>
> I'm playing with IF and REGEX in extensions.conf, but not getting
> very far.  Has anyone done this and/or know of a doc?  I haven't had
> any success searching.
>
> At this point, I have a very broken setup of:
>
> Set(CALLERID(num)=${IF(${REGEX("^(?:\([2-9]\d{2}\)\ ?|[2-9]\d{2}(?:
> \-?|\ ?))[2-9]\d{2}[- ]?\d{4}$" ${CALLERID(num)})}?${CALLERID
> (num)}:<staticNumber>)
>
> I'm sure I'm pretty far off - and I've been through many permutations
> of this so far.  Any ideas?
>
> Thanks,
> Daryl
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.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