Search code examples
voiptelecommunicationopensips

Saving cdrs manually using avp_db_query in Opensips


Is there a way to record cdrs manually using avp_db_query in opensips. I am using ACC table to record cdrs and than running procedure to transfer data to another table. But this put a lot of overhead on my DB due to too many calls. So is there any way that I can put directly cdrs in my actual table using AVP_DB_QUERY, I am doing for missing and not accepted calls but don't know how to do it for Answered calls.


Solution

  • You can program OpenSIPS to push CDR events over to the event interface instead of writing them to the database with:

    do_accounting("evi", "cdr|failed");
    

    Next, using the event_route module, you may subscribe to the E_ACC_CDR event by defining the route below, where you can perform your avp_db_query:

    event_route [E_ACC_CDR]
    {
        fetch_event_params(...);
        avp_db_query(...);
    }