[Asterisk-Users] How to create [new_context] in extensions.conf?

Leo Ann Boon leo at datvoiz.com
Thu Mar 23 19:14:47 MST 2006


Larry Alkoff wrote:

> What do I have to do to dial an exten -> with the dial command in it?
> Asterisk isn't recognizing commands in my newly created [context].

You must send the call into the context. That can be done in the 
following ways:
a. Device context - e.g. in your sip.conf. You have something like:
[myuser]
context=mycontext

When you register your sip phone with the myuser account, it will be 
placed into [mycontext]. When you dial from that phone, you can only 
reach the extensions in [mycontext] (and its included contexts). E.g.

[mycontext]
exten => 900,1,Playback(demo-echotest)  ; Let them know what's going on
exten => 900,n,Echo                     ; Do the echo test
exten => 900,n,Playback(demo-echodone)  ; Let them know it's over
exten => 900,n,Goto(s,6)                ; Start over

In this example, myuser can only call 900 which is in it's context.

b. By including the context in another context. E.g, to make 
900 at mycontext available to [default] context:
[default]
include => mycontext

This will allow any device in the [default] context to reach 900, as if 
it's part of the [default] context.

c. By using Goto. Eg. to simulate the example in b. without the include 
syntax.

[default]
exten => 900,Goto(mycontext, 900, 1)

d. It's also possible use the Dial string for IAX2 to dial directly into 
a context. See the example from the sample extensions.conf:
exten => 500,n,Dial(IAX2/guest at misery.digium.com/s at default)

Hope this helps.

Leo




More information about the asterisk-users mailing list