Using goto or ? to get to a context without a exten or priority

Hello,

I have the following dial plan:

exten => s,1,GotoIf($["${CHANNEL(state)}" = "Up"]?begin)
exten => s,n,Answer
exten => s,n(begin),Noop(Parsing DID, CID and App into L,Q,T)
exten => s,n,Set(L=${CALLERID(dnid)1:3})
exten => s,n,Set(Q=${CALLERID(num)})
exten => s,n,Set(T=${CALLERID(dnid):0:3})
exten => s,n,Noop(Check Addressbook for entry)
exten => s,n,Set(FAXCHECK=${DB_EXISTS(cidname/${L})})
exten => s,n,GotoIf($["${DB_RESULT}" = "FAX"]?faxpath)
exten => s,n,Noop(Fax number not found, moving to next step)

For the next step I would like to send it to the [ext-did] context, which looks like:

[ext-did]
include => ext-did-0001
include => ext-did-0002
exten => foo,1,Noop(bar)

What’s the right way to right this? Goto? Even though ext-did does not have an extension or priority? IS there another command?

Thanks for any insight.

ext-did has the extension foo. It also has all the extensions tahte appear in ext-did-0001 and ext-did-0002.

You cannot go to just a context.

Thanks david. A guess a better question is how could I write a step into my dial plan that could take me there [ext-did]?

A fully specified Goto, with context, extension and priority.

1 Like

Just to clarify, you’re saying that is not possible because the ext-did context currently does not have an extension and priority written in it?

Additionally, you’re saying there is no way with Asterisk currently to move from my dial plan to the ext-did context as the ext-did context is written today?

Is that correct? Thanks again for the help!

It is possible: Goto(ext-did,foo,1) will work, as will Goto(ext-did,xxxxxx,yyyyy) where xxxxxx,yyyyy is a priority present in at least one of ext-did-0001 or ext-did-0002.

What is fundamentally impossible is to Goto just a context. You can do Goto(ext-dd,${EXTEN},1), and if the current extension, at priority 1, is included in ext-did, or one of the contexts included, directly, or indirectly, it will work. However, I don’t really understand what you mean by going just to a context.

2 Likes

Probably a disconnect on my part, I am still learning, but I appreciate the clarification. This moves me closer. Thanks for walking me through.

These wiki pages may be useful to read up on:
https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Goto
https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_GotoIf

Just to clarify a little further, Asterisk needs to know where in the dialplan it is being sent to. Just a context won’t tell it everything it needs to know. You need to tell it where in that context it needs to go to as well. Hope that helps clear up some things!