In the TCD (Termination Call Detail) table which you can find in the HDS database, you can find a column called “CallDisposition”. This column contains codes that refer to how the call was ended (i.e. Call Disposition code of 52 refers to “Called Party Disconnected”).
If the customer disconnects the call, the Call disposition of the call(all 3 legs) will be 13.
If the agent disconnects the call, the second call leg disposition is 52 and other 2 is 13[/b]
==== Dose asterisk has some set of functionality or feature . ???/
Please reply as soon as possible .
===
You can also get it from the order of the hangup events in channel event logging, which you should probably be using as it sounds like you have non-trivial logging requirements.
I normally use something like below to find out who disconnected the call
exten => _X.,1,Set(DisconnectedBy=CALLER)
; g - Proceed with dialplan execution at the next priority in the current extension if the destination channel hangs up.
same => n,Dial(${YOUR_DIAL_TECHNOLOGY}/${NUMBER},g)
same => n,Set(DisconnectedBy=CALLEE)
same => n,Hangup
exten => h,1,NoOp(DisconnectedBy ${DisconnectedBy})
same => n,Set(CDR(userfield)=${DisconnectedBy})