[Freeswitch-users] DETECT ACTIVE CHANNELS

Abaci B abaci64 at gmail.com
Tue Jan 26 23:05:08 MSK 2016


There are probably more efficient ways to do this, including doing the same
thing with ESL, listening to call creation events and update your server,
you can also probably take the info from the freeswitch database tracking
all calls (be careful with this approach as you're dealing with the same
database FreSWITCH relies on)

On Tue, Jan 26, 2016 at 2:40 PM, Shan Randhawa <randhawaay at gmail.com> wrote:

> Well i want that info in my php script running on xampp server to show how
> many calls are currently taking place in freeswitch  and what i can do max
> to know  is communicate to freeswitch through socket 8021 and then run some
> script like of lua and expect lua script to return me that info.
>
>
>
>
>
>
> Sent with MailTrack
> <https://mailtrack.io/install?source=signature&lang=en&referral=randhawaay@gmail.com&idSignature=22>
>
> On Wed, Jan 27, 2016 at 12:24 AM, Brian West <brian at freeswitch.org> wrote:
>
>> What exactly was the original issue that was trying to be resolved that
>> required the session count?
>>
>> On Tue, Jan 26, 2016 at 10:03 AM, Marcel Haldemann <
>> marcel.haldemann at convercom.ch> wrote:
>>
>>> small correction for my previous answer:
>>>
>>> For "outbound" only channels the command would have to be like:
>>>
>>> Show channels count like external
>>>
>>> What would result in:
>>>
>>> api = freeswitch.API();
>>> filter = " like external"; -- set this as needed or let empty for no
>>> filter
>>> num_channels = api:executeString("show channels count" .. filter);
>>> digits = api:execute("regex", num_channels  .. "|/([0-9]*)/|$1");
>>> freeswitch.consoleLog("info", "num channels is: " .. digits .. "\n");
>>>
>>> as already mentioned this would expect a profile for outbound calls
>>> "only", called external.
>>> More info about the filter see here:
>>> https://freeswitch.org/confluence/display/FREESWITCH/mod_commands and
>>> search for "show channels"
>>> This applys to FreeSwitch 1.6/1.7
>>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: freeswitch-users-bounces at lists.freeswitch.org [mailto:
>>> freeswitch-users-bounces at lists.freeswitch.org] Im Auftrag von Marcel
>>> Haldemann
>>> Gesendet: Dienstag, 26. Januar 2016 15:38
>>> An: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
>>> Betreff: Re: [Freeswitch-users] DETECT ACTIVE CHANNELS
>>>
>>> For LUA it's (FS 1.6):
>>> api = freeswitch.API();
>>> num_channels = api:executeString("show channels count");
>>> digits = api:execute("regex", num_channels  .. "|/([0-9]*)/|$1");
>>> freeswitch.consoleLog("info", "num channels is: " .. digits .. "\n")
>>>
>>> to get the number of active channels.
>>>
>>>
>>> in Dialplan it could be done like this:
>>>
>>> <action application="set" data="foo=${regex(${show channels
>>> count}|/([0-9]*)/|%1)}"/>
>>> <action application="log" data="INFO foo: ${foo}" />
>>>
>>>
>>> PS: If you only want outbound calls you could try:
>>>
>>> Show channels like external
>>>
>>> as command, you then however must have a sip profile that is only for
>>> outbound (in this case named external).
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://confluence.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://confluence.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>>
>>
>>
>>
>> --
>>
>> *Brian West*
>> brian at freeswitch.org
>>
>>
>> *Twitter: @FreeSWITCH , @briankwest*
>> http://www.freeswitchbook.com
>> http://www.freeswitchcookbook.com
>>
>> Got Bugs? Report them here <https://freeswitch.org/jira>! | Reddit:
>> /r/freeswitch <https://www.reddit.com/r/freeswitch>
>>
>> *T:*+19184209001 | *F:*+19184209002 | *M:*+1918424WEST (9378)
>> *iNUM:*+883 5100 1420 9001 | *ISN:*410*543 | *Skype:*briankwest
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://confluence.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20160126/20e270db/attachment-0001.html 


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