International Calling - Limited countries Only


My current International calling plan is like below

exten => _011.,1,Dial(DAHDI/g2/${EXTEN})
exten => _011.,2,Hangup

how do i change this for following requirement options:
Opiton 1:
all countires except INDIA i.e if ISD calls starts with 01191. then calls should be dropped by saying some messge like “NOT ALLOWED” etc.

Option 2:
How to allow specific countries to specific extensions. I know how to do this with context, but there are too many such requirements and none of them are same. some needs only uk, some needs japan, some needs both, very random selection. please suggest.


For your first option you can use following concept b4 Dial cmd at pryority 1
exten +> _011.,1,GoToif the use ${EXTEN} fuction to check dial our number if that is 01191 then hangup or goto line where u can play not allowed msg.

For your second option context is easy option but as for difrent extension with difrent country privleges its difficult.


Hi Amit,

Thanks for your response. Please comment on below syntax for my requirement for option#1

;ISD Dialplan
exten => __011.,1,GotoIf($["${EXTEN}" = “01191.”]?2:3)
exten => __011.,2,Hangup
exten => __011.,3,Dial(DAHDI/g2/${EXTEN})
exten => __011.,4,Hangup


Instead of ${EXTEN} us shud manupulate ${EXTEN} in such format that u can grep or select only 01191. like ${EXTEN:3:4}— CHECK WITH
Also same time dont use =“01191.” use only “01191”


;ISD Dialplan
exten => _011.,1,GotoIf($["${EXTEN:0:5}" != “01191”]?4)
exten => _011.,2,Playback(not-allowed) ; change this to your filename
exten => _011.,3,Hangup
exten => _011.,4,Dial(DAHDI/g2/${EXTEN})
exten => _011.,5,Hangup


EDIT : To check which extension dialled which number check the value of ${CALLERID(ANI)}

Thans Raffels for your response. Thanks Amit.

I will test this today & update you. The logic should work.