[asterisk-users] Originate with label?

Mark Murawski markm-lists at intellasoft.net
Mon Aug 29 07:51:27 CDT 2022


On 8/29/22 08:48, Mark Murawski wrote:
> On 8/29/22 08:31, Antony Stone wrote:
>> Hi.
>>
>> https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Application_Originate 
>>
>>
>> I need to use Originate() in a dialplan, pointing to another location 
>> in the
>> same extension of the same context, so for example:
>>
>> Originate(Local/${Dest}@Dialout,exten,${CONTEXT},${EXTEN},158);
>>
>> I don't seem to be able to substitute the priority 158 with a label - 
>> is this
>> deliberate or is this a bug?
>>
>> If it is deliberate, is there any workaround which would enable me to 
>> use
>> Originate when the dialplan is written in AEL, which makes it not 
>> possible for
>> me to define priority numbers?
>>
>> (Alternatively, is there a way to define priority numbers in AEL?)
>>
>> I'd prefer the first solution - being able to use Originate with a 
>> label as the
>> target - as it's neater and more generic.
>>
>>
>> Thanks,
>>
>>
>> Antony.
>>
>
> Hi Anthony,
>
> I love to hear about AEL use-cases.  I'm happy that AEL is working out 
> for you.
>
> Without modifying the code for Originate(), you can do this while 
> staying purely in AEL
> Here's your workaround:
>
>
> context something {
>   s => {
> Originate(Local/${Dest}@Dialout,exten,${CONTEXT},GotoLabel,1,,v(GotoExten=${EXTEN}^GotoLabel=LabelName));
>   }
>
>   GotoLabel => {
>     goto ${CONTEXT}, ${GotoExten}, ${GotoLabel};
>   }
> }
>
>

And, additionally.  You really *should* be breaking down components into 
their own macros or extension blocks.  Adding labels to jump into the 
middle of an extension is typically a sign that you've outgrown your 
overall design.

It's much. much. much easier to build a system up from different 
contexts,extensions and use goto/gosub and make your system more modular 
instead of having one-giant-context with one-giant-extension that tries 
to do everything.


Hope this helps!





More information about the asterisk-users mailing list