Forcing hangup of existing extension from dialplan

Hi,

I’m trying to do the following:

Have an extension that may be called using its normal number (6010, for example), or via a modified one (106010, for example) which will cause the destination phone to auto-answer. In the latter case, when the system I control that communicates with Asterisk starts up, I’m currently dynamically creating special extensions in the dialplan via AMI to perform the operation:

command: dialplan remove extension 106010@exten-rules"
command: dialplan add extension 106010,1,SIPAddHeader,\"Call-Info: answer-after=0\" into exten-rules"
command: dialplan add extension 106010,2,Macro,\"internalcall,6010,SIP/6010\" into exten-rules"
command: dialplan add extension 106010,3,Voicemail,\"6010,u\" into exten-rules

This works fine - a call to 106010 causes the Grandstream phone I’m using at extension 6010 to auto-answer, except that ideally what I’d like to happen is for any existing call in progress for 6010 to get hung up when Asterisk gets a call to the 106010 auto-answer one.

I’m using Asterisk 1.8, and can’t see how this can be achieved. The SoftHangup application isn’t present, which is what I was drawn to attempting first, and I can’t seem to execute any CLI commands from the dialplan that might do the job (not system ones, but Asterisk ones).

Does anyone have any cunning (dial)plan to do this, please?

You can’t hangup and extension because an extension can have thousands of calls, and there would be no way to distinguish between them.

I don’t believe you can hangup a device (and even devices can have thousands of calls, if they represent trunks, and upwards of two, even if they represent phones).

If nothing else, you can hangup a channel by channel redirecting it to dialplan that runs Hangup().

The forum for support questions is Asterisk Support.