Issue
I am currently working on a call script that notifies callers when a call is received. In order to connect the receiver of the call presses 1 or says 'yes' to accept.
The problem is that the #1 prompt is not always recognized and even when the receiver says 'yes' it is sometimes not recognized. I don't think it is the code, but rather with the type of phone or way the receiver is saying yes.
I'd like to modify this so that the receiver can say anything. Basically if the call receiver makes any verbal noise it will work. I understand that this does not sound ideal, but for my system it would work fine.
A snippet of the code for this I have currently is:
if($content_array['Digits'] == 1 || stripos($content_array['SpeechResult'], 'yes')!==false) {
$model_accepted = true;
$sql_update1 = array("call_status" => 'model_accepted');
$where_clause1 = "id = '".$twillio_ivr_logs_array[0]['id']."'";
$updated_return1 = $sqlObj->updateArray('twillio_ivr_logs', $sql_update1, $where_clause1);
$sql_update= array( "status" => "connected");
$where_clause = "id = '".$order_array[0]['id']."'";
$update_mg = $sqlObj->updateArray('client_orders', $sql_update, $where_clause);
$accepted = "true";
} else {
$model_accepted = false;
$sql_update1 = array("call_status" => 'model_rejected');
$where_clause1 = "id = '".$twillio_ivr_logs_array[0]['id']."'";
$updated_return1 = $sqlObj->updateArray('twillio_ivr_logs', $sql_update1, $where_clause1);
$sql_update= array( "status" => "rejected");
$where_clause = "id = '".$order_array[0]['id']."'";
$update_mg = $sqlObj->updateArray('client_orders', $sql_update, $where_clause);
}
} else {
}
Any help would be greatly appreciated.
Thank you
Solution
Try just to play with the number of letters recognized (let's call it a noise)
//number of letters recognized with spaces
$noiseLength = 2;
if(isset($content_array['Digits']) || strlen($content_array['SpeechResult']) > $noiseLength) {
}
if($content_array['Digits'] == 1 || strlen($content_array['SpeechResult']) > $noiseLength) {
}
Answered By - Jimmix Answer Checked By - Candace Johnson (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.