Asterisk Sip Trunk Dialcode

I´ve implemented 3 asterisks servers connected with sip trunk, in the first one i have the numbers 100,101,… an so on, on the second one i have 200, 201… and so on, the same on the third one. In this moment i have configurated my extensions.conf so i can call directly from 100 to 200 by just typing the number, what i want is to have a dial code so if 100 wants to call 200 it has to dial 02200, for example.

My extensions.conf so far:

[usuarios]

;Calls inside the trunk

exten => _10X,1,Dial(SIP/${EXTEN})
same => n,Hangup()

;Outgoing calls to Asterisk_B

exten => _20X,1,Answer
same => n,Wait(1)
same => n,Dial(SIP/Trunk_Asterisk_B/${EXTEN})
same => n,Hangup()

;Incoming calls from Asterisk_B

[Entrantes_Trunk_Asterisk_B]
exten => 101,1,Dial(SIP/101)
same => n,Hangup()

exten => 102,1,Dial(SIP/102)
same => n,Hangup()

exten => _0220X,1,Answer
same => n,Wait(1)
same => n,Dial(SIP/Trunk_Asterisk_B/${EXTEN:2})
same => n,Hangup()

modifs :
_20X → _0220X

SIP/Trunk_Asterisk_B/{EXTEN} -> SIP/Trunk_Asterisk_B/{EXTEN}

1 Like

This is the same requirement as stripping external access codes (e.g. level 9) when calling PSTN numbers. There are good examples of how to do that in the sample extensions.conf.

Why are you answering the call before dialling? This can start charging if the call is coming from someone who pays for calls.

1 Like

do i need to change something in the other end? i mean, extensions.conf of 100 server?

was a requirement of the implementation, but i get what you mean

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.