Put a call on hold via AMI command

I have a queue of agents, where I need, through AMI commands or some other means, to put the call on hold, and when necessary, the agent returns to talk to the customer, always using a screen.
Is there any way to do this being similar to the phone’s hold button?

I believe you actually want to put the caller on hold. The agent being on hold is something only the channel driver can do.

I’m pretty sure you will need to insert a non-optimising local channel on one side of the queue or the other, as you don’t want the queue application to think you are ending the call.

From there, I would see you could either do a double channel redirect to put the caller into music on hold, or park them, and safely hang onto the agent, possibly the same way. When you want to resume, you redirect one side into the Bridge application.

Another way it to inject DTMF to start a transfer, but never actually complete it then send DTMF to abort the transfer. This, again, is based on having a local channel on one side, so that the channels involved in the queue application never change.

You are going to need to look for a complete solution, as doing this sort of thing piece by piece may have one change breaking previous ones. As such you should expect to do several proof of concept tests.

It is strange because in the physical device this is very simple.
I can’t use DTMF for transfer as I have a timeout setting however the call will return to the caller.
I tested putting the call in Park, but the queue understands that the call has ended and releases the agent for the next service.

Which is why you need a local channel, to that there is bridge with a channel each side, and why you need to do a double redirect, so that one of the channels isn’t left in mid-air.

The device uses a signalling protocol, for analogue, it will be a short loop disconnect, and for SIP, it will be a re-INVITE, to signal the hold to the PABX. In Asterisk, the channel driver puts notes the hold state and sends an AST_CONTROL_HOLD message down the internal path. When that reaches the channel driver at the other side, that channel driver then replaces the through audio by music on hold.

Can I forge sending AST_CONTROL_HOLD to a channel using the asterisk AMI api in order to put it on hold?


I believe the answer is that AMI cannot explicitly generate control frames on channel, but it would be as easy fro you to check that in the code as it would be for me. If you don’t want to lose the other channel, you may have to use the double form of redirect.

Typically you would have to channel redirect it, possibly to the park application, although I think it can also be done with dialplan loops.