Goto fonctions and conditiond

if exten = 1 goto context1
elseif exten = 2 goto context2
else goto context3
Can you help me to

can you help me to write well at my dialplan level in extensions.conf

This seems to be an Asterisk question, rather than a FreePBX one, and it is incompletely specified.

Subject to certain assumptions, you can do this with:

exten => 1,n,Goto(context1,${EXTEN},1)
exten => 2,s,Goto(context2,${EXTEN},1)
exten => _.,s,Goto(context3,${EXTEN},1)

n can be replaced by 1, if this is the first priority of the initial context, but you may have to replace the _. by something more specific, to avoid special extensions being matched, and might have to do separate cases for one and multi-digit extensions.

Whilst you could use GotoIf, you would need the extensions in the dialplan to be patterns that could match all valid extensions.

I’ve assumed you wanted the same extension and the initial priority, in your contexts 1, 2, and 3.

What are you really trying to achieve here?

In FreePBX, you must not do this in extensions.conf, itself.

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