Can we programmatically act on an already ringing call so to divert it right away?

Let’s say I want to create a caller ID popup application that would allow me to click and send an already ringing incoming call to either voicemail or just to hang it up.

Let’s also assume Asterisk is currently in a Dial command ringing my handset for an incoming call; is there a way to interrupt that Dial while it’s ringing and perform the chosen action, and not just wait until it times out before doing so?

From a user perspective, if the phone is ringing and I chose to Hangup or Send to voicemail, then I would expect the phone to stop ringing right away and perform the chosen action as soon as I click, and not 5 seconds after.

Thanks !

AMI ChannelRedirect and AMI Hangup.

What have you been trying that results in a five second delay?

Analogue phone generally cannot detect when the switch has hung up the call. If they are regenerating ringing internally, and not in time with the ringing current, it may take them time to realise that ringing current is not going to be applied again.

1 Like

An alternative to AMI is ARI - Asterisk REST API.
Specifically, ARI allows manipulating channels. Its methods and parameters are described here.

It depends whether the request is being initiated from a phone or a computer as to whether ARI or AMI is the approriate technology.

Thanks !

I am on 1.8 and the call-flow is handled in an AGI. The divert commands will come from another script.

so I will look at AMI ChannelRedirect and AMI Hangup like you mentioned. It makes sense !