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@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@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von Marcel Haldemann
Gesendet: Dienstag, 26. Januar 2016 15:38
An: FreeSWITCH Users Help <freeswitch-users@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@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@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@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@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@freeswitch.org
Twitter: @FreeSWITCH , @briankwest
http://www.freeswitchbook.com
http://www.freeswitchcookbook.comGot Bugs? Report them here! | Reddit: /r/freeswitch
T:+19184209001 | F:+19184209002 | M:+1918424WEST (9378)
iNUM:+883 5100 1420 9001 | ISN:410*543 | Skype:briankwest
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@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@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org