Storing Outbound Caller ID per Call
Posted: 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
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