How to find channel ID to programatically hang up call

I’m trying to figure out how to determine a channel ID so that I can programatically hang up a call. I’d like to be able to determine the channel ID by providing either a CID or extension number.

The other thing I’m trying to do is to be able to transfer a call based on the extension, to another extension. In this case what I’m trying to do is have a user click on a button that then transfers their current call to a custom extension that plays a message and hangs up.

Use AMI Events to track the call, or have the dialplan set a global variable that is read by AMI.

You transfer calls from devices to extensions. Why not just program a key on the phone with #xxxx where xxxx is the target extension number, and enable transfers in the Dial() options?

The transfer part can also be accomplished using AMI’s Redirect action. This will redirect a channel to a dialplan exension/context/priority.

We are using the Bria 4 softphone and it doesn’t have any programmable keys. :frowning:

But I have to know the channel ID and that’s where I’m stuck.

Unless you establish your own association then the best you can do is what Asterisk gives you - the endpoint or peer is in the name of the channel and you can look at events to know what is happening. If two channels are up though - how are you supposed to know which to deal with?