Re: [asterisk-users] Get context with hangup handler

2022-01-09 Thread Dovid Bender
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  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@f1 application Wait 30
> [Jan  6 08:19:30] -- Called s@f1
> [Jan  6 08:19:30] -- Executing [s@f1:1] NoOp("Local/s@f1-0002;2",
> "f1") in new stack
> [Jan  6 08:19:30] -- Executing [s@f1:2] NoOp("Local/s@f1-0002;2",
> "f1 / ") in new stack
> [Jan  6 08:19:30] -- Executing [s@f1:3] Goto("Local/s@f1-0002;2",
> "f2,s,1") in new stack
> [Jan  6 08:19:30] -- Goto (f2,s,1)
> [Jan  6 08:19:30] -- Executing [s@f2:1] NoOp("Local/s@f1-0002;2",
> "f2 / f1") in new stack
> [Jan  6 08:19:30] -- Executing [s@f2:2] NoOp("Local/s@f1-0002;2",
> "f2 / f1") in new stack
> [Jan  6 08:19:30] -- Executing [s@f2:3] Hangup("Local/s@f1-0002;2",
> "") in new stack
> [Jan  6 08:19:30]   == Spawn extension (f2, s, 3) exited non-zero on
> 'Local/s@f1-0002;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 
> 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   sedwa...@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
>
>
>
-- 
_
-- 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

Re: [asterisk-users] asterisk and maybe a freepbx question

2022-01-09 Thread John Covici
OK, that tells me something, I will disable pjsit for now, learn about
it and try again.

On Sun, 09 Jan 2022 06:39:55 -0500,
John Harragin wrote:
> 
> [1  ]
> [1.1  ]
> You can also set up multiple physical or vlan(ed) interfaces and bind sip
> to one and pjsip to the other - then you have to set up the appropriate
> interface routing too for both inbound and outbound packets which takes a
> good understanding of your network topology and the locations of your
> respective devices. You might be able to do it with multiple addresses on
> your interface too (although I haven't tried it).
> 
> All of the packets have to be presented to the appropriate channel
> otherwise get discarded. You can't set it up so if a packet is from a
> device not registered with pjsip, it gets passed to chan_sip to try.
> 
> For me, I had both channel types running on production machines while I
> migrated to pjsip or when not being able to figure out how to set up some
> property in pjsip that you had running in sip. Each time I've had to do
> this, eventually I was able get it all running within pjsip. I also already
> had multiple vlans configured for my servers (with voip exclusive to one).
> 
> The short story is that it is easier to learn how to get things working
> within pjsip than learning the tricky networking setup.
> 
> 
> On Sun, Jan 9, 2022 at 2:49 AM Duncan Turnbull 
> wrote:
> 
> >
> >
> >
> >
> > > On 9/01/2022, at 7:11 PM, John Covici  wrote:
> > >
> > > On Sat, 08 Jan 2022 19:17:57 -0500,
> > > Antony Stone wrote:
> > >>
> > >>> On Sunday 09 January 2022 at 00:50:27, John Covici wrote:
> > >>>
> > >>> Hi.  I am using asterisk 18.3 and freepbx.
> > >>
> > >> Hm, which version of FreePBX uses Asterisk 18.3?
> > >>
> > >>> How can both sip and pjsip be listening at port 5060 at the same time
> > >>
> > >> They can't.
> > >>
> > >> One might be on TCP and the other on UDP, but you can't have them both
> > >> listening on the same port with the same protocol.
> >
> > In freepbx you enable chan sip or pjsip or both and set what ports they use
> >
> > The choices are either in advanced settings or sip settings
> >
> > Disable pjsip and reset the chan_sip port to 5060 or use pjsip. With them
> > both enabled sometimes odd things happen but it will still work. You will
> > get lots of error messages though
> >
> >
> > >>
> > >>> for instance I get:
> > >>>
> > >>> [2022-01-08 17:08:59] SECURITY[244351] res_security_log.c:
> > >>>
> > SecurityEvent="FailedACL",EventTV="2022-01-08T17:08:59.957-0500",Severity="
> > >>>
> > Error",Service="PJSIP",EventVersion="1",AccountID="anonymous",SessionID="20
> > >>> 25076022",LocalAddress="IPV4/UDP/166.84.7.53/5060
> > ",RemoteAddress="IPV4/UDP/
> > >>> 45.134.144.118/5823
> > ",ACLName="registrar_attempt_without_configured_aors"
> > >>
> > >> What makes you think chan_sip and pjsip are both listening on UDP 5060?
> > >>
> > >>> I would like pjsit not to listen,till I figure out how to configure
> > >>> the thing, so my logs don't fill up with messages.
> > >>>
> > >>> Thanks in advance for any suggestions.
> > >>
> > >> As far as I recall using FreePBX, there is a selector for the SIP
> > protocol to
> > >> tell it whether you want it to use pjsip or chan_sip.  I don't think it
> > even
> > >> supports using both at the same time, so simply make sure that is set
> > to
> > >> chan_sip and you should be fine.
> > >>
> > >> On the other hand, why do you need to learn "how to configure the
> > thing" if
> > >> you're using FreePBX?  Part of the whole point is that it does the
> > fiddly
> > >> techie sutff in the background for you, and you just need to use the
> > personnel-
> > >> department-friendly web GUI.
> > >
> > > This is what I thought as well, I just generated one trunk using the
> > > old chan_sip and expected nothing from pjsit, yet I get all kinds of
> > > errors like
> > > [2022-01-08 17:08:59] WARNING[487628] res_pjsip_registrar.c: Endpoint
> > > 'anonymous' (45.134.144.118:5823) has no configured AORs
> > >
> > > so I am very confused as to why this is happening.
> > >
> > > --
> > > Your life is like a penny.  You're going to lose it.  The question is:
> > > How do
> > > you spend it?
> > >
> > > John Covici wb2una
> > > cov...@ccs.covici.com
> > >
> > > --
> > > _
> > > -- 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
> >
> > --
> > _
> > -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> >
> > Check out the new Asterisk