I would like to use the mixmonitor command to record calls between peer A and peer B by issuing the command using AMI. The problem is that I don’t know how to get the channel during the call. The channel argument must be passed to mixmonitor. All I have is the peer name, e.g. bob. The command ‘core show channels’ lists the channel’s string as ‘SIP/peer-[number]’, e.g. ‘SIP/bob-00000042’. Having only the peer name, how can I get the ‘SIP/peer-[number]’ channel string dynamically during a call so I can pass it to mixmonitor?
A peer may have multiple calls up from it so as a result you have to somehow make that association yourself, Asterisk can’t know which one you really mean.
Yes but at least could I just have the list of the dynamic channel ID’s associated with a specific peer? As I said, ‘CoreShowChannels’ is listing the channels for all peers.
Again, I need that dynamic channel ID to monitor (record) a call programmatically. What commands should my SIP client send to AMI to retrieve the dynamic channel ID of an ongoing call, so my client could pass that channel ID as an argument to the MixMonitor command to start recording the call?
AMI and SIP are different protocols. SIP peers can be both client and server in the same call. AMI is really intended for third party control, whereas your requirement is for first party control.
The normal way of invoking recording from a SP phone is use DTMF and features.conf.
If you really want to use AMI, and there is only ever one call per device, you could set the current channel for the device into a global variable named after the device.