Is it possible to hangup an originate before it is answered

I have a requirement to make an incoming call initiate 2 originates (synchronously) and join the resulting 3 calls in a confbridge. Making and joining the calls is working fine using originate and setting the app as ConfBridge and I even worked out how to end all the calls if any party hangs up.

The problem I have is if the initial caller hangs before the callees answer the originates keep ringing the callees whereas if the caller hangs up I want it to cancel the whole process

I am currently do all this just in the dialplan and I cant see how to get the channel id that the the originating call is going out on so I can hang it up.

Would this require and can it be done with AMI? I have not used AMI at all yet, I assume I would listen for some kind of originate start dialing event and get the channel id from there?

You can originate on local channel and then call your desired numbers. Now if caller hangs up, you can always use Softhangup application to hangup the originated calls. (You’ll have to implement some logic to know local channel in your incoming call dialplan. Maybe AstDB)

–Satish Barot

I tried the following simplified dialplan to test that but I find the from-pstn h extension does not fire until after the originate finishes

exten => _0000.,1,Verbose(callee1)
same => n,Set(__conf=${EXTEN})
same => n,Set(DB(${conf}/callee1)=${CHANNEL})
same => n,Originate(SIP/888889999999@oxygen8,app,ConfBridge,${conf},30)

exten => h,1,Verbose(callee1 hangup [${conf}])

exten => _44333333333,1,Ringing()
same => n,Wait(1)
same => n,Progress()
same => n,Set(__conf=00001234)
same => n,Originate(Local/${conf}@callee1,app,NoOP)
same => n,ConfBridge(${conf})
same => n,Verbose(End from-pstn)

exten => h,1,Verbose(pstn hangup ${conf})
same => n,Set(calleechan=${DB(${conf}/callee1)})
same => n,SoftHangup(${calleechan})
same => n,DBdeltree(${conf})

Just tried it with dial instead as a test, now the h extension is called on hangup of originating call but the softhangup does not cancel the dialing

[from-pstn] exten => _4433333333,1,Ringing() same => n,Wait(1) same => n,Progress() same => n,Set(__conf=00001234) ;same => n,Originate(Local/${conf}@callee1,app,NoOP) same => n,Dial(Local/${conf}@callee1) same => n,ConfBridge(${conf}) same => n,Verbose(End from-pstn)

I see the log line in the asterisk console but as i say the dialing is not interrupted

-- Executing [h@from-pstn:3] SoftHangup("SIP/oxygen8-00000119", "Local/00001234@callee1-00000043;2") in new stack [2014-04-09 20:37:22] WARNING[18235][C-0000009c]: app_softhangup.c:122 softhangup_exec: Soft hanging Local/00001234@callee1-00000043;2 up.

OK one step further if I only use Dial and not originate then I can interrupt the dialing.

actually scratch that the hangup of the originating channel is just hanging up the local extension too