<div dir="ltr">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.<div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 6, 2022 at 8:26 AM <<a href="mailto:asterisk@phreaknet.org">asterisk@phreaknet.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    <p>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].</p>
    <p>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.<br>
    </p>
    <p>[f1]<br>
      exten => s,1,NoOp(${CONTEXT})<br>
              same => n,NoOp(${CONTEXT} / ${LASTCONTEXT})<br>
              same => n,Goto(f2,s,1)<br>
      [f2]<br>
      exten => s,1,NoOp(${CONTEXT} / ${LASTCONTEXT})<br>
              same => n,NoOp(${CONTEXT} / ${LASTCONTEXT})<br>
              same => n,Hangup()<br>
    </p>
    <p>pbxdev*CLI> channel originate Local/s@f1 application Wait 30<br>
      [Jan  6 08:19:30]     -- Called s@f1<br>
      [Jan  6 08:19:30]     -- Executing [s@f1:1]
      NoOp("Local/s@f1-00000002;2", "f1") in new stack<br>
      [Jan  6 08:19:30]     -- Executing [s@f1:2]
      NoOp("Local/s@f1-00000002;2", "f1 / ") in new stack<br>
      [Jan  6 08:19:30]     -- Executing [s@f1:3]
      Goto("Local/s@f1-00000002;2", "f2,s,1") in new stack<br>
      [Jan  6 08:19:30]     -- Goto (f2,s,1)<br>
      [Jan  6 08:19:30]     -- Executing [s@f2:1]
      NoOp("Local/s@f1-00000002;2", "f2 / f1") in new stack<br>
      [Jan  6 08:19:30]     -- Executing [s@f2:2]
      NoOp("Local/s@f1-00000002;2", "f2 / f1") in new stack<br>
      [Jan  6 08:19:30]     -- Executing [s@f2:3]
      Hangup("Local/s@f1-00000002;2", "") in new stack<br>
      [Jan  6 08:19:30]   == Spawn extension (f2, s, 3) exited non-zero
      on 'Local/s@f1-00000002;2'<br>
    </p>
    <p>[1] <a href="https://code.phreaknet.org/asterisk/lastcontext.diff" target="_blank">https://code.phreaknet.org/asterisk/lastcontext.diff</a><br>
    </p>
    <div>On 1/5/2022 10:22 PM, Dovid Bender
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">Steve,
        <div><br>
        </div>
        <div>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.</div>
        <div><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, Jan 5, 2022 at 10:06
          PM Steve Edwards <<a href="mailto:asterisk.org@sedwards.com" target="_blank">asterisk.org@sedwards.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On
          Wed, 5 Jan 2022, Steve Edwards wrote:<br>
          <br>
          >       same = n,                     
           set(LAST-CONTEXT=${context}<br>
          <br>
          Double damn. I munged the case on ${CONTEXT}. I give up for
          today :)<br>
          <br>
          -- <br>
          Thanks in advance,<br>
-------------------------------------------------------------------------<br>
          Steve Edwards       <a href="mailto:sedwards@sedwards.com" target="_blank">sedwards@sedwards.com</a>     
          Voice: +1-760-468-3867 PST<br>
                       <a href="https://www.linkedin.com/in/steve-edwards-4244281" rel="noreferrer" target="_blank">https://www.linkedin.com/in/steve-edwards-4244281</a><br>
          <br>
          -- <br>
_____________________________________________________________________<br>
          -- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" rel="noreferrer" target="_blank">http://www.api-digital.com</a>
          --<br>
          <br>
          Check out the new Asterisk community forum at: <a href="https://community.asterisk.org/" rel="noreferrer" target="_blank">https://community.asterisk.org/</a><br>
          <br>
          New to Asterisk? Start here:<br>
                <a href="https://wiki.asterisk.org/wiki/display/AST/Getting+Started" rel="noreferrer" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Getting+Started</a><br>
          <br>
          asterisk-users mailing list<br>
          To UNSUBSCRIBE or update options visit:<br>
             <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" rel="noreferrer" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a></blockquote>
      </div>
      <br>
      <fieldset></fieldset>
    </blockquote>
  </div>

</blockquote></div>