Page 1 of 1

I made cm_dnc.agi for Opt-In

PostPosted: Wed Jun 28, 2017 6:12 am
by Vince-0
Hi guiz!

I needed to create a new option for opt-in on and IVR.
I made an addition to cm_dnc_agi script change to allow for a status INT (created in system statuses):

### process for INT path
if ($new_status =~ /INT/) # set the phone_number to INT
{
if ($g > 0)
{
### update all records for the phone_number in vicidial_list to INT (Interested Opt In)
$stmtA = "UPDATE vicidial_list SET status='INT' where lead_id IN($SleadsSQL);";
$affected_rows = $dbhA->do($stmtA);
if ($AGILOG) {$agi_string = "$affected_rows|$stmtA|"; &agi_output;}
}
}

Looks simple enough to work properly.
Can I submit this to code base for inclusion once it's documented etc?
Please advise,

Re: I made cm_dnc.agi for Opt-In

PostPosted: Wed Jun 28, 2017 7:24 am
by Vince-0
There's this parsing logic that needs amending, still figuring it out:

if (length($new_status) < 1)
{$new_status = 'NI';}
if (length($dnc_default) < 2)
{$dnc_default = 'YES';}
if (length($next_step) < 1)
{$next_step = 'B';}
if (length($camp_sys) < 2)
{$camp_sys = 'SYS';}

Re: I made cm_dnc.agi for Opt-In

PostPosted: Wed Jun 28, 2017 4:07 pm
by mflorell
Sounds like a good idea. Please post the code to the Issue Tracker when it's all done and tested :)

Re: I made cm_dnc.agi for Opt-In

PostPosted: Thu Jun 29, 2017 3:32 am
by Vince-0
I think the biggest problem could be that the inbound number format doesn't match the phone number format that is in the list. Clients can never seem to use proper e164 format consistently.
Probably means that there needs to be a separate case for inserting a new record or maybe a fix could be to do the select on a like statement for the phone number field and strip like 2 leading digits for where clause.. I dunno.

I will test some things so long.

This syntax looks OK, just requires that INT status is pre-created:

if (length($new_status) < 1)
{if ($new_status eq 'INT')
{$new_status = 'INT';}
elsif ($new_status eq 'NI')
{$new_status = 'NI';}}
{$new_status = 'NI';}
if (length($dnc_default) < 2)
{$dnc_default = 'YES';}
if (length($next_step) < 1)
{$next_step = 'B';}
if (length($camp_sys) < 2)
{$camp_sys = 'SYS';}