[Asterisk-Users] inquire about connected channel (show channels)

Josiah Bryan jbryan at productiveconcepts.com
Fri Apr 8 07:17:28 MST 2005


On Friday 08 April 2005 10:04 am, Jerry Geis wrote:
> is there an easier way to ask through the manager api
> what the connected channel is for a given channel.
>
> Example: I dont know the session number for SIP/401
> but I what to know what channel SIP/401 is connected to.
>
> SIP/401 is presently something like SIP/401-XXXX type session number
> and the response to the this command would be
> SIP/422-YYYY
>
> where SIP/422-YYYY is the channel and session information that SIP/401
> is connected to.
>
> I know this information can be parsed out of "show channels"
> but I was just wondering if the is an easier way?

Its rather simple with AGI + Asterisk Manager interface. I wrote a little AGI 
(perl) script that connects to * and parsers 'show channel X' and grabs the 
'Direct Bridge' line for that channel. This would give you, say, SIP/422-xxx 
as the Direct Bridge for SIP/401-xxx. I use this for transfering calls for my 
receptionist.

So, to answer your question, just parse the output of 'show channel 
SIP/401-XXXX' and grab the 'Direct Bridge' line. Thats about the easiest that 
I know of..


HTH -
-josiah


-- 
Josiah Bryan
IT Coordinator
Productive Concepts, Inc.
jbryan at productiveconcepts.com
(765) 964-6009, ext. 224



More information about the asterisk-users mailing list