[asterisk-users] trouble removing + sign
sean darcy
seandarcy2 at gmail.com
Thu Feb 14 09:13:09 CST 2019
On 2/14/19 4:23 AM, Administrator TOOTAI wrote:
> Le 14/02/2019 à 00:12, sean darcy a écrit :
>> I'm using BLACKLIST() to check numbers, which does not like leading +
>> signs. I want to test if there is a plus sign, and then remove it.
>>
>> I tried:
>>
>> ; strip leading plus sign
>> same => n, Verbose( callerid 0:1 is ${CALLERID(num):0:1} )
>> same => n,ExecIf($["${CALLERID(num):0:1}" = "+"]?Set(CALLERID(num)
>> = ${CALLERID(num):1})
>> same=>n,GotoIf(${BLACKLIST()}?make-em-wait)
>>
>> but it's stripping the first character + sign or not. The callerid is
>> 1203XXYYYY
>>
>> -- Executing [s at hangup-spam:3] Verbose("PJSIP/2667075-0000000b",
>> " callerid 0:1 is 1 ") in new stack
>> callerid 0:1 is 1
>> -- Executing [s at hangup-spam:4] ExecIf("PJSIP/2667075-0000000b",
>> "0?Set(CALLERID(num) = 203XXXYYYY") in new stack
>> -- Executing [s at hangup-spam:5] GotoIf("PJSIP/2667075-0000000b",
>> "0?make-em-wait") in new stack
>>
>> ExecIf correctly finds the comparison false(the "0"), but still
>> executes the appiftrue .
>>
>> What am I missing ?
>
> Try ExecIf($["x${CALLERID(num):0:1}" == "x+"]?Set(CALLERID(num) =
> ${CALLERID(num):1})
>
> Or you could use somethjing like
>
> exten = _X.,1,NoOp(Your dialplan)
> same = n,...
> exten = _+.,1,Goto(${EXTEN:1},1)
>
I like using the "x" before caller id. That deals with caller id null
values.
I also agree that the Set equal sign should not have spaces on either side.
But, the problem here was : no closing parens for the ExecIf !
Thanks for the help. I figured this out because I kept changing the line
based on your suggestions.
sean
More information about the asterisk-users
mailing list