1 like 0 dislike
258 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...

in Education & Reference by (180 points)
edited by | 258 views

1 Answer

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)
by (820 points)

Related questions

0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
1 like 0 dislike
1 answer
0 like 0 dislike
1 answer
3 like 0 dislike
1 answer
2 like 0 dislike
1 answer
1 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer

Where your donation goes
Technology: We will utilize your donation for development, server maintenance and bandwidth management, etc for our site.

Employee and Projects: We have only 15 employees. They are involved in a wide sort of project works. Your valuable donation will definitely boost their work efficiency.

How can I earn points?
Awarded a Best Answer 10 points
Answer questions 10 points
Asking Question -20 points

1,226 questions
1,372 answers
559 comments
2,099 users