[Freeswitch-users] DETECT ACTIVE CHANNELS

Brian West brian at freeswitch.org
Tue Jan 26 22:24:53 MSK 2016


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20160126/1a3a1974/attachment-0001.html 


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