How to get extension number in Asterisk AMI in PBXware

Hello. Hope you are doing well.
I am using Asterisk AMI to trigger call hangup event.
Here is my event data what I’ve got:
{
event: ‘Hangup’,
privilege: ‘call,all’,
channel: ‘PJSIP/sbc-0854196a’,
channelstate: ‘6’,
channelstatedesc: ‘Up’,
calleridnum: ‘18965596625’,
calleridname: ‘NEW CHARLES G D’,
connectedlinenum: ‘105’,
connectedlinename: ‘Daniel Kanter’,
language: ‘en’,
accountcode: ‘sbc’,
context: ‘sbc’,
exten: ‘18285750030’,
priority: ‘1’,
uniqueid: ‘1734965737.60809’,
linkedid: ‘1734965737.60809’,
parentid: ‘1734965737.60809’,
‘callerid-pres’: ‘0’,
chanvariable: { GLOCOMID: ‘’ },
cause: ‘16’,
‘cause-txt’: ‘Normal Clearing’
}

In hangup event, I am going to get extension number, the “exten” field within the Hangup event represents the extension that was dialed in the context of the call, but not always necessarily correspond to the caller’s or callee’s actual extension number as understood in traditional PBX systems.

Thanks in advance.

This depends on details of your dialplan, as some dialplans may never explicitly contain the directory number of either party, only having equipment numbers. Whilst these re degenerate in many Asterisk configurations, making them degenerate goes against security advice.

You may have to instrument the dialplan, e.g. by adding custom events.

Also not that the exten value reported here is not the number called, but rather the extension being executed in the dialplan, at the time the call ended. That might not even be a directory number.

(On some traditional PABXes, equipment numbers look nothing like directory numbers, and may be something like cabinet-shelf-card-port.)

Hello @david551
Thanks for your quick answer.
Could you tell me how I should update the dialplan more details?
Btw, there are some tables including CDR that is provided by PBXware. so I guess there are some relationships between extension and hangup event data.

I missed the reference to PBXWare. If this is a GUI on top of Asterisk, it is unlikely that anyone here will have the necessary knowledge to answer questions about it, and you should use their support resources.

That’s reasonable for me. I will contact PBXware support team and keep you updated asap.

Hello everyone.

I am happy to share my updates with all of you.

I had a chance to contact with PBXware support team and found the solution.
In cdr table, accountcode field represents the extension number and there are 3 types:

  1. extension number
  2. sbc
  3. null

In sbc and null case, I could get the extension number from did.

Thanks for your consideration @david551

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.