Asterisk ARI Call Details

Hi everyone,

I’m exploring the capabilities of the Asterisk REST Interface (ARI) for integrating Asterisk with external systems. I’m curious to know if ARI provides functionality to retrieve call details, such as call duration, call status (answered, missed, etc.), and possibly call recordings.

Specifically, I’m interested in accessing this information programmatically to integrate it with our custom applications. Does ARI offer endpoints or methods to access such call details? If so, could you please provide some insights or examples on how to utilize them effectively?

Any guidance or resources on this topic would be greatly appreciated!

Thanks in advance!

The answer is no. It’s not an API for doing such things, that would be provided by whatever solution is using Asterisk. The API is for writing telephony applications - such as voicemail or call queues.

what alternative solutions or approaches would you recommend for integrating call details records with an external system? Specifically, how can we effectively capture and store call details and related metadata from Asterisk within our custom application?"

Asterisk provides different CDR modules, such as ones for writing to a file or to a database. It’s up to you to use what Asterisk provides in the way that best fits your arrangement. Asterisk is just a toolkit to build things.

In the context of integrating Asterisk with external systems, I understand that Asterisk provides various Call Detail Record (CDR) modules for managing call details, including writing them to a database.

However, I’m interested in storing call details outside of the Asterisk database, preferably in an external application. Could you please provide guidance on how to achieve this? Are there any recommended approaches or best practices for integrating Asterisk’s CDR functionality with external systems for call detail storage?

I can provide nothing further on this, perhaps someone else can.

Understood, thank you for your response.

Hi, have a look to Examples: Asterisk · sipcapture/homer Wiki · GitHub

Maybe is something good to you

Thank you for the suggestion! I’ll look into it and see if it fits my requirements

You can create a new/separate DSN and use it in cdr_adaptive_odbc.conf/cdr_odbc.conf, if you are using odbc. you can configure mysql/pgsql cdr config accordingly.

Make sure your external db-server is fast enough and with lower latency in term of network readability to avoid missing cdrs/error with cdr module.

I just write CDR to a text file as CSV (Asterisk does this out of the box) then I have a Cron run every X minutes which grabs each line and writes it to an external MariaDB server. This isn’t hard on Asterisk and the cron isn’t hard on the system etc… It’s been working well for years.

But, I don’t even really use this CDR these days. I create my own call records directly in a DB table when a call comes in, then I update them as needed as the call progresses, hangs up etc. It was a lot of work but, I have exactly what I want without having to worry about fitting my needs inside of what Asterisk CDR functionality provides.

Just me, I probably reinvented the wheel but it works for my needs.

But then the CSV file will grow and grow, unless you have some scheme for rotating it. Which adds more complexity. Seems simpler to me to just write records directly to the database.

@fonewiz
Thank you for sharing your approach. Since you mentioned not using CDRs directly, could you provide more details on how you capture call data from Asterisk and manage it in your custom database table? Understanding your process would be valuable for those exploring alternative methods for call record management

You want to place the CDR details in your own database? there is a few ways to this. You should be able to use the unixodbc to define the table and fields you want written to your database. Been a long time so I wouldn’t remember the details exactly how. Take a look at cdr mysql/ cdr unixodbc… Being lazy, and as second choice I could also use the dialplan database functions to write to a database during call start and call end. Or, you can also use AGI from the dialplan to call an external Python/node/php/etc script to write the data to your database.

Yes, I want to store the Call Detail Records (CDRs) in my database. Thank you for the suggestions!

Using UnixODBC to define the table and fields sounds like a robust approach. I’ll explore the options available with cdr_mysql and cdr_unixodbc to set up the database schema and configure the data writing process.

I appreciate your guidance and will explore these options to determine the best approach for my setup. Thank you again for your assistance!

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