1 like 0 dislike
72 views

I want if number is coming from 91 and is greater than 10 digit so need to remove 91 from the incoming number or else go as it is...

edited | 72 views

1 like 0 dislike

In Asterisk above 1.6

exten => 1234,1,NoOp(Incoming call from # \${CALLERID(num)})

;assign the area code (2 first digits) to variable Digit
exten => 1234,n,Set(Digit=\${CALLERID(num):0:2})

;Returns integer length of the string.
exten => 1234,n,Set(Number=\${LEN(\${CALLERID(num)})})

;Go to label(True) if condition is true or to next step (or label2(False) if defined) if condition is false
exten => 1234,n,GotoIf(\$["\${Digit}"=="91" && "\${Number}">"10"]?True:False)

;Removes 91 from the caller number if above condition is true
exten => 1234,n(True),Set(ani=\${CALLERID(num):2:12})
exten => 1234,n,Goto(cb,1,1)

;else
exten => 1234,n(False),Set(ani=\${CALLERID(num)})
exten => 1234,n,Goto(cb,1,1)
answered May 16, 2014 by (820 points)

0 like 0 dislike
0 like 0 dislike
1 like 0 dislike
0 like 0 dislike