After originating a PJSIP call, I need to get the channel for that call, so
I can end it later in a hangup handler.
So I use this:

https://wiki.asterisk.org/wiki/display/AST/Function_CHANNELS

In this bit of dialplan:

    same => n,Originate(PJSIP/0203123456@voipfone-205
,exten,bcab-bridge-conference,s,1)
    same => n,Verbose(1,***CHANNELS ARE ${CHANNELS()})
    same => n,SET(GLOBAL(chan)=${CHANNELS(PJSIP\/voipfone-205-(.*))})

Now, of course, I get more than one channel shown, like this:

***CHAN WE WANT IS PJSIP/voipfone-205-00000249 PJSIP/voipfone-205-0000024c
PJSIP/voipfone-205-0000024d

Assuming I use CUT to trim out the first in the list, can we ALWAYS be
absolutely sure that the channel just created by Originate is the highest
numbered/first in list?

Otherwise, I'm wondering if there's a reliable way to get the channel
created by originate, when there may be many other active channels on the
system, too.

In case anyone's wondering, I'm using it so that when there is only one
party left in a conference, it'll clear down the newly created external
channel.
For which I need the outgoing name, of course...

    same => n,GotoIf($["${CONFBRIDGE_INFO(parties,1234)}" = "1"]?hangchan)
    same => n,Return()
    same => n(hangchan),SoftHangup(${GLOBAL(chan)})
-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Astricon is coming up October 9-11!  Signup is available at: 
https://www.asterisk.org/community/astricon-user-conference

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

Reply via email to