Are you actually trying to strip off the + or are you doing it as part of
trying to check the callerid number to see if it is valid. If the later,
then consider REGEX()... here is a snippet from my privacy manager script...
; First lookup number in asterisk DB for a Caller ID name. exten =
s,n,Set(CALLERID(name)=${IF(${DB_EXISTS(cidname/${CALLERID(num)})}?${DB_RESULT}:${CALLERID(name)})})
; Now check against whitelist. exten =
s,n,GotoIf(${DB_EXISTS(whitelist/${CALLERID(num)})}?onwhitelist) ; Not on
whitelist, check it against blacklist exten =
s,n,GotoIf(${DB_EXISTS(blacklist/${CALLERID(num)})}?onblacklist) ; Not on
blacklist either, check Caller ID number for anonymous conditions... ; If
all zeros (with or without international dialing + sign) then caller is
anonymous. exten = s,n,GotoIf($[${REGEX("^[+]?0+$" ${CALLERID(num)})} =
1]?unknown) ; If Caller ID is not a number at least 4 digits long (with or
without + sign) ; then caller is assumed to be anonymous. Alphabetic Caller
ID "numbers" ; will therefore be considered anonymous. Common numbers for
anonymous callers ; are: "asterisk, unknown, anonymous, private,
unavailable" which may be upper, lower ; or mixed case. The regular
expression catches everything non-numeric. ; If you want to permit a
specific non-numeric Caller ID "number" add it to whitelist. exten =
s,n,GotoIf($[${REGEX("^[+]?[0-9]{4\,}$" ${CALLERID(num)})} != 1]?unknown) ;
Caller ID looks good.
I saw something like this in another answer, but heres an example that
should work (would on 1.4)
exten => s/_+X.,1,Set(TMPNAME=${CALLERID(name)})
exten => s/_+X.,n,Set(CLEANNAME=CUT(TMPNAME|\+|2))
exten => s/_+X.,n,Set(CALLERID(name)=${CLEANNAME})
in my installations ${X:1} is a hit or miss proposition; CUT is a Known
quantity.
------------------------------
*Sent:* Thursday, January 14, 2010 3:55 AM
*Subject:* [asterisk-users] how to strip + from the caller-ID
Hi,
How can I strip + from the front of the caller ID?
exten => s/_+X.,1,Set(CALLERID(name)=${CALLERID(name):1})
But it is not working.
Szasz Szabolcs
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users