简体   繁体   中英

Asterisk 11 Who Hanged Up?

I do have an Asterisk 11 PBX and I'm developing an Windows Service application using the github AsterNET.AMI Library to connect my PBX. Till here everything is working fine, I can send commands and read incoming event messages.

But now I need to develop a feature on my software based over one information that I thought it could be easy to retrieve. The information I'm looking for is - who hanged up?

I googled for it a lot and I could find a few answers, most of them talking about setup the G option on CDR but also some considerations about this approach. Still like this I couldn't grab any valuable information for my scenario.

Maybe if I tell you about my working scenario you could help me. Lets go, I'm going to bullet split this:

  • I do have a caller calling from a cellphone and this calling are incoming to my internal PBX extension

  • My PSTN trunk is a E1/R2 directly to my PBX

  • No matter if caller or callee hangs up always I do have "normal clearing" message for hangup_cause

  • I know I'm receiving from my service provider the information about the releasing device, because if I use my Siemens 3800 Hipath over CSTA I can retrieve this information.

So the gold question is: How can I retrieve who is the releasing device on this situation?

You can try a combination of g and F options in the Dial application. The g option allows dialplan execution when the called party hangs up, while the F option allows you to continue execution to a context,extension,priority of your choice if the caller hangs up. So, you can understand which party is hanging up by the dialplan being executed after the call ended. Find here more info on these options: https://www.voip-info.org/asterisk-cmd-dial/

The only way I could find after read Asterisk doc almost entirely was reading HangupRequest event messages.

As I'm using AsterNet.AMI library to connect and manage my Asterisk, so I change the source code a little bit to have an event handler do read HangupRequest event.

HangupRequest event writes the messages like the following one:

Event: HangupRequest
Privilege: call,all
Channel: SIP/8103-000001be
ChannelState: 6
ChannelStateDesc: Up
CallerIDNum: 8103
CallerIDName: Agent 8103
ConnectedLineNum: 51999887766
ConnectedLineName: 51999887766
Language: en
AccountCode:
Context: from-internal
Exten: 8100
Priority: 1
Uniqueid: 1569618521.446
Linkedid: 1569618519.445

So accordly to HangupRequest Event Asterisk documentation I could notice the channel in the message is the channel related to the releasing device, also CallerIDNum and CallerIDName are related to.

This feature is not implemented right now on the github library, but I'm going to push over there and ask them to include on next release.

Yet I don't know where to read this information on FreePBX Admin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM