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

Daryl G. Jurbala daryl at introspect.net
Thu Aug 16 09:48:05 CDT 2007


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



More information about the asterisk-users mailing list