Storing Outbound Caller ID per Call

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Storing Outbound Caller ID per Call

Postby duncanb » Wed Nov 06, 2019 1:52 am

Hi All,

This is not a "standard" Vicidial question as it has to do with some customisations we've made to outbound calling, but I'm hoping somebody can help point me in the right direction.

A customer of ours requested a GUI where they can switch between 3 different providers and what caller ID should be used for that provider. This can be done per-campaign, and they make these changes regularly. We "hooked" into the dialplan just before the actual "Dial" of an outbound call where we check what campaign is being dialled and then set the relevant SIP trunk and Caller ID before the Dial proceeds.

This has been running well for over a year, but the client now wants to be able to link the outbound Caller ID of each call to the data in the vicidial_log table. They want this so that their BI people can run reports on the effectiveness of different Caller IDs and what happens when they change.

The problem is, at the point where I set the Caller ID, I don't have any ID available in the Asterisk channel that I can see that I can use to link the Caller ID to the call. Ideally I would want to create a new column in vicidial_log (eg caller_id) and do (via ODBC funcs) a SQL query such as:

UPDATE vicidial_log SET caller_id = '${CALLERID}' WHERE uniqueid = '${UNIQUEID}';

...but the UNIQUEID in the channel where I set the Caller ID is different to the uniqueid for the call in the vicidial_log table. I don't see the correct unique ID if I do a DumpChan() on the Asterisk channel.

I also looked at using vicidial_log_extended and using the "caller_code" field to identify the call. There is an unused "custom_call_id" field there already that we can use to store the caller ID. I do have the correct caller_code (eg: "M9070733310079833159") available in the channel where I set the caller ID, but when I do an:

UPDATE vicidial_log_extended SET custom_call_id = '${CALLERID}' WHERE caller_code= '${CALLERUNIQUEID}';

...the update doesn't work. It appears that this is because the row with the relevant ID has not been inserted into the table yet. I find this strange though as I try to run the update after the FastAGI_log.pl call (AGI(agi://127.0.0.1:4577/call_log)).

Does anybody have any suggestions how I could effectively link the caller ID to the vicidial_log data?

Thanks,
Duncan
duncanb
 
Posts: 19
Joined: Wed Jun 06, 2012 6:56 am

Re: Storing Outbound Caller ID per Call

Postby mflorell » Wed Nov 06, 2019 7:34 am

The callerID string used at the time the call was placed is stored in the vicidial_dial_log table, but we don't really have any easy way to change that on the fly as you seem to be wanting to do.
mflorell
Site Admin
 
Posts: 18387
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Re: Storing Outbound Caller ID per Call

Postby duncanb » Wed Nov 06, 2019 7:53 am

Thanks for the reply Matt. After checking out the relevant code and dialplan I figured this was going to be no easy task. :P

If I come up with anything useful I'll stick it in this thread.

Cheers,
Duncan
duncanb
 
Posts: 19
Joined: Wed Jun 06, 2012 6:56 am

Re: Storing Outbound Caller ID per Call

Postby ambiorixg12 » Wed Nov 06, 2019 1:14 pm

Using CDR channel variables you can do it


https://wiki.asterisk.org/wiki/display/ ... +Variables, use especially ${CDR(uniqueid)} ${CDR(clid)}
ambiorixg12
 
Posts: 453
Joined: Tue Sep 17, 2013 10:35 pm


Return to Support

Who is online

Users browsing this forum: No registered users and 89 guests