diff --git a/app/scripts/resources/scripts/app/voicemail/resources/functions/record_message.lua b/app/scripts/resources/scripts/app/voicemail/resources/functions/record_message.lua index a459da7b8a..93a61d9c68 100644 --- a/app/scripts/resources/scripts/app/voicemail/resources/functions/record_message.lua +++ b/app/scripts/resources/scripts/app/voicemail/resources/functions/record_message.lua @@ -587,7 +587,7 @@ --if the recording is below the minimal length then re-record the message if (message_length > 2) then - --continue + session:setVariable("voicemail_message_seconds", message_length); else if (session:ready()) then --your recording is below the minimal acceptable length, please try again diff --git a/app/xml_cdr/app_config.php b/app/xml_cdr/app_config.php index 29a1acb1eb..3cd481481d 100644 --- a/app/xml_cdr/app_config.php +++ b/app/xml_cdr/app_config.php @@ -564,6 +564,12 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Save the last application data."; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "voicemail_message"; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "boolean"; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "missed_call"; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "boolean"; $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index eac992c12d..4f488c1002 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -150,6 +150,7 @@ if (!class_exists('xml_cdr')) { $this->fields[] = "rtp_audio_in_mos"; $this->fields[] = "last_app"; $this->fields[] = "last_arg"; + $this->fields[] = "voicemail_message"; $this->fields[] = "cc_side"; $this->fields[] = "cc_member_uuid"; $this->fields[] = "cc_queue_joined_epoch"; @@ -391,6 +392,14 @@ if (!class_exists('xml_cdr')) { $this->array[$key]['last_app'] = urldecode($xml->variables->last_app); $this->array[$key]['last_arg'] = urldecode($xml->variables->last_arg); + //voicemail message success + if ($xml->variables->voicemail_action == "save" && $xml->variables->voicemail_message_seconds > 0){ + $this->array[$key]['voicemail_message'] = "true"; + } + else { //if ($xml->variables->voicemail_action == "save") { + $this->array[$key]['voicemail_message'] = "false"; + } + //conference $this->array[$key]['conference_name'] = urldecode($xml->variables->conference_name); $this->array[$key]['conference_uuid'] = urldecode($xml->variables->conference_uuid); @@ -922,13 +931,13 @@ if (!class_exists('xml_cdr')) { if (strlen($this->start_stamp_begin) > 0 || strlen($this->start_stamp_end) > 0) { unset($this->quick_select); if (strlen($this->start_stamp_begin) > 0 && strlen($this->start_stamp_end) > 0) { - $sql_date_range .= " and start_stamp between :start_stamp_begin and :start_stamp_end \n"; + $sql_date_range = " and start_stamp between :start_stamp_begin and :start_stamp_end \n"; $parameters['start_stamp_begin'] = $this->start_stamp_begin.':00.000'; $parameters['start_stamp_end'] = $this->start_stamp_end.':59.999'; } else { if (strlen($this->start_stamp_begin) > 0) { - $sql_date_range .= "and start_stamp >= :start_stamp_begin \n"; + $sql_date_range = "and start_stamp >= :start_stamp_begin \n"; $parameters['start_stamp_begin'] = $this->start_stamp_begin.':00.000'; } if (strlen($this->start_stamp_end) > 0) { @@ -939,13 +948,13 @@ if (!class_exists('xml_cdr')) { } else { switch ($this->quick_select) { - case 1: $sql_date_range .= "and start_stamp >= '".date('Y-m-d H:i:s.000', strtotime("-1 week"))."' \n"; break; //last 7 days - case 2: $sql_date_range .= "and start_stamp >= '".date('Y-m-d H:i:s.000', strtotime("-1 hour"))."' \n"; break; //last hour - case 3: $sql_date_range .= "and start_stamp >= '".date('Y-m-d')." "."00:00:00.000' \n"; break; //today - case 4: $sql_date_range .= "and start_stamp between '".date('Y-m-d',strtotime("-1 day"))." "."00:00:00.000' and '".date('Y-m-d',strtotime("-1 day"))." "."23:59:59.999' \n"; break; //yesterday - case 5: $sql_date_range .= "and start_stamp >= '".date('Y-m-d',strtotime("this week"))." "."00:00:00.000' \n"; break; //this week - case 6: $sql_date_range .= "and start_stamp >= '".date('Y-m-')."01 "."00:00:00.000' \n"; break; //this month - case 7: $sql_date_range .= "and start_stamp >= '".date('Y-')."01-01 "."00:00:00.000' \n"; break; //this year + case 1: $sql_date_range = "and start_stamp >= '".date('Y-m-d H:i:s.000', strtotime("-1 week"))."' \n"; break; //last 7 days + case 2: $sql_date_range = "and start_stamp >= '".date('Y-m-d H:i:s.000', strtotime("-1 hour"))."' \n"; break; //last hour + case 3: $sql_date_range = "and start_stamp >= '".date('Y-m-d')." "."00:00:00.000' \n"; break; //today + case 4: $sql_date_range = "and start_stamp between '".date('Y-m-d',strtotime("-1 day"))." "."00:00:00.000' and '".date('Y-m-d',strtotime("-1 day"))." "."23:59:59.999' \n"; break; //yesterday + case 5: $sql_date_range = "and start_stamp >= '".date('Y-m-d',strtotime("this week"))." "."00:00:00.000' \n"; break; //this week + case 6: $sql_date_range = "and start_stamp >= '".date('Y-m-')."01 "."00:00:00.000' \n"; break; //this month + case 7: $sql_date_range = "and start_stamp >= '".date('Y-')."01-01 "."00:00:00.000' \n"; break; //this year } } @@ -1086,6 +1095,7 @@ if (!class_exists('xml_cdr')) { $sql .= " direction, \n"; $sql .= " start_stamp, \n"; $sql .= " hangup_cause, \n"; + $sql .= " originating_leg_uuid, \n"; $sql .= " billsec \n"; $sql .= " from v_xml_cdr \n"; if (!($_GET['show'] === 'all' && permission_exists('xml_cdr_all'))) { diff --git a/app/xml_cdr/v_xml_cdr_import.php b/app/xml_cdr/v_xml_cdr_import.php index a38985e228..6230f8c030 100644 --- a/app/xml_cdr/v_xml_cdr_import.php +++ b/app/xml_cdr/v_xml_cdr_import.php @@ -198,6 +198,14 @@ $database->fields['last_app'] = urldecode($xml->variables->last_app); $database->fields['last_arg'] = urldecode($xml->variables->last_arg); + //voicemail message success + if ($xml->variables->voicemail_action == "save" && $xml->variables->voicemail_message_seconds > 0){ + $database->fields['voicemail_message'] = "true"; + } + elseif ($xml->variables->voicemail_action == "save") { + $database->fields['voicemail_message'] = "false"; + } + //conference $database->fields['conference_name'] = urldecode($xml->variables->conference_name); $database->fields['conference_uuid'] = urldecode($xml->variables->conference_uuid); diff --git a/app/xml_cdr/xml_cdr_inc.php b/app/xml_cdr/xml_cdr_inc.php index 3d12d71339..d7255167d8 100644 --- a/app/xml_cdr/xml_cdr_inc.php +++ b/app/xml_cdr/xml_cdr_inc.php @@ -417,7 +417,7 @@ $sql .= "and hangup_cause like :hangup_cause "; $parameters['hangup_cause'] = '%'.$hangup_cause.'%'; } - elseif (!permission_exists('xml_cdr_lose_race') && permission_exists('xml_cdr_enterprise_leg')) { + elseif (!permission_exists('xml_cdr_lose_race') && !permission_exists('xml_cdr_enterprise_leg')) { $sql .= "and hangup_cause != 'LOSE_RACE' "; } //exclude enterprise ring group legs @@ -437,10 +437,20 @@ break; case 'cancelled': if ($direction == 'inbound' || $direction == 'local' || $call_result == 'missed') { - $sql = "and (answer_stamp is null and bridge_uuid is null and sip_hangup_disposition <> 'send_refuse') "; + $sql .= " + and (( + answer_stamp is null + and bridge_uuid is null + and sip_hangup_disposition <> 'send_refuse' + ) + or ( + answer_stamp is not null + and bridge_uuid is null + and voicemail_message = false + ))"; } else if ($direction == 'outbound') { - $sql = "and (answer_stamp is null and bridge_uuid is not null) "; + $sql .= "and (answer_stamp is null and bridge_uuid is not null) "; } else { $sql .= " @@ -454,6 +464,12 @@ direction = 'outbound' and answer_stamp is null and bridge_uuid is not null + ) + or ( + (direction = 'inbound' or direction = 'local') + and answer_stamp is not null + and bridge_uuid is null + and voicemail_message = false ))"; } break;