I’m sure I am searching for the wrong thing… I am trying to build a display interface based on HTML that shows the live state of an extension. ie a webpage that shows which extensions are on active calls, ringing, not available etc.
Where do I begin?
This sounds much more like an AMI application than an ARI one, although most of the work that will go into it will be web development, not Asterisk work.
You use AMI to get the state from asterisk, currently there’s an HTTP interface, that can deliver in multiple formats, including XML, you then process this data and present them on a webpage, like you would with any other data retrieved from an API.
The HTTP interface for AMI seems to be on it’s way out, from what I can understand from the wiki, but for the moment it still works, and is the easiest to interface with.
If you want to be more future proof, you’d have to talk to AMI through the raw TCP interface instead. Information on accessing both, are available in the Asterisk wiki - Asterisk Manager Interface (AMI) - Asterisk Project - Asterisk Project Wiki
To get information on extensions, you can use the AMI command PJSIPShowEndpoints (Asterisk 20 ManagerAction_PJSIPShowEndpoints - Asterisk Project - Asterisk Project Wiki), if using PJSIP, there’s also a DeviceStateList command in the docs, but on my systems, it’s not available.
If you need to handle a large volume of extensions on one system, polling Asterisk could result in bad performance, in that situation, you setup a service to monitor events describing state change on extensions, and store that for your web application to consume.
Thanks for the replies, I’ll look into AMI concept and hopefully get the data I need.