[Freeswitch-users] DETECT ACTIVE CHANNELS

Branden Jordan BJordan at E-Teleco.com
Tue Jan 26 05:05:59 MSK 2016


Shan,

If you are using Lua you can access that information by calling a Lua script from the dialplan and utilizing the API.

api = freeswitch.API();
local channelCount = api:executeString("show channels");
session:consoleLog("crit", "here I am I worked," .. channelCount);

This printed “[CRIT] switch_cpp.cpp:1284 here I am I worked, uuid,direction,created,created_epoch,name,state,cid_name,cid_num,ip_addr,dest,application,application_data,dialplan,context,read_codec,read_rate,read_bit_rate,write_codec,write_rate,write_bit_rate,secure,hostname,presence_id,presence_data,callstate,callee_name,callee_num,callee_direction,call_uuid,sent_callee_name,sent_callee_num,initial_cid_name,initial_cid_num,initial_ip_addr,initial_dest,initial_dialplan,initial_context
7bf61657-5dfe-4797-8c99-59e382cfb422,inbound,2016-01-25 17:59:34,1453773574,sofia/external/1000 at 192.168.0.10,CS_EXECUTE,1000,1000,192.168.0.10,1001,playback, ring.wav,XML,public,PCMU,8000,64000,PCMU,8000,64000,,TestMedia1,,,ACTIVE,,,,,,,1000,1000,192.168.0.10,1001,XML,public

1 total.”

You will more than likely need to parse this to meet your needs.

For further information on the Lua API there is a wiki doc that might help you.
https://freeswitch.org/confluence/display/FREESWITCH/Lua+API+Reference#LuaAPIReference-freeswitch.API

Thanks,
Branden Jordan

From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Shan Randhawa
Sent: Monday, January 25, 2016 11:13 AM
To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>; brian at freeswitch.org; mike at jerris.com
Subject: Re: [Freeswitch-users] DETECT ACTIVE CHANNELS

Hi,

Can any tell me how to access/call freeswitch client and then execute command on it.
like reply = fs.command("show channels");

Thanks.


Regards,
Shan randhawa





[Image removed by sender.]

On Mon, Jan 25, 2016 at 10:03 PM, Shan Randhawa <randhawaay at gmail.com<mailto:randhawaay at gmail.com>> wrote:

Hi,

i need some help.
Is there a way in scripting like in lua  like using  freeswitch.API() through which i can get active channels .

I can get active channels  in fs cli by running command "active channels".But how to do it in scripts.


Thanks.


Regards,
Shan randhawa


[Image removed by sender.]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20160126/7bf039cb/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 479 bytes
Desc: image001.jpg
Url : http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20160126/7bf039cb/attachment-0001.jpg 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list