diff --git a/app/extensions/app_config.php b/app/extensions/app_config.php
index a0300e8258..1c6ba77cd0 100644
--- a/app/extensions/app_config.php
+++ b/app/extensions/app_config.php
@@ -198,14 +198,6 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
- $apps[$x]['db'][$y]['fields'][$z]['name'] = 'enabled';
- $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
- $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
- $z++;
- $apps[$x]['db'][$y]['fields'][$z]['name'] = 'description';
- $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
- $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
- $z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'mwi_account';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
@@ -213,6 +205,30 @@
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'sip_bypass_media';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = 'unique_id';
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = 'dial_string';
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = 'dial_user';
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = 'dial_domain';
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = 'enabled';
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
+ $z++;
+ $apps[$x]['db'][$y]['fields'][$z]['name'] = 'description';
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$y = 1; //table array index
$z = 0; //field array index
diff --git a/app/extensions/v_extensions_edit.php b/app/extensions/v_extensions_edit.php
index 455b2cb5c0..603f54a867 100644
--- a/app/extensions/v_extensions_edit.php
+++ b/app/extensions/v_extensions_edit.php
@@ -96,6 +96,7 @@ else {
$nibble_account = check_str($_POST["nibble_account"]);
$mwi_account = check_str($_POST["mwi_account"]);
$sip_bypass_media = check_str($_POST["sip_bypass_media"]);
+ $dial_string = check_str($_POST["dial_string"]);
$enabled = check_str($_POST["enabled"]);
$description = check_str($_POST["description"]);
}
@@ -181,6 +182,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//if (strlen($auth_acl) == 0) { $msg .= "Please provide: Auth ACL
\n"; }
//if (strlen($cidr) == 0) { $msg .= "Please provide: CIDR
\n"; }
//if (strlen($sip_force_contact) == 0) { $msg .= "Please provide: SIP Force Contact
\n"; }
+ //if (strlen($dial_string) == 0) { $msg .= "Please provide: Dial String
\n"; }
if (strlen($enabled) == 0) { $msg .= "Please provide: Enabled
\n"; }
//if (strlen($description) == 0) { $msg .= "Please provide: Description
\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
@@ -281,6 +283,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "mwi_account, ";
}
$sql .= "sip_bypass_media, ";
+ $sql .= "dial_string, ";
$sql .= "enabled, ";
$sql .= "description ";
$sql .= ")";
@@ -335,6 +338,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "'$mwi_account', ";
}
$sql .= "'$sip_bypass_media', ";
+ $sql .= "'$dial_string', ";
$sql .= "'$enabled', ";
$sql .= "'$description' ";
$sql .= ")";
@@ -464,6 +468,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
}
$sql .= "mwi_account = '$mwi_account', ";
$sql .= "sip_bypass_media = '$sip_bypass_media', ";
+ $sql .= "dial_string = '$dial_string', ";
$sql .= "enabled = '$enabled', ";
$sql .= "description = '$description' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
@@ -546,6 +551,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$nibble_account = $row["nibble_account"];
$mwi_account = $row["mwi_account"];
$sip_bypass_media = $row["sip_bypass_media"];
+ $dial_string = $row["dial_string"];
$enabled = $row["enabled"];
$description = $row["description"];
break; //limit to 1 row
@@ -795,7 +801,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "\n";
echo "
\n";
- echo "| \n";
+ echo " | \n";
echo " Emergency Caller ID Number:\n";
echo " | \n";
echo "\n";
@@ -1253,6 +1259,17 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " | \n";
echo "
\n";
+ echo "\n";
+ echo "| \n";
+ echo " Dial String:\n";
+ echo " | \n";
+ echo "\n";
+ echo " \n";
+ echo " \n";
+ echo "Location of the endpoint.\n";
+ echo " | \n";
+ echo "
\n";
+
echo " \n";
echo " ";
diff --git a/includes/classes/switch_directory.php b/includes/classes/switch_directory.php
index 2ab3fc1740..4d3b9723fa 100644
--- a/includes/classes/switch_directory.php
+++ b/includes/classes/switch_directory.php
@@ -415,7 +415,7 @@ include "root.php";
/*if (!$extension_xml_condensed) { <--- what do I do with this??
$fout = fopen($_SESSION['switch']['extensions']['dir']."/v_".$extension.".xml","w");
- $tmp_xml .= "\n";
+ $xml .= "\n";
}*/
if (strlen($this->cidr)) {
$this->cidr = " cidr=\"" . $this->cidr . "\"";
@@ -423,85 +423,85 @@ include "root.php";
if (strlen($this->number_alias)) {
$this->number_alias = " number-alias=\"".$this->number_alias."\"";
}
- if($single) $tmp_xml = "\n";
- else $tmp_xml = "";
- $tmp_xml .= " extension."\"".$this->cidr."".$this->number_alias.">\n";
- $tmp_xml .= " \n";
- $tmp_xml .= " password . "\"/>\n";
- $tmp_xml .= " vm_enabled."\"/>\n";
+ if($single) $xml = "\n";
+ else $xml = "";
+ $xml .= " extension."\"".$this->cidr."".$this->number_alias.">\n";
+ $xml .= " \n";
+ $xml .= " password . "\"/>\n";
+ $xml .= " vm_enabled."\"/>\n";
if ($this->vm_enabled=="true"){
- $tmp_xml .= " vm_password . "\"/>\n";
+ $xml .= " vm_password . "\"/>\n";
if(strlen($this->vm_mailto)) {
- $tmp_xml .= " \n";
- $tmp_xml .= " vm_attach_file."\"/>\n";
- $tmp_xml .= " vm_keep_local_after_email."\"/>\n";
- $tmp_xml .= " vm_mailto . "\"/>\n";
+ $xml .= " \n";
+ $xml .= " vm_attach_file."\"/>\n";
+ $xml .= " vm_keep_local_after_email."\"/>\n";
+ $xml .= " vm_mailto . "\"/>\n";
}
}
if (strlen($this->mwi_account)) {
- $tmp_xml .= " mwi_account . "\"/>\n";
+ $xml .= " mwi_account . "\"/>\n";
}
if (strlen($this->auth_acl)) {
- $tmp_xml .= " auth_acl . "\"/>\n";
+ $xml .= " auth_acl . "\"/>\n";
}
- $tmp_xml .= " \n";
+ $xml .= " \n";
- $tmp_xml .= " \n";
+ $xml .= " \n";
if (strlen($this->hold_music)) {
- $tmp_xml .= " hold_music . "\"/>\n";
+ $xml .= " hold_music . "\"/>\n";
}
if (strlen($this->toll_allow)){
- $tmp_xml .= " toll_allow . "\"/>\n";
+ $xml .= " toll_allow . "\"/>\n";
}
if (strlen($this->accountcode)){
- $tmp_xml .= " accountcode . "\"/>\n";
+ $xml .= " accountcode . "\"/>\n";
}
- $tmp_xml .= " user_context . "\"/>\n";
+ $xml .= " user_context . "\"/>\n";
if (strlen($this->effective_caller_id_name)) {
- $tmp_xml .= " effective_caller_id_name . "\"/>\n";
+ $xml .= " effective_caller_id_name . "\"/>\n";
}
if (strlen($this->outbound_caller_id_number)) {
- $tmp_xml .= " effective_caller_id_number . "\"/>\n";
+ $xml .= " effective_caller_id_number . "\"/>\n";
}
if (strlen($this->outbound_caller_id_name)) {
- $tmp_xml .= " outbound_caller_id_name . "\"/>\n";
+ $xml .= " outbound_caller_id_name . "\"/>\n";
}
if (strlen($this->outbound_caller_id_number)) {
- $tmp_xml .= " outbound_caller_id_number . "\"/>\n";
+ $xml .= " outbound_caller_id_number . "\"/>\n";
}
if (!strlen($this->limit_max)) {//**validation
$this->limit_max=5;
}
- $tmp_xml .= " limit_max . "\"/>\n";
+ $xml .= " limit_max . "\"/>\n";
if (strlen($this->limit_destination)) {
- $tmp_xml .= " limit_destination . "\"/>\n";
+ $xml .= " limit_destination . "\"/>\n";
}
if (strlen($this->sip_force_contact)) {
- $tmp_xml .= " sip_force_contact . "\"/>\n";
+ $xml .= " sip_force_contact . "\"/>\n";
}
if (strlen($this->sip_force_expires)) {
- $tmp_xml .= " sip_force_expires . "\"/>\n";
+ $xml .= " sip_force_expires . "\"/>\n";
}
if (strlen($this->nibble_account)) {
- $tmp_xml .= " nibble_account . "\"/>\n";
+ $xml .= " nibble_account . "\"/>\n";
}
switch ($this->sip_bypass_media) {
case "bypass-media":
- $tmp_xml .= " \n";
+ $xml .= " \n";
break;
case "bypass-media-after-bridge":
- $tmp_xml .= " \n";
+ $xml .= " \n";
break;
case "proxy-media":
- $tmp_xml .= " \n";
+ $xml .= " \n";
break;
}
- $tmp_xml .= " \n";
- $tmp_xml .= " \n";
- if($single) { $tmp_xml .= "\n"; }
+ $xml .= " \n";
+ $xml .= " \n";
+ if($single) { $xml .= "\n"; }
- return $tmp_xml;
+ return $xml;
}
function xml_save_all() {
@@ -536,8 +536,7 @@ include "root.php";
closedir($dh);
}
- $sql = "";
- $sql .= "select * from v_extensions ";
+ $sql = "select * from v_extensions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "order by call_group asc ";
$prep_statement = $db->prepare(check_sql($sql));
@@ -546,7 +545,7 @@ include "root.php";
$extension_xml_condensed = false;
if ($extension_xml_condensed) {
$fout = fopen($_SESSION['switch']['extensions']['dir']."/v_extensions.xml","w");
- $tmp_xml = "\n";
+ $xml = "\n";
}
while($row = $prep_statement->fetch(PDO::FETCH_ASSOC)) {
$call_group = $row['call_group'];
@@ -567,105 +566,105 @@ include "root.php";
if ($row['enabled'] != "false") {
//$this->import_sql($row);//Do I need to be worried about ghost values? Maybe I should make a new object?
//if (strlen($switch_account_code)) $this->accountcode=$switch_account_code;
- //$tmp_xml.=$this->generate_xml(1);
+ //$xml.=$this->generate_xml(1);
$one_row=new fs_directory;
$one_row->import_sql($row);//make a new object to flush ghost rows. And we can call this as static.
if (strlen($switch_account_code)) $one_row->accountcode=$switch_account_code;
- $tmp_xml.=$one_row->generate_xml(false);
+ $xml.=$one_row->generate_xml(false);
if (!$extension_xml_condensed) {
- $tmp_xml .= "\n";
- fwrite($fout, $tmp_xml);
- unset($tmp_xml);
+ $xml .= "\n";
+ fwrite($fout, $xml);
+ unset($xml);
fclose($fout);
}
}
}
unset ($prep_statement);
if ($extension_xml_condensed) {
- $tmp_xml .= "\n";
- fwrite($fout, $tmp_xml);
- unset($tmp_xml);
+ $xml .= "\n";
+ fwrite($fout, $xml);
+ unset($xml);
fclose($fout);
}
//define the group members
- $tmp_xml = "\n";
- $tmp_xml .= "\n";
- $tmp_xml .= "\n";
- $tmp_xml .= " \n";
+ $xml = "\n";
+ $xml .= "\n";
+ $xml .= "\n";
+ $xml .= " \n";
if ($extension_dir_name == "default") {
- $tmp_xml .= " \n";
+ $xml .= " \n";
}
else {
- $tmp_xml .= " \n";
+ $xml .= " \n";
}
- $tmp_xml .= " \n";
- $tmp_xml .= " \n";
- $tmp_xml .= " \n";
- $tmp_xml .= "\n";
- $tmp_xml .= " \n";
- $tmp_xml .= " \n";
- $tmp_xml .= " \n";
- $tmp_xml .= " \n";
- $tmp_xml .= " \n";
- $tmp_xml .= " \n";
- $tmp_xml .= " \n";
- $tmp_xml .= "\n";
- $tmp_xml .= " \n";
- $tmp_xml .= " \n";
- $tmp_xml .= " \n";
- $tmp_xml .= " \n";
- $tmp_xml .= " \n";
- $tmp_xml .= " \n";
- $tmp_xml .= "\n";
+ $xml .= " \n";
+ //$xml .= " \n";
+ $xml .= " \n";
+ $xml .= "\n";
+ $xml .= " \n";
+ $xml .= " \n";
+ $xml .= " \n";
+ $xml .= " \n";
+ $xml .= " \n";
+ $xml .= " \n";
+ $xml .= " \n";
+ $xml .= "\n";
+ $xml .= " \n";
+ $xml .= " \n";
+ $xml .= " \n";
+ $xml .= " \n";
+ $xml .= " \n";
+ $xml .= " \n";
+ $xml .= "\n";
$previous_call_group = "";
foreach ($call_group_array as $key => $value) {
$call_group = $key;
$extension_list = $value;
if (strlen($call_group) > 0) {
if ($previous_call_group != $call_group) {
- $tmp_xml .= " \n";
- $tmp_xml .= " \n";
- $tmp_xml .= " \n";
+ $xml .= " \n";
+ $xml .= " \n";
+ $xml .= " \n";
$extension_array = explode(",", $extension_list);
foreach ($extension_array as &$tmp_extension) {
- $tmp_xml .= " \n";
+ $xml .= " \n";
}
- $tmp_xml .= " \n";
- $tmp_xml .= " \n";
- $tmp_xml .= "\n";
+ $xml .= " \n";
+ $xml .= " \n";
+ $xml .= "\n";
}
$previous_call_group = $call_group;
}
unset($call_group);
}
- $tmp_xml .= " \n";
- $tmp_xml .= "\n";
- $tmp_xml .= " \n";
- $tmp_xml .= "";
+ $xml .= " \n";
+ $xml .= "\n";
+ $xml .= " \n";
+ $xml .= "";
//remove invalid characters from the file names
$extension_dir_name = str_replace(" ", "_", $extension_dir_name);
@@ -673,8 +672,8 @@ include "root.php";
//write the xml file
$fout = fopen($extension_parent_dir."/".$extension_dir_name.".xml","w");
- fwrite($fout, $tmp_xml);
- unset($tmp_xml);
+ fwrite($fout, $xml);
+ unset($xml);
fclose($fout);
//syncrhonize the phone directory
diff --git a/includes/lib_switch.php b/includes/lib_switch.php
index b94c9ec54e..5e4ffdc030 100644
--- a/includes/lib_switch.php
+++ b/includes/lib_switch.php
@@ -1690,6 +1690,10 @@ function save_extension_xml() {
$extension = $row['extension'];
$extension = str_replace(" ", "_", $extension);
$extension = preg_replace("/[\*\:\\/\<\>\|\'\"\?]/", "", $extension);
+ $dial_string = $row['dial_string'];
+ if (strlen($dial_string) == 0) {
+ $dial_string = "{sip_invite_domain=\${domain_name},presence_id=\${dialed_user}@\${dialed_domain}}\${sofia_contact(\${dialed_user}@\${dialed_domain})}";
+ }
$tmp_xml .= "\n";
$cidr = '';
@@ -1748,6 +1752,7 @@ function save_extension_xml() {
if (strlen($row['directory_exten_visible']) > 0) {
$tmp_xml .= " \n";
}
+ $tmp_xml .= " \n";
$tmp_xml .= " \n";
$tmp_xml .= " \n";
if (strlen($row['call_group']) > 0) {
@@ -1866,7 +1871,7 @@ function save_extension_xml() {
$tmp_xml .= " \n";
}
$tmp_xml .= " \n";
- $tmp_xml .= " \n";
+ //$tmp_xml .= " \n";
$tmp_xml .= " \n";
$tmp_xml .= "\n";
$tmp_xml .= " \n";