Third party call hangup

Hi,

I have setup a dial plan which routes all calls to the destination using a Calling Card Operator. I was able to send DTMF to the Calling Card Operator and avoided all voice prompts. I have used the following context for dialing out.

[code][from-internal-custom]
exten => _1XXXXXXXXXX,1,Dial(SIP/trunkname/1800xxxxxxx,M(sendccdigits))

[macro-sendccdigits]
exten => s,1,Wait(1) ; wait 1 second
exten => s,n,SendDTMF(xxxxx); send the PIN
exten => s,n,Wait(1) ; wait 4 seconds for the time remaining on card
exten => s,n,SendDTMF(1xxxxxxxxxx); send the number
exten => s,n,Wait(34) [/code]

The above context is working fine. The real problem which I couldn’t over come is Asterisk can not detect when the third-party hangup.

That is in the middle of the conversation if the Third party hangup, Asterisk wont receive any signal. According to Asterisk the calling party is the Calling Card Operator and it keeps the line live which again leads to the voice prompt of the Calling Card Service which is not good.

How do I control the calls routed via Calling Card Services?? Importantly how do we approach for call disconnect.

I am in the process of researching in the using Proxies or 3PCC or B2BUA. Is this a right approach?