Good time of day, colleagues.

It is necessary to display the number of channels used with Asterisk. core show channels shows all channels, but I only need the number Can someone tell me?

I knock on Aster like this:

 import asterisk.manager from asterisk.agi import * agi = AGI() manager = asterisk.manager.Manager() manager.connect('000.000.000.1') manager.login('login', 'passz') manager.command() agi.send_command() 

    2 answers 2

    Good day! Try the command

    core show channels count

    True, in any case, it will take a bit to parse the answer. Well, either in your output count the number of lines (minus the cap and output footer).

    • Thank you, I knew it, I'll probably have to do it all the time. - xmaster83
    • I have all similar statistics on Zabbix kept on - StuxForce

    Well, as it happened

     import asterisk.manager manager = asterisk.manager.Manager() manager.connect('000.000.000.1') manager.login('login', 'passz') ter=manager.command("core show channels count") print(ter.response[3]) nums = re.findall(r'[0-9]+', ter.response[3]) print (nums[0])