[asterisk-users] Get context with hangup handler

Dovid Bender dovid at telecurve.com
Sun Jan 9 11:23:24 CST 2022


It seems like this would work and I appreciate the code but I doubt it
would make it into the main branch. I think I am stuck with setting it in
the context.


On Thu, Jan 6, 2022 at 8:26 AM <asterisk at phreaknet.org> wrote:

> I'm not sure what other implications this might have, but does something
> like this work for you? You would need to apply the following patch[1].
>
> Manually trying to save the last context/exten/etc. in the dialplan itself
> is guaranteed to be an ugly solution. Let Asterisk do it for you.
>
> [f1]
> exten => s,1,NoOp(${CONTEXT})
>         same => n,NoOp(${CONTEXT} / ${LASTCONTEXT})
>         same => n,Goto(f2,s,1)
> [f2]
> exten => s,1,NoOp(${CONTEXT} / ${LASTCONTEXT})
>         same => n,NoOp(${CONTEXT} / ${LASTCONTEXT})
>         same => n,Hangup()
>
> pbxdev*CLI> channel originate Local/s at f1 application Wait 30
> [Jan  6 08:19:30]     -- Called s at f1
> [Jan  6 08:19:30]     -- Executing [s at f1:1] NoOp("Local/s at f1-00000002;2",
> "f1") in new stack
> [Jan  6 08:19:30]     -- Executing [s at f1:2] NoOp("Local/s at f1-00000002;2",
> "f1 / ") in new stack
> [Jan  6 08:19:30]     -- Executing [s at f1:3] Goto("Local/s at f1-00000002;2",
> "f2,s,1") in new stack
> [Jan  6 08:19:30]     -- Goto (f2,s,1)
> [Jan  6 08:19:30]     -- Executing [s at f2:1] NoOp("Local/s at f1-00000002;2",
> "f2 / f1") in new stack
> [Jan  6 08:19:30]     -- Executing [s at f2:2] NoOp("Local/s at f1-00000002;2",
> "f2 / f1") in new stack
> [Jan  6 08:19:30]     -- Executing [s at f2:3] Hangup("Local/s at f1-00000002;2",
> "") in new stack
> [Jan  6 08:19:30]   == Spawn extension (f2, s, 3) exited non-zero on
> 'Local/s at f1-00000002;2'
>
> [1] https://code.phreaknet.org/asterisk/lastcontext.diff
> On 1/5/2022 10:22 PM, Dovid Bender wrote:
>
> Steve,
>
> I thought of this but that would mean I would need to add this to the
> beginning of every context which I can do, but I was trying to avoid.
>
>
> On Wed, Jan 5, 2022 at 10:06 PM Steve Edwards <asterisk.org at sedwards.com>
> wrote:
>
>> On Wed, 5 Jan 2022, Steve Edwards wrote:
>>
>> >       same = n,                       set(LAST-CONTEXT=${context}
>>
>> Double damn. I munged the case on ${CONTEXT}. I give up for today :)
>>
>> --
>> Thanks in advance,
>> -------------------------------------------------------------------------
>> Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
>>              https://www.linkedin.com/in/steve-edwards-4244281
>>
>> --
>> _____________________________________________________________________
>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>>
>> Check out the new Asterisk community forum at:
>> https://community.asterisk.org/
>>
>> New to Asterisk? Start here:
>>       https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>>
>> asterisk-users mailing list
>> To UNSUBSCRIBE or update options visit:
>>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20220109/386d25a8/attachment.html>


More information about the asterisk-users mailing list