Merge branch 'master' into fax_queue

This commit is contained in:
Alexey Melnichuk 2015-12-09 12:37:55 +03:00
commit 32685f7d98
8 changed files with 43 additions and 78 deletions

View File

@ -1,10 +1,9 @@
<context name="{v_context}">
<extension name="local_extension" number="[ext]" continue="false" app_uuid="71cf1310-b6e3-415b-8745-3cbdc8e15212">
<condition field="user_exists" expression="true"/>
<condition field="destination_number" expression="(^.*$|^\d{2,7}$)">
<!--<action application="pre_answer"/>-->
<action application="export" data="dialed_extension=$1" inline="true"/>
<action application="limit" data="hash ${domain_name} $1 ${limit_max} ${limit_destination}" inline="false" />
<action application="export" data="dialed_extension=${destination_number}" inline="true"/>
<action application="limit" data="hash ${domain_name} ${destination_number} ${limit_max} ${limit_destination}" inline="false" />
</condition>
<!--Allow transfer/record only for internal users-->

View File

@ -145,12 +145,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$dialplan_name = str_replace("/", "", $dialplan_name);
//set the context
if (count($_SESSION["domains"]) > 1) {
$context = 'default';
}
else {
$context = '$${domain_name}';
}
$context = '$${domain_name}';
//start the atomic transaction
$count = $db->exec("BEGIN;"); //returns affected rows

View File

@ -931,7 +931,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</table>";
echo "<br>";
echo "</div>\n";
}
echo "</form>";

View File

@ -213,7 +213,7 @@ function fax_split_dtmf(&$fax_number, &$fax_dtmf){
mkdir($_SESSION['switch']['storage']['dir'].'/fax');
chmod($_SESSION['switch']['storage']['dir'].'/fax',0774);
}
if (count($_SESSION["domains"]) > 1 && !is_dir($_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'])) {
if (!is_dir($_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'])) {
mkdir($_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name']);
chmod($_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'],0774);
}
@ -238,7 +238,6 @@ function fax_split_dtmf(&$fax_number, &$fax_dtmf){
//clear file status cache
clearstatcache();
//send the fax
$continue = false;

View File

@ -1,48 +1,48 @@
<?php
function parse_attachments($connection, $message_number, $option = '') {
$attachments = array();
$structure = imap_fetchstructure($connection, $message_number, $option);
$attachments = array();
$structure = imap_fetchstructure($connection, $message_number, $option);
if(isset($structure->parts) && count($structure->parts)) {
if(isset($structure->parts) && count($structure->parts)) {
for($i = 0; $i < count($structure->parts); $i++) {
for($i = 0; $i < count($structure->parts); $i++) {
if($structure->parts[$i]->ifdparameters) {
foreach($structure->parts[$i]->dparameters as $object) {
if(strtolower($object->attribute) == 'filename') {
$attachments[$i]['is_attachment'] = true;
$attachments[$i]['filename'] = $object->value;
}
}
}
if($structure->parts[$i]->ifdparameters) {
foreach($structure->parts[$i]->dparameters as $object) {
if(strtolower($object->attribute) == 'filename') {
$attachments[$i]['is_attachment'] = true;
$attachments[$i]['filename'] = $object->value;
}
}
}
if($structure->parts[$i]->ifparameters) {
foreach($structure->parts[$i]->parameters as $object) {
if(strtolower($object->attribute) == 'name') {
$attachments[$i]['is_attachment'] = true;
$attachments[$i]['name'] = $object->value;
}
}
}
if($structure->parts[$i]->ifparameters) {
foreach($structure->parts[$i]->parameters as $object) {
if(strtolower($object->attribute) == 'name') {
$attachments[$i]['is_attachment'] = true;
$attachments[$i]['name'] = $object->value;
}
}
}
if($attachments[$i]['is_attachment']) {
$attachments[$i]['attachment'] = imap_fetchbody($connection, $message_number, $i+1, $option);
if($structure->parts[$i]->encoding == 3) { // 3 = BASE64
$attachments[$i]['attachment'] = base64_decode($attachments[$i]['attachment']);
$attachments[$i]['size'] = strlen($attachments[$i]['attachment']);
}
elseif($structure->parts[$i]->encoding == 4) { // 4 = QUOTED-PRINTABLE
$attachments[$i]['attachment'] = quoted_printable_decode($attachments[$i]['attachment']);
$attachments[$i]['size'] = strlen($attachments[$i]['attachment']);
}
}
if($attachments[$i]['is_attachment']) {
$attachments[$i]['attachment'] = imap_fetchbody($connection, $message_number, $i+1, $option);
if($structure->parts[$i]->encoding == 3) { // 3 = BASE64
$attachments[$i]['attachment'] = base64_decode($attachments[$i]['attachment']);
$attachments[$i]['size'] = strlen($attachments[$i]['attachment']);
}
elseif($structure->parts[$i]->encoding == 4) { // 4 = QUOTED-PRINTABLE
$attachments[$i]['attachment'] = quoted_printable_decode($attachments[$i]['attachment']);
$attachments[$i]['size'] = strlen($attachments[$i]['attachment']);
}
}
unset($attachments[$i]['is_attachment']);
}
}
}
return array_values($attachments); //reindex
}
return array_values($attachments); //reindex
}
?>

View File

@ -575,23 +575,6 @@ include "root.php";
$database->fields['dialplan_detail_order'] = '030';
$database->add();
/*
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'ivr';
if (count($_SESSION["domains"]) > 1) {
$database->fields['dialplan_detail_data'] = $_SESSION['domain_name'].'-'.$this->ivr_menu_name;
}
else {
$database->fields['dialplan_detail_data'] = $this->ivr_menu_name;
}
$database->fields['dialplan_detail_order'] = '035';
$database->add();
*/
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;

View File

@ -234,7 +234,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
// rename switch/recordings/[domain] (folder)
if ( isset($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']) ) {
if ( file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']) ) {
$switch_recordings_dir = str_replace("/".$_SESSION["domain_name"], "", $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']);
if ( file_exists($switch_recordings_dir."/".$original_domain_name) ) {
@rename($switch_recordings_dir."/".$original_domain_name, $switch_recordings_dir."/".$domain_name); // folder

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2010
Copyright (C) 2010-2015
All Rights Reserved.
Contributor(s):
@ -89,6 +89,7 @@ include "root.php";
//add the fax
if (strlen($this->fax_extension) > 0) {
//add the dialplan
$database = new database;
$database->table = "v_dialplans";
@ -190,12 +191,7 @@ include "root.php";
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'rxfax';
if (count($_SESSION["domains"]) > 1) {
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domains'][$row['domain_uuid']]['domain_name'].'/'.$this->fax_extension.'/inbox/${last_fax}.tif';
}
else {
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$this->fax_extension.'/inbox/${last_fax}.tif';
}
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domains'][$this->domain_uuid]['domain_name'].'/'.$this->fax_extension.'/inbox/${last_fax}.tif';
$database->fields['dialplan_detail_data'] = $dialplan_detail_data;
$database->fields['dialplan_detail_order'] = '040';
$database->add();
@ -322,7 +318,6 @@ include "root.php";
$database->update();
}
else {
// $this->dialplan_uuid = uuid();
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->add();
@ -427,12 +422,7 @@ include "root.php";
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'rxfax';
if (count($_SESSION["domains"]) > 1) {
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domains'][$row['domain_uuid']]['domain_name'].'/'.$this->fax_extension.'/inbox/${last_fax}.tif';
}
else {
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$this->fax_extension.'/inbox/${last_fax}.tif';
}
$dialplan_detail_data = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domains'][$this->domain_uuid]['domain_name'].'/'.$this->fax_extension.'/inbox/${last_fax}.tif';
$database->fields['dialplan_detail_data'] = $dialplan_detail_data;
$database->fields['dialplan_detail_order'] = '040';
$database->add();