Add * prefix to voicemail extension 4000. For *97 change the variable used to identify the registered extension. CDR use domain_uuid if it has been supplied.

This commit is contained in:
Mark Crane 2012-07-07 18:40:15 +00:00
parent b061a5e90e
commit 1c5f7d57d6
3 changed files with 23 additions and 16 deletions

View File

@ -1,6 +1,6 @@
<!-- voicemail main extension, used when * is pressed from an external number --> <!-- voicemail main extension, used when * is pressed from an external number -->
<extension name="vmain" app_uuid="d085a1e3-c53a-4480-9ca6-6a362899a681"> <extension name="vmain" app_uuid="d085a1e3-c53a-4480-9ca6-6a362899a681">
<condition field="destination_number" expression="^vmain$|^4000$|^\*98$"> <condition field="destination_number" expression="^vmain$|^\*4000$|^\*98$">
<action application="answer"/> <action application="answer"/>
<action application="sleep" data="1000"/> <action application="sleep" data="1000"/>
<action application="voicemail" data="check default ${domain_name}"/> <action application="voicemail" data="check default ${domain_name}"/>

View File

@ -3,6 +3,6 @@
<condition field="destination_number" expression="^\*97$"> <condition field="destination_number" expression="^\*97$">
<action application="answer"/> <action application="answer"/>
<action application="sleep" data="1000"/> <action application="sleep" data="1000"/>
<action application="voicemail" data="check default ${domain_name} ${sip_from_user}"/> <action application="voicemail" data="check default ${domain_name} ${caller_id_number}"/>
</condition> </condition>
</extension> </extension>

View File

@ -133,10 +133,10 @@ function process_xml_cdr($db, $leg, $xml_string) {
//store the call leg //store the call leg
$database->fields['leg'] = $leg; $database->fields['leg'] = $leg;
//store the call direction. //store the call direction
$database->fields['direction'] = check_str(urldecode($xml->variables->call_direction)); $database->fields['direction'] = check_str(urldecode($xml->variables->call_direction));
//store post dial delay, in milliseconds. //store post dial delay, in milliseconds
$database->fields['pdd_ms'] = check_str(urldecode($xml->variables->progress_mediamsec) + urldecode($xml->variables->progressmsec)); $database->fields['pdd_ms'] = check_str(urldecode($xml->variables->progress_mediamsec) + urldecode($xml->variables->progressmsec));
//get break down the date to year, month and day //get break down the date to year, month and day
@ -145,23 +145,30 @@ function process_xml_cdr($db, $leg, $xml_string) {
$tmp_month = date("M", $tmp_time); $tmp_month = date("M", $tmp_time);
$tmp_day = date("d", $tmp_time); $tmp_day = date("d", $tmp_time);
//find the domain_uuid by using the domain_name //get the domain values from the xml
$domain_name = check_str(urldecode($xml->variables->domain_name)); $domain_name = check_str(urldecode($xml->variables->domain_name));
$sql = "select domain_uuid from v_domains "; $domain_uuid = check_str(urldecode($xml->variables->domain_uuid));
if (strlen($domain_name) == 0 && $context != 'public' && $context != 'default') {
$sql .= "where domain_name = '".$context."' "; //get the domain_uuid with the domain_name
}
else {
$sql .= "where domain_name = '".$domain_name."' ";
}
$row = $db->query($sql)->fetch();
$domain_uuid = $row['domain_uuid'];
if (strlen($domain_uuid) == 0) { if (strlen($domain_uuid) == 0) {
$sql = "select domain_name, domain_uuid from v_domains "; $sql = "select domain_uuid from v_domains ";
if (strlen($domain_name) == 0 && $context != 'public' && $context != 'default') {
$sql .= "where domain_name = '".$context."' ";
}
else {
$sql .= "where domain_name = '".$domain_name."' ";
}
$row = $db->query($sql)->fetch(); $row = $db->query($sql)->fetch();
$domain_uuid = $row['domain_uuid']; $domain_uuid = $row['domain_uuid'];
if (strlen($domain_name) == 0) { $domain_name = $row['domain_name']; } if (strlen($domain_uuid) == 0) {
$sql = "select domain_name, domain_uuid from v_domains ";
$row = $db->query($sql)->fetch();
$domain_uuid = $row['domain_uuid'];
if (strlen($domain_name) == 0) { $domain_name = $row['domain_name']; }
}
} }
//set values in the database
$database->domain_uuid = $domain_uuid; $database->domain_uuid = $domain_uuid;
$database->fields['domain_uuid'] = $domain_uuid; $database->fields['domain_uuid'] = $domain_uuid;
$database->fields['domain_name'] = $domain_name; $database->fields['domain_name'] = $domain_name;