Hangup random calls on purpose

Hi guys,

I’ve a request here to hangup calls randomly on purpose from time to time… totally odd request… but… anyway

Is there a way to list all the calls without enter in the CLI, and from the list select a random result and send a hangup cmd to disconnect the call?

Or is there any other more simple way?


Assuming all calls are using SIP channel driver, start by listing all chanels on your server

asterisk -x " core show channels" | awk ‘{print $1}’ | awk ‘/SIP/{print}’


Then you could insert the above commad output into an array and pick a ramdon value of the array

then use the asterisk channel request hangup command for example

asterisk -x " channel request hangup SIP/102-00000101"

1 Like

Awesome! tks ambiorixg12, will try it out!

If you know how to use PHP you can use array_rand() function to pick a random value based on the key return from the described function