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@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@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Shan Randhawa
Sent: Monday, January 25, 2016 11:13 AM
To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org>; brian@freeswitch.org; mike@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@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.