简体   繁体   中英

How do I Hangup up call in Asterisk Event

I am connecting to Asterisk server using Python Asterisk manager. How do I hangup calls from the AMI.

def hangup_event(event, manager):
with ctx:

    if event.name == 'Hangup':
        data = {
            "channel":event.message['Channel'],
            "unique_id":event.message['Uniqueid'],
            "cause":event.message['Cause'],
        }

 manager.register_event('*', hangup_event)
 channel = 'SIP/356256266262'
 res = manager.send_action({'Action':'Hangup', 'Channel':channel})

My objective is to end the call but it isn't working.

Use ami action COMMAND. Issue command

channel request hangup channel_name_here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM