I'm trying to make an Asterisk server connect to a SIP provider (which offers PSTN origination and termination). I've been reading the great Definitive Guide, but am having a conceptual problem with this illustration:


Once Asterisk has determined how to handle the channel, it will pass call control to the correct context in the dialplan. The context parameter in the channel configuration file tells the channel where it will enter the dialplan (which contains all the information about how to handle and route the call).

The "telephone", in this case a softphone, is defined in sip.conf with easy to understand syntax. A corresponding context in extensions.conf has the line:

exten => 101,1,Dial(Sip/000FFFF0002)

and the syntax of this seems to mean, to my understanding, to Dial the 000FFFF0002 hardphone.

Now, when it comes to dialing through a SIP provider, this just isn't covered as well, at least for me.

This seems to be crucial line:

exten => _6XXX,1,Dial(SIP/${EXTEN}@serverB)

Which, in my dialplan, is reflected as:

exten => _91999NXXXXXX,2,Dial(${TESTSIPTRUNK}/${EXTEN:2},,To)

yet the "dial" never seems to go to the other server -- in this case, a SIP provider. I don't understand the mechanics of what's happening. How do I even figure how or why it's not getting out, and, instead, returns " I am sorry that's not a valid extension..." from invalid.gsm playing.

The full log, the channels and extensions are in gists. I'm more asking conceptually, what's supposed to be happening? I appreciate that the calls are supposed to go through ServerB, in this case a SIP provider, but otherwise don't quite understand how to ensure that this actually happens.

see also:

asterisk peer with SIP provider through proxy


It answers you

it's not a valid extension

because it cannot find this extension in the given context. Maybe there is an error in what you're dialing vs what you got in the extension.conf

For example, it looks like you're dialing number starting with 91987 when in your extensions.conf I see only pattern to handle numbers starting with 91999. Are you sure there is a exten for 91987?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.