2012-06-04 16:58:40 +02:00
< ? php
/*
FusionPBX
Version : MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 ( the " License " ); you may not use this file except in compliance with
the License . You may obtain a copy of the License at
http :// www . mozilla . org / MPL /
Software distributed under the License is distributed on an " AS IS " basis ,
WITHOUT WARRANTY OF ANY KIND , either express or implied . See the License
for the specific language governing rights and limitations under the
License .
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane < markjcrane @ fusionpbx . com >
2015-04-05 05:12:46 +02:00
Portions created by the Initial Developer are Copyright ( C ) 2008 - 2015
2012-06-04 16:58:40 +02:00
the Initial Developer . All Rights Reserved .
Contributor ( s ) :
Mark J Crane < markjcrane @ fusionpbx . com >
2015-02-28 03:32:25 +01:00
Luis Daniel Lucio Quiroz < dlucio @ okay . com . mx >
2012-06-04 16:58:40 +02:00
*/
require_once " root.php " ;
2013-07-06 08:03:27 +02:00
require_once " resources/require.php " ;
2013-07-06 07:50:55 +02:00
require_once " resources/check_auth.php " ;
2012-06-04 16:58:40 +02:00
if ( permission_exists ( 'follow_me' ) || permission_exists ( 'call_forward' ) || permission_exists ( 'do_not_disturb' )) {
//access granted
}
else {
echo " access denied " ;
exit ;
}
2012-10-24 09:02:52 +02:00
//add multi-lingual support
2015-01-18 11:06:08 +01:00
$language = new text ;
$text = $language -> get ();
2012-06-04 16:58:40 +02:00
2012-09-29 23:53:24 +02:00
//define the destination_select function
function destination_select ( $select_name , $select_value , $select_default ) {
if ( strlen ( $select_value ) == 0 ) { $select_value = $select_default ; }
2014-02-26 05:58:16 +01:00
echo " <select class='formfld' style='width: 55px;' name=' $select_name '> \n " ;
2012-11-21 06:59:07 +01:00
$i = 0 ;
while ( $i <= 100 ) {
2012-09-29 23:53:24 +02:00
if ( $select_value == $i ) {
echo " <option value=' $i ' selected='selected'> $i </option> \n " ;
}
else {
echo " <option value=' $i '> $i </option> \n " ;
}
2012-11-21 06:59:07 +01:00
$i = $i + 5 ;
2012-06-04 16:58:40 +02:00
}
2012-09-29 23:53:24 +02:00
echo " </select> \n " ;
2012-06-04 16:58:40 +02:00
}
//get the extension_uuid
2012-10-09 00:04:57 +02:00
$extension_uuid = check_str ( $_REQUEST [ " id " ]);
2012-06-04 16:58:40 +02:00
//get the extension number
2012-09-29 17:58:06 +02:00
$sql = " select * from v_extensions " ;
2012-06-04 16:58:40 +02:00
$sql .= " where domain_uuid = ' $domain_uuid ' " ;
$sql .= " and extension_uuid = ' $extension_uuid ' " ;
2015-09-07 10:47:57 +02:00
if ( ! ( permission_exists ( 'follow_me' ) || permission_exists ( 'call_forward' ) || permission_exists ( 'do_not_disturb' ))) {
2012-06-04 16:58:40 +02:00
if ( count ( $_SESSION [ 'user' ][ 'extension' ]) > 0 ) {
$sql .= " and ( " ;
$x = 0 ;
foreach ( $_SESSION [ 'user' ][ 'extension' ] as $row ) {
if ( $x > 0 ) { $sql .= " or " ; }
$sql .= " extension = ' " . $row [ 'user' ] . " ' " ;
$x ++ ;
}
$sql .= " ) " ;
}
else {
//hide any results when a user has not been assigned an extension
$sql .= " and extension = 'disabled' " ;
}
}
$sql .= " and enabled = 'true' " ;
$prep_statement = $db -> prepare ( check_sql ( $sql ));
$prep_statement -> execute ();
$result = $prep_statement -> fetchAll ( PDO :: FETCH_NAMED );
if ( count ( $result ) == 0 ) {
echo " access denied " ;
exit ;
}
else {
foreach ( $result as & $row ) {
$extension = $row [ " extension " ];
2013-05-01 19:05:53 +02:00
$accountcode = $row [ " accountcode " ];
2012-06-04 16:58:40 +02:00
$effective_caller_id_name = $row [ " effective_caller_id_name " ];
$effective_caller_id_number = $row [ " effective_caller_id_number " ];
$outbound_caller_id_name = $row [ " outbound_caller_id_name " ];
$outbound_caller_id_number = $row [ " outbound_caller_id_number " ];
2012-09-29 17:58:06 +02:00
$do_not_disturb = $row [ " do_not_disturb " ];
2012-12-16 08:39:03 +01:00
$forward_all_destination = $row [ " forward_all_destination " ];
$forward_all_enabled = $row [ " forward_all_enabled " ];
$forward_busy_destination = $row [ " forward_busy_destination " ];
$forward_busy_enabled = $row [ " forward_busy_enabled " ];
2014-12-03 06:55:01 +01:00
$forward_no_answer_destination = $row [ " forward_no_answer_destination " ];
$forward_no_answer_enabled = $row [ " forward_no_answer_enabled " ];
2012-11-21 06:59:07 +01:00
$follow_me_uuid = $row [ " follow_me_uuid " ];
2015-02-28 05:07:15 +01:00
$forward_caller_id_uuid = $row [ " forward_caller_id_uuid " ];
2012-06-04 16:58:40 +02:00
break ; //limit to 1 row
}
2012-09-29 17:58:06 +02:00
if ( strlen ( $do_not_disturb ) == 0 ) {
$do_not_disturb = " false " ;
}
2012-06-04 16:58:40 +02:00
}
unset ( $prep_statement );
if ( count ( $_POST ) > 0 && strlen ( $_POST [ " persistformvar " ]) == 0 ) {
//get http post variables and set them to php variables
if ( count ( $_POST ) > 0 ) {
2012-12-16 08:39:03 +01:00
$forward_all_enabled = check_str ( $_POST [ " forward_all_enabled " ]);
$forward_all_destination = check_str ( $_POST [ " forward_all_destination " ]);
2014-10-29 17:06:53 +01:00
$forward_busy_enabled = check_str ( $_POST [ " forward_busy_enabled " ]);
$forward_busy_destination = check_str ( $_POST [ " forward_busy_destination " ]);
2014-12-03 06:55:01 +01:00
$forward_no_answer_enabled = check_str ( $_POST [ " forward_no_answer_enabled " ]);
$forward_no_answer_destination = check_str ( $_POST [ " forward_no_answer_destination " ]);
2015-02-28 05:07:15 +01:00
$forward_caller_id_uuid = check_str ( $_POST [ " forward_caller_id_uuid " ]);
2013-05-01 19:05:53 +02:00
$cid_name_prefix = check_str ( $_POST [ " cid_name_prefix " ]);
2013-07-06 06:48:23 +02:00
$cid_number_prefix = check_str ( $_POST [ " cid_number_prefix " ]);
2012-06-04 16:58:40 +02:00
$follow_me_enabled = check_str ( $_POST [ " follow_me_enabled " ]);
2015-02-28 03:32:25 +01:00
$follow_me_caller_id_uuid = check_str ( $_POST [ " follow_me_caller_id_uuid " ]);
2015-07-30 14:21:50 +02:00
$follow_me_ignore_busy = check_str ( $_POST [ " follow_me_ignore_busy " ]);
2012-11-21 06:59:07 +01:00
2012-06-04 16:58:40 +02:00
$destination_data_1 = check_str ( $_POST [ " destination_data_1 " ]);
2012-11-21 06:59:07 +01:00
$destination_delay_1 = check_str ( $_POST [ " destination_delay_1 " ]);
2014-08-14 08:06:20 +02:00
$destination_prompt_1 = check_str ( $_POST [ " destination_prompt_1 " ]);
2012-06-04 16:58:40 +02:00
$destination_timeout_1 = check_str ( $_POST [ " destination_timeout_1 " ]);
2012-11-21 06:59:07 +01:00
2012-06-04 16:58:40 +02:00
$destination_data_2 = check_str ( $_POST [ " destination_data_2 " ]);
2012-11-21 06:59:07 +01:00
$destination_delay_2 = check_str ( $_POST [ " destination_delay_2 " ]);
2014-08-14 08:06:20 +02:00
$destination_prompt_2 = check_str ( $_POST [ " destination_prompt_2 " ]);
2012-06-04 16:58:40 +02:00
$destination_timeout_2 = check_str ( $_POST [ " destination_timeout_2 " ]);
2012-11-21 06:59:07 +01:00
2012-06-04 16:58:40 +02:00
$destination_data_3 = check_str ( $_POST [ " destination_data_3 " ]);
2012-11-21 06:59:07 +01:00
$destination_delay_3 = check_str ( $_POST [ " destination_delay_3 " ]);
2014-08-14 08:06:20 +02:00
$destination_prompt_3 = check_str ( $_POST [ " destination_prompt_3 " ]);
2012-06-04 16:58:40 +02:00
$destination_timeout_3 = check_str ( $_POST [ " destination_timeout_3 " ]);
2012-11-21 06:59:07 +01:00
2012-06-04 16:58:40 +02:00
$destination_data_4 = check_str ( $_POST [ " destination_data_4 " ]);
2012-11-21 06:59:07 +01:00
$destination_delay_4 = check_str ( $_POST [ " destination_delay_4 " ]);
2014-08-14 08:06:20 +02:00
$destination_prompt_4 = check_str ( $_POST [ " destination_prompt_4 " ]);
2012-06-04 16:58:40 +02:00
$destination_timeout_4 = check_str ( $_POST [ " destination_timeout_4 " ]);
2012-11-21 06:59:07 +01:00
2012-06-04 16:58:40 +02:00
$destination_data_5 = check_str ( $_POST [ " destination_data_5 " ]);
2012-11-21 06:59:07 +01:00
$destination_delay_5 = check_str ( $_POST [ " destination_delay_5 " ]);
2014-08-14 08:06:20 +02:00
$destination_prompt_5 = check_str ( $_POST [ " destination_prompt_5 " ]);
2012-06-04 16:58:40 +02:00
$destination_timeout_5 = check_str ( $_POST [ " destination_timeout_5 " ]);
2012-11-21 06:59:07 +01:00
$dnd_enabled = check_str ( $_POST [ " dnd_enabled " ]);
2012-06-04 16:58:40 +02:00
2012-12-16 08:39:03 +01:00
if ( strlen ( $forward_all_destination ) > 0 ) {
2014-03-28 11:12:08 +01:00
// $forward_all_destination = preg_replace("~[^0-9]~", "",$forward_all_destination);
2012-06-04 16:58:40 +02:00
}
2014-10-29 17:06:53 +01:00
if ( strlen ( $forward_busy_destination ) > 0 ) {
// $forward_busy_destination = preg_replace("~[^0-9*]~", "",$forward_busy_destination);
}
2014-12-03 06:55:01 +01:00
if ( strlen ( $forward_no_answer_destination ) > 0 ) {
// $forward_no_answer_destination = preg_replace("~[^0-9*]~", "",$forward_no_answer_destination);
2014-11-29 19:14:23 +01:00
}
2012-06-04 16:58:40 +02:00
if ( strlen ( $destination_data_1 ) > 0 ) {
2014-03-28 11:12:08 +01:00
// $destination_data_1 = preg_replace("~[^0-9]~", "",$destination_data_1);
2012-06-04 16:58:40 +02:00
}
if ( strlen ( $destination_data_2 ) > 0 ) {
2014-03-28 11:12:08 +01:00
// $destination_data_2 = preg_replace("~[^0-9]~", "",$destination_data_2);
2012-06-04 16:58:40 +02:00
}
if ( strlen ( $destination_data_3 ) > 0 ) {
2014-03-28 11:12:08 +01:00
// $destination_data_3 = preg_replace("~[^0-9]~", "",$destination_data_3);
2012-06-04 16:58:40 +02:00
}
if ( strlen ( $destination_data_4 ) > 0 ) {
2014-03-28 11:12:08 +01:00
// $destination_data_4 = preg_replace("~[^0-9]~", "",$destination_data_4);
2012-06-04 16:58:40 +02:00
}
if ( strlen ( $destination_data_5 ) > 0 ) {
2014-03-28 11:12:08 +01:00
// $destination_data_5 = preg_replace("~[^0-9]~", "",$destination_data_5);
2012-06-04 16:58:40 +02:00
}
}
//check for all required data
2012-12-16 08:39:03 +01:00
//if (strlen($forward_all_enabled) == 0) { $msg .= "Please provide: Call Forward<br>\n"; }
2014-11-29 19:14:23 +01:00
//if (strlen($forward_all_destination) == 0) { $msg .= "Please provide: Forward Number<br>\n"; }
//if (strlen($forward_busy_enabled) == 0) { $msg .= "Please provide: On Busy<br>\n"; }
//if (strlen($forward_busy_destination) == 0) { $msg .= "Please provide: Busy Number<br>\n"; }
2014-12-03 06:55:01 +01:00
//if (strlen($forward_no_answer_enabled) == 0) { $msg .= "Please provide: no_answer<br>\n"; }
//if (strlen($forward_no_answer_destination) == 0) { $msg .= "Please provide: no_answer Number<br>\n"; }
2012-06-04 16:58:40 +02:00
//if (strlen($follow_me_enabled) == 0) { $msg .= "Please provide: Follow Me<br>\n"; }
//if (strlen($destination_data_1) == 0) { $msg .= "Please provide: 1st Number<br>\n"; }
//if (strlen($destination_timeout_1) == 0) { $msg .= "Please provide: sec<br>\n"; }
//if (strlen($destination_data_2) == 0) { $msg .= "Please provide: 2nd Number<br>\n"; }
//if (strlen($destination_timeout_2) == 0) { $msg .= "Please provide: sec<br>\n"; }
//if (strlen($destination_data_3) == 0) { $msg .= "Please provide: 3rd Number<br>\n"; }
//if (strlen($destination_timeout_3) == 0) { $msg .= "Please provide: sec<br>\n"; }
//if (strlen($destination_data_4) == 0) { $msg .= "Please provide: 4th Number<br>\n"; }
//if (strlen($destination_timeout_4) == 0) { $msg .= "Please provide: sec<br>\n"; }
//if (strlen($destination_data_5) == 0) { $msg .= "Please provide: 5th Number<br>\n"; }
//if (strlen($destination_timeout_5) == 0) { $msg .= "Please provide: sec<br>\n"; }
//if (strlen($destination_data_6) == 0) { $msg .= "Please provide: 6th Number<br>\n"; }
//if (strlen($destination_timeout_6) == 0) { $msg .= "Please provide: sec<br>\n"; }
//if (strlen($destination_data_7) == 0) { $msg .= "Please provide: 7th Number<br>\n"; }
//if (strlen($destination_timeout_7) == 0) { $msg .= "Please provide: sec<br>\n"; }
if ( strlen ( $msg ) > 0 && strlen ( $_POST [ " persistformvar " ]) == 0 ) {
2013-07-06 08:29:50 +02:00
require_once " resources/header.php " ;
2013-07-06 08:21:12 +02:00
require_once " resources/persist_form_var.php " ;
2012-06-04 16:58:40 +02:00
echo " <div align='center'> \n " ;
echo " <table><tr><td> \n " ;
echo $msg . " <br /> " ;
echo " </td></tr></table> \n " ;
persistformvar ( $_POST );
echo " </div> \n " ;
2013-07-06 08:29:50 +02:00
require_once " resources/footer.php " ;
2012-06-04 16:58:40 +02:00
return ;
}
//set the default action to add
$call_forward_action = " add " ;
2012-11-21 06:59:07 +01:00
//determine if this is an add or an update
if ( strlen ( $follow_me_uuid ) == 0 ) {
$follow_me_action = " add " ;
}
else {
$follow_me_action = " update " ;
2012-06-04 16:58:40 +02:00
}
//include the classes
2013-07-09 01:30:45 +02:00
include " resources/classes/call_forward.php " ;
include " resources/classes/follow_me.php " ;
include " resources/classes/do_not_disturb.php " ;
2012-06-04 16:58:40 +02:00
//call forward config
if ( permission_exists ( 'call_forward' )) {
$call_forward = new call_forward ;
$call_forward -> domain_uuid = $_SESSION [ 'domain_uuid' ];
2012-12-17 22:30:49 +01:00
$call_forward -> domain_name = $_SESSION [ 'domain_name' ];
2012-12-16 08:39:03 +01:00
$call_forward -> extension_uuid = $extension_uuid ;
2013-05-01 19:05:53 +02:00
$call_forward -> accountcode = $accountcode ;
2012-12-16 08:39:03 +01:00
$call_forward -> forward_all_destination = $forward_all_destination ;
$call_forward -> forward_all_enabled = $forward_all_enabled ;
2015-02-28 05:07:15 +01:00
$call_forward -> forward_caller_id_uuid = $forward_caller_id_uuid ;
2013-01-15 22:55:10 +01:00
//$call_forward->set();
//unset($call_forward);
}
//do not disturb (dnd) config
if ( permission_exists ( 'do_not_disturb' )) {
$dnd = new do_not_disturb ;
$dnd -> domain_uuid = $_SESSION [ 'domain_uuid' ];
$dnd -> domain_name = $_SESSION [ 'domain_name' ];
$dnd -> extension_uuid = $extension_uuid ;
$dnd -> enabled = $dnd_enabled ;
//$dnd->set();
//$dnd->user_status();
//unset($dnd);
}
//if follow me is enabled then process it last
if ( $follow_me_enabled == " true " ) {
//call forward
$call_forward -> set ();
unset ( $call_forward );
//dnd
$dnd -> set ();
$dnd -> user_status ();
unset ( $dnd );
2012-06-04 16:58:40 +02:00
}
//follow me config
if ( permission_exists ( 'follow_me' )) {
$follow_me = new follow_me ;
$follow_me -> domain_uuid = $_SESSION [ 'domain_uuid' ];
2012-12-17 22:30:49 +01:00
$follow_me -> domain_name = $_SESSION [ 'domain_name' ];
$follow_me -> extension_uuid = $extension_uuid ;
2012-06-04 16:58:40 +02:00
$follow_me -> db_type = $db_type ;
2013-05-01 19:05:53 +02:00
$follow_me -> cid_name_prefix = $cid_name_prefix ;
2013-07-06 06:48:23 +02:00
$follow_me -> cid_number_prefix = $cid_number_prefix ;
2012-06-04 16:58:40 +02:00
$follow_me -> follow_me_enabled = $follow_me_enabled ;
2015-02-28 03:32:25 +01:00
$follow_me -> follow_me_caller_id_uuid = $follow_me_caller_id_uuid ;
2015-07-30 14:21:50 +02:00
$follow_me -> follow_me_ignore_busy = $follow_me_ignore_busy ;
2012-06-04 16:58:40 +02:00
$follow_me -> destination_data_1 = $destination_data_1 ;
$follow_me -> destination_type_1 = $destination_type_1 ;
2012-11-21 06:59:07 +01:00
$follow_me -> destination_delay_1 = $destination_delay_1 ;
2014-08-14 08:06:20 +02:00
$follow_me -> destination_prompt_1 = $destination_prompt_1 ;
2012-06-04 16:58:40 +02:00
$follow_me -> destination_timeout_1 = $destination_timeout_1 ;
$follow_me -> destination_data_2 = $destination_data_2 ;
$follow_me -> destination_type_2 = $destination_type_2 ;
2012-11-21 06:59:07 +01:00
$follow_me -> destination_delay_2 = $destination_delay_2 ;
2014-08-14 08:06:20 +02:00
$follow_me -> destination_prompt_2 = $destination_prompt_2 ;
2012-06-04 16:58:40 +02:00
$follow_me -> destination_timeout_2 = $destination_timeout_2 ;
$follow_me -> destination_data_3 = $destination_data_3 ;
$follow_me -> destination_type_3 = $destination_type_3 ;
2012-11-21 06:59:07 +01:00
$follow_me -> destination_delay_3 = $destination_delay_3 ;
2014-08-14 08:06:20 +02:00
$follow_me -> destination_prompt_3 = $destination_prompt_3 ;
2012-06-04 16:58:40 +02:00
$follow_me -> destination_timeout_3 = $destination_timeout_3 ;
$follow_me -> destination_data_4 = $destination_data_4 ;
$follow_me -> destination_type_4 = $destination_type_4 ;
2012-11-21 06:59:07 +01:00
$follow_me -> destination_delay_4 = $destination_delay_4 ;
2014-08-14 08:06:20 +02:00
$follow_me -> destination_prompt_4 = $destination_prompt_4 ;
2012-06-04 16:58:40 +02:00
$follow_me -> destination_timeout_4 = $destination_timeout_4 ;
$follow_me -> destination_data_5 = $destination_data_5 ;
$follow_me -> destination_type_5 = $destination_type_5 ;
2012-11-21 06:59:07 +01:00
$follow_me -> destination_delay_5 = $destination_delay_5 ;
2014-08-14 08:06:20 +02:00
$follow_me -> destination_prompt_5 = $destination_prompt_5 ;
2012-06-04 16:58:40 +02:00
$follow_me -> destination_timeout_5 = $destination_timeout_5 ;
2015-05-20 04:46:06 +02:00
if ( $follow_me_action == " add " ) {
$follow_me_uuid = uuid ();
$sql = " update v_extensions set " ;
$sql .= " follow_me_uuid = ' $follow_me_uuid ' " ;
$sql .= " where domain_uuid = ' $domain_uuid ' " ;
$sql .= " and extension_uuid = ' $extension_uuid ' " ;
$db -> exec ( check_sql ( $sql ));
unset ( $sql );
$follow_me -> follow_me_uuid = $follow_me_uuid ;
$follow_me -> add ();
$follow_me -> set ();
2012-06-04 16:58:40 +02:00
}
if ( $follow_me_action == " update " ) {
$follow_me -> follow_me_uuid = $follow_me_uuid ;
2013-07-06 06:48:23 +02:00
$follow_me -> update ();
2013-01-15 22:55:10 +01:00
$follow_me -> set ();
2012-06-04 16:58:40 +02:00
}
unset ( $follow_me );
}
2013-01-15 22:55:10 +01:00
//if dnd or call forward are enabled process it last
if ( $follow_me_enabled != " true " ) {
if ( $forward_all_enabled == " true " ) {
//dnd
$dnd -> set ();
$dnd -> user_status ();
unset ( $dnd );
//call forward
$call_forward -> set ();
unset ( $call_forward );
}
else {
//call forward
$call_forward -> set ();
unset ( $call_forward );
//dnd
$dnd -> set ();
$dnd -> user_status ();
unset ( $dnd );
}
2012-06-04 16:58:40 +02:00
}
2013-01-17 07:14:31 +01:00
//synchronize configuration
2013-03-14 03:54:06 +01:00
if ( is_readable ( $_SESSION [ 'switch' ][ 'extensions' ][ 'dir' ])) {
require_once " app/extensions/resources/classes/extension.php " ;
$ext = new extension ;
$ext -> xml ();
unset ( $ext );
}
2013-01-17 07:14:31 +01:00
2014-12-03 06:55:01 +01:00
// Forward on busy and no_answer is stored in table and will be used by lua scripts
2014-10-29 17:06:53 +01:00
$sql = " update v_extensions set " ;
2014-11-29 19:14:23 +01:00
$sql .= " forward_busy_destination = ' " . $forward_busy_destination . " ', " ;
$sql .= " forward_busy_enabled = ' " . $forward_busy_enabled . " ', " ;
2014-12-03 06:55:01 +01:00
$sql .= " forward_no_answer_destination = ' " . $forward_no_answer_destination . " ', " ;
2015-02-28 05:07:15 +01:00
$sql .= " forward_no_answer_enabled = ' " . $forward_no_answer_enabled . " ', " ;
2015-03-18 15:36:12 +01:00
$sql .= " forward_caller_id_uuid = " . (( $forward_caller_id_uuid != '' ) ? " ' " . $forward_caller_id_uuid . " ' " : " null " );
2014-11-29 19:14:23 +01:00
$sql .= " where domain_uuid = ' " . $domain_uuid . " ' " ;
$sql .= " and extension_uuid = ' " . $extension_uuid . " ' " ;
2014-10-29 17:06:53 +01:00
$db -> exec ( check_sql ( $sql ));
unset ( $sql );
2014-10-30 06:19:03 +01:00
2015-01-16 01:21:02 +01:00
//clear the cache
$cache = new cache ;
2015-08-24 08:34:33 +02:00
$cache -> delete ( " directory: " . $extension . " @ " . $_SESSION [ 'domain_name' ]);
if ( strlen ( $number_alias ) > 0 ){
$cache -> delete ( " directory: " . $number_alias . " @ " . $_SESSION [ 'domain_name' ]);
}
2013-01-17 07:14:31 +01:00
2012-06-04 16:58:40 +02:00
//redirect the user
2014-02-21 03:03:22 +01:00
$_SESSION [ " message " ] = $text [ 'confirm-update' ];
2015-03-22 01:53:56 +01:00
header ( " Location: " . $_REQUEST [ 'return_url' ]);
2012-06-04 16:58:40 +02:00
return ;
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//show the header
2013-07-06 08:29:50 +02:00
require_once " resources/header.php " ;
2012-06-04 16:58:40 +02:00
//pre-populate the form
2015-04-05 05:12:46 +02:00
if ( $follow_me_uuid != '' ) {
$sql = " select * from v_follow_me " ;
$sql .= " where domain_uuid = ' $domain_uuid ' " ;
$sql .= " and follow_me_uuid = ' $follow_me_uuid ' " ;
$prep_statement = $db -> prepare ( check_sql ( $sql ));
$prep_statement -> execute ();
$result = $prep_statement -> fetchAll ( PDO :: FETCH_NAMED );
foreach ( $result as & $row ) {
$cid_name_prefix = $row [ " cid_name_prefix " ];
$cid_number_prefix = $row [ " cid_number_prefix " ];
$follow_me_enabled = $row [ " follow_me_enabled " ];
$follow_me_caller_id_uuid = $row [ " follow_me_caller_id_uuid " ];
2015-07-30 14:21:50 +02:00
$follow_me_ignore_busy = $row [ " follow_me_ignore_busy " ];
2015-04-05 05:12:46 +02:00
$sql = " select * from v_follow_me_destinations " ;
$sql .= " where follow_me_uuid = ' $follow_me_uuid ' " ;
$sql .= " order by follow_me_order asc " ;
$prep_statement_2 = $db -> prepare ( check_sql ( $sql ));
$prep_statement_2 -> execute ();
$result2 = $prep_statement_2 -> fetchAll ( PDO :: FETCH_NAMED );
$x = 1 ;
foreach ( $result2 as & $row2 ) {
if ( $x == 1 ) {
$destination_data_1 = $row2 [ " follow_me_destination " ];
$destination_delay_1 = $row2 [ " follow_me_delay " ];
$destination_prompt_1 = $row2 [ " follow_me_prompt " ];
$destination_timeout_1 = $row2 [ " follow_me_timeout " ];
}
if ( $x == 2 ) {
$destination_data_2 = $row2 [ " follow_me_destination " ];
$destination_delay_2 = $row2 [ " follow_me_delay " ];
$destination_prompt_2 = $row2 [ " follow_me_prompt " ];
$destination_timeout_2 = $row2 [ " follow_me_timeout " ];
}
if ( $x == 3 ) {
$destination_data_3 = $row2 [ " follow_me_destination " ];
$destination_delay_3 = $row2 [ " follow_me_delay " ];
$destination_prompt_3 = $row2 [ " follow_me_prompt " ];
$destination_timeout_3 = $row2 [ " follow_me_timeout " ];
}
if ( $x == 4 ) {
$destination_data_4 = $row2 [ " follow_me_destination " ];
$destination_delay_4 = $row2 [ " follow_me_delay " ];
$destination_prompt_4 = $row2 [ " follow_me_prompt " ];
$destination_timeout_4 = $row2 [ " follow_me_timeout " ];
}
if ( $x == 5 ) {
$destination_data_5 = $row2 [ " follow_me_destination " ];
$destination_delay_5 = $row2 [ " follow_me_delay " ];
$destination_prompt_5 = $row2 [ " follow_me_prompt " ];
$destination_timeout_5 = $row2 [ " follow_me_timeout " ];
}
$x ++ ;
2012-11-21 06:59:07 +01:00
}
2015-04-05 05:12:46 +02:00
unset ( $prep_statement_2 );
2012-06-04 16:58:40 +02:00
}
2015-04-05 05:12:46 +02:00
unset ( $prep_statement );
2012-06-04 16:58:40 +02:00
}
2012-09-29 17:58:06 +02:00
//set the default
if ( ! isset ( $dnd_enabled )) {
//set the value from the database
$dnd_enabled = $do_not_disturb ;
}
2012-12-09 05:58:05 +01:00
//prepare the autocomplete
2013-06-09 06:45:18 +02:00
echo " <script src= \" " . PROJECT_PATH . " /resources/jquery/jquery-ui-1.9.2.min.js \" ></script> \n " ;
echo " <link rel= \" stylesheet \" href= \" " . PROJECT_PATH . " /resources/jquery/jquery-ui.css \" /> \n " ;
2012-12-09 05:58:05 +01:00
echo " <script type= \" text/javascript \" > \n " ;
echo " \$ (function() { \n " ;
echo " var extensions = [ \n " ;
$sql = " select * from v_extensions " ;
$sql .= " where domain_uuid = ' $domain_uuid ' " ;
$sql .= " order by extension, number_alias asc " ;
$prep_statement = $db -> prepare ( check_sql ( $sql ));
$prep_statement -> execute ();
$result = $prep_statement -> fetchAll ( PDO :: FETCH_NAMED );
foreach ( $result as & $row ) {
if ( strlen ( $number_alias ) == 0 ) {
echo " \" " . $row [ " extension " ] . " \" , \n " ;
}
else {
echo " \" " . $row [ " number_alias " ] . " \" , \n " ;
}
}
echo " ]; \n " ;
echo " \$ ( \" #destination_data_1 \" ).autocomplete( { \n " ;
echo " source: extensions \n " ;
echo " }); \n " ;
echo " \$ ( \" #destination_data_2 \" ).autocomplete( { \n " ;
echo " source: extensions \n " ;
echo " }); \n " ;
echo " \$ ( \" #destination_data_3 \" ).autocomplete( { \n " ;
echo " source: extensions \n " ;
echo " }); \n " ;
echo " \$ ( \" #destination_data_4 \" ).autocomplete( { \n " ;
echo " source: extensions \n " ;
echo " }); \n " ;
echo " \$ ( \" #destination_data_5 \" ).autocomplete( { \n " ;
echo " source: extensions \n " ;
echo " }); \n " ;
echo " }); \n " ;
echo " </script> \n " ;
2012-06-04 16:58:40 +02:00
//show the content
echo " <form method='post' name='frm' action=''> \n " ;
2015-03-22 01:53:56 +01:00
echo " <input type='hidden' name='return_url' value=' " . $_SERVER [ " HTTP_REFERER " ] . " '> \n " ;
2015-02-15 08:59:02 +01:00
echo " <table width='100%' border='0' cellpadding='0' cellspacing='0'> \n " ;
2012-06-04 16:58:40 +02:00
echo " <tr> \n " ;
2015-03-22 01:53:56 +01:00
echo " <td align='left' width='30%' nowrap='nowrap' valign='top'> \n " ;
2012-10-24 09:02:52 +02:00
echo " <b> " . $text [ 'title' ] . " </b> \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
2015-03-22 01:53:56 +01:00
echo " <td width='70%' align='right' valign='top'> \n " ;
echo " <input type='button' class='btn' name='' alt=' " . $text [ 'button-back' ] . " ' onclick= \" window.location=' " . $_SERVER [ " HTTP_REFERER " ] . " ' \" value=' " . $text [ 'button-back' ] . " '> \n " ;
2014-04-27 01:37:41 +02:00
echo " <input type='submit' name='submit' class='btn' value=' " . $text [ 'button-save' ] . " '> \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " </tr> \n " ;
echo " <tr> \n " ;
echo " <td align='left' colspan='2'> \n " ;
2012-12-17 22:30:49 +01:00
echo " " . $text [ 'description' ] . " $extension .<br /><br /> \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " </tr> \n " ;
echo " <tr> \n " ;
2012-11-21 06:59:07 +01:00
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2014-11-29 19:14:23 +01:00
echo " <strong> " . $text [ 'label-call-forward' ] . " </strong> \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2014-11-29 19:14:23 +01:00
$on_click = " document.getElementById('follow_me_disabled').checked=true; " ;
2012-06-04 16:58:40 +02:00
$on_click .= " document.getElementById('dnd_disabled').checked=true; " ;
2014-10-30 06:39:04 +01:00
$on_click .= " document.getElementById('forward_all_destination').focus(); " ;
2014-11-29 19:14:23 +01:00
echo " <label for='forward_all_disabled'><input type='radio' name='forward_all_enabled' id='forward_all_disabled' onclick= \" \" value='false' " . (( $forward_all_enabled == " false " || $forward_all_enabled == " " ) ? " checked='checked' " : null ) . " /> " . $text [ 'label-disabled' ] . " </label> \n " ;
echo " <label for='forward_all_enabled'><input type='radio' name='forward_all_enabled' id='forward_all_enabled' onclick= \" $on_click\ " value = 'true' " .(( $forward_all_enabled == " true " ) ? " checked = 'checked' " : null). " /> " . $text['label-enabled'] . " </ label > \n " ;
2012-06-04 16:58:40 +02:00
unset ( $on_click );
2014-10-30 06:39:04 +01:00
echo " " ;
echo " <input class='formfld' type='text' name='forward_all_destination' id='forward_all_destination' maxlength='255' placeholder= \" " . $text [ 'label-destination' ] . " \" value= \" " . $forward_all_destination . " \" > \n " ;
2015-02-28 19:14:48 +01:00
if ( permission_exists ( 'follow_me_cid_set' )) {
echo " " ;
2015-10-23 13:40:29 +02:00
$sql_forward = " select destination_uuid, destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = ' $domain_uuid ' and destination_type = 'inbound' order by destination_number asc " ;
2015-02-28 19:14:48 +01:00
$prep_statement_forward = $db -> prepare ( check_sql ( $sql_forward ));
$prep_statement_forward -> execute ();
$result_forward = $prep_statement_forward -> fetchAll ( PDO :: FETCH_ASSOC );
if ( count ( $result_forward ) > 0 ) {
2015-03-18 09:17:57 +01:00
echo " <select name='forward_caller_id_uuid' id='forward_caller_id_uuid' class='formfld' > \n " ;
2015-03-18 15:36:12 +01:00
echo " <option value=''> " . $text [ 'label-select-cid-number' ] . " </option> \n " ;
echo " <option value='' disabled='disabled'></option> \n " ;
2015-02-28 19:14:48 +01:00
foreach ( $result_forward as & $row_forward ) {
2015-03-18 09:17:57 +01:00
$selected = $row_forward [ " destination_uuid " ] == $forward_caller_id_uuid ? " selected='selected' " : '' ;
2015-10-23 13:40:29 +02:00
$caller_id_number = $row_forward [ 'destination_caller_id_number' ];
if ( strlen ( $caller_id_number ) == 0 ){
$caller_id_number = $row_forward [ 'destination_number' ];
}
$caller_id_name = $row_forward [ 'destination_caller_id_name' ];
if ( strlen ( $caller_id_name ) == 0 ){
$caller_id_name = $row_forward [ 'destination_description' ];
}
echo " <option value=' " . $row_forward [ " destination_uuid " ] . " ' " . $selected . " > " . format_phone ( $caller_id_number ) . " : " . $caller_id_name . " </option> \n " ;
2015-02-28 05:07:15 +01:00
}
2015-03-18 09:17:57 +01:00
echo " </select> \n " ;
2015-02-28 05:07:15 +01:00
}
2015-02-28 19:14:48 +01:00
unset ( $sql_forward , $prep_statement_forward , $result_forward , $row_forward );
2015-02-28 05:07:15 +01:00
}
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " </tr> \n " ;
2014-10-29 17:06:53 +01:00
echo " <tr> \n " ;
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2014-11-29 19:14:23 +01:00
echo " " . $text [ 'label-on-busy' ] . " \n " ;
2014-10-29 17:06:53 +01:00
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2014-11-29 19:14:23 +01:00
$on_click = " document.getElementById('dnd_disabled').checked=true; " ;
2014-10-30 06:39:04 +01:00
$on_click .= " document.getElementById('forward_busy_destination').focus(); " ;
2014-11-29 19:14:23 +01:00
echo " <label for='forward_busy_disabled'><input type='radio' name='forward_busy_enabled' id='forward_busy_disabled' onclick= \" \" value='false' " . (( $forward_busy_enabled == " false " || $forward_busy_enabled == " " ) ? " checked='checked' " : null ) . " /> " . $text [ 'label-disabled' ] . " </label> \n " ;
echo " <label for='forward_busy_enabled'><input type='radio' name='forward_busy_enabled' id='forward_busy_enabled' onclick= \" $on_click\ " value = 'true' " .(( $forward_busy_enabled == " true " ) ? " checked = 'checked' " : null). " /> " . $text['label-enabled'] . " </ label > \n " ;
2014-10-29 17:06:53 +01:00
unset ( $on_click );
2014-10-30 06:39:04 +01:00
echo " " ;
echo " <input class='formfld' type='text' name='forward_busy_destination' id='forward_busy_destination' maxlength='255' placeholder= \" " . $text [ 'label-destination' ] . " \" value= \" " . $forward_busy_destination . " \" > \n " ;
2015-03-18 09:17:57 +01:00
echo " <br /> " . $text [ 'description-on-busy' ] . " . \n " ;
2014-10-29 17:06:53 +01:00
echo " </td> \n " ;
echo " </tr> \n " ;
2014-11-29 19:14:23 +01:00
echo " <tr> \n " ;
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2014-12-03 06:55:01 +01:00
echo " " . $text [ 'label-no_answer' ] . " \n " ;
2014-11-29 19:14:23 +01:00
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
$on_click = " document.getElementById('dnd_disabled').checked=true; " ;
2014-12-03 06:55:01 +01:00
$on_click .= " document.getElementById('forward_no_answer_destination').focus(); " ;
echo " <label for='forward_no_answer_disabled'><input type='radio' name='forward_no_answer_enabled' id='forward_no_answer_disabled' onclick= \" \" value='false' " . (( $forward_no_answer_enabled == " false " || $forward_no_answer_enabled == " " ) ? " checked='checked' " : null ) . " /> " . $text [ 'label-disabled' ] . " </label> \n " ;
echo " <label for='forward_no_answer_enabled'><input type='radio' name='forward_no_answer_enabled' id='forward_no_answer_enabled' onclick= \" $on_click\ " value = 'true' " .(( $forward_no_answer_enabled == " true " ) ? " checked = 'checked' " : null). " /> " . $text['label-enabled'] . " </ label > \n " ;
2014-11-29 19:14:23 +01:00
unset ( $on_click );
echo " " ;
2014-12-03 06:55:01 +01:00
echo " <input class='formfld' type='text' name='forward_no_answer_destination' id='forward_no_answer_destination' maxlength='255' placeholder= \" " . $text [ 'label-destination' ] . " \" value= \" " . $forward_no_answer_destination . " \" > \n " ;
2015-03-18 09:17:57 +01:00
echo " <br /> " . $text [ 'description-no_answer' ] . " . \n " ;
2014-11-29 19:14:23 +01:00
echo " </td> \n " ;
echo " </tr> \n " ;
2014-10-30 06:39:04 +01:00
echo " <tr><td colspan='2'><br /></td></tr> \n " ;
2014-10-29 17:06:53 +01:00
2012-06-04 16:58:40 +02:00
echo " <tr> \n " ;
2012-11-21 06:59:07 +01:00
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2014-11-29 19:14:23 +01:00
echo " <strong> " . $text [ 'label-follow-me' ] . " </strong> \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2014-11-29 19:14:23 +01:00
$on_click = " document.getElementById('forward_all_disabled').checked=true; " ;
2015-02-28 03:32:25 +01:00
$on_click .= " document.getElementById('dnd_disabled').checked=true; document.getElementById('follow_me_caller_id_uuid').focus(); " ;
2014-11-29 19:14:23 +01:00
echo " <label for='follow_me_disabled'><input type='radio' name='follow_me_enabled' id='follow_me_disabled' onclick= \" \" value='false' " . (( $follow_me_enabled == " false " || $follow_me_enabled == " " ) ? " checked='checked' " : null ) . " /> " . $text [ 'label-disabled' ] . " </label> \n " ;
echo " <label for='follow_me_enabled'><input type='radio' name='follow_me_enabled' id='follow_me_enabled' onclick= \" $on_click\ " value = 'true' " .(( $follow_me_enabled == " true " ) ? " checked = 'checked' " : null). " /> " . $text['label-enabled'] . " </ label > \n " ;
2012-06-04 16:58:40 +02:00
unset ( $on_click );
2015-02-28 19:14:48 +01:00
if ( permission_exists ( 'follow_me_cid_set' )) {
echo " " ;
2015-10-23 13:55:48 +02:00
$sql_follow_me = " select destination_uuid, destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = ' $domain_uuid ' and destination_type = 'inbound' order by destination_number asc " ;
2015-02-28 19:14:48 +01:00
$prep_statement_follow_me = $db -> prepare ( check_sql ( $sql_follow_me ));
$prep_statement_follow_me -> execute ();
$result_follow_me = $prep_statement_follow_me -> fetchAll ( PDO :: FETCH_ASSOC );
if ( count ( $result_follow_me ) > 0 ) {
2015-03-18 09:17:57 +01:00
echo " <select name='follow_me_caller_id_uuid' id='follow_me_caller_id_uuid' class='formfld' > \n " ;
2015-03-18 15:36:12 +01:00
echo " <option value=''> " . $text [ 'label-select-cid-number' ] . " </option> \n " ;
echo " <option value='' disabled='disabled'></option> \n " ;
2015-02-28 19:14:48 +01:00
foreach ( $result_follow_me as & $row_follow_me ) {
2015-03-18 09:17:57 +01:00
$selected = $row_follow_me [ " destination_uuid " ] == $follow_me_caller_id_uuid ? " selected='selected' " : '' ;
2015-10-23 13:55:48 +02:00
$caller_id_number = $row_follow_me [ 'destination_caller_id_number' ];
if ( strlen ( $caller_id_number ) == 0 ){
$caller_id_number = $row_follow_me [ 'destination_number' ];
}
$caller_id_name = $row_follow_me [ 'destination_caller_id_name' ];
if ( strlen ( $caller_id_name ) == 0 ){
$caller_id_name = $row_follow_me [ 'destination_description' ];
}
echo " <option value=' " . $row_follow_me [ " destination_uuid " ] . " ' " . $selected . " > " . format_phone ( $caller_id_number ) . " : " . $caller_id_name . " </option> \n " ;
2015-02-28 03:32:25 +01:00
}
2015-03-18 09:17:57 +01:00
echo " </select> \n " ;
2015-02-28 03:32:25 +01:00
}
2015-02-28 19:14:48 +01:00
unset ( $sql_follow_me , $prep_statement_follow_me , $result_follow_me , $row_follow_me );
2015-02-28 03:32:25 +01:00
}
2015-02-28 19:14:48 +01:00
2015-03-18 09:17:57 +01:00
echo " <br /><br /> \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " </tr> \n " ;
echo " <tr> \n " ;
2012-11-21 06:59:07 +01:00
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2014-11-29 19:14:23 +01:00
echo " " . $text [ 'label-destinations' ] . " \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2012-12-09 05:58:05 +01:00
2014-08-14 07:36:23 +02:00
echo " <table border='0' cellpadding='2' cellspacing='0'> \n " ;
echo " <tr> \n " ;
echo " <td class='vtable'> " . $text [ 'label-destination_number' ] . " </td> \n " ;
echo " <td class='vtable'> " . $text [ 'label-destination_delay' ] . " </td> \n " ;
echo " <td class='vtable'> " . $text [ 'label-destination_timeout' ] . " </td> \n " ;
if ( permission_exists ( 'follow_me_prompt' )) {
echo " <td class='vtable'> " . $text [ 'label-destination_prompt' ] . " </td> \n " ;
}
echo " </tr> \n " ;
// 1st destination
echo " <tr> \n " ;
2015-03-18 09:17:57 +01:00
echo " <td><input class='formfld' style='min-width: 135px;' type='text' name='destination_data_1' id='destination_data_1' maxlength='255' value= \" " . $destination_data_1 . " \" ></td> \n " ;
2014-08-14 07:36:23 +02:00
echo " <td> \n " ;
destination_select ( 'destination_delay_1' , $destination_delay_1 , '0' );
echo " </td> \n " ;
echo " <td> \n " ;
destination_select ( 'destination_timeout_1' , $destination_timeout_1 , '30' );
echo " </td> \n " ;
if ( permission_exists ( 'follow_me_prompt' )) {
echo " <td> \n " ;
2014-08-14 09:52:52 +02:00
echo " <select class='formfld' style='width: 90px;' name='destination_prompt_1'> \n " ;
2014-08-14 07:36:23 +02:00
echo " <option value=''></option> \n " ;
2014-08-14 09:44:05 +02:00
echo " <option value='1' " . (( $destination_prompt_1 ) ? " selected='selected' " : null ) . " > " . $text [ 'label-destination_prompt_confirm' ] . " </option> \n " ;
2014-08-14 07:36:23 +02:00
//echo " <option value='2'>".$text['label-destination_prompt_announce]."</option>\n";
echo " </select> \n " ;
echo " </td> \n " ;
}
echo " </tr> \n " ;
// 2nd destination
echo " <tr> \n " ;
2015-03-18 09:17:57 +01:00
echo " <td><input class='formfld' style='min-width: 135px;' type='text' name='destination_data_2' id='destination_data_2' maxlength='255' value= \" " . $destination_data_2 . " \" ></td> \n " ;
2014-08-14 07:36:23 +02:00
echo " <td> \n " ;
destination_select ( 'destination_delay_2' , $destination_delay_2 , '0' );
echo " </td> \n " ;
echo " <td> \n " ;
destination_select ( 'destination_timeout_2' , $destination_timeout_2 , '30' );
echo " </td> \n " ;
if ( permission_exists ( 'follow_me_prompt' )) {
echo " <td> \n " ;
2014-08-14 09:52:52 +02:00
echo " <select class='formfld' style='width: 90px;' name='destination_prompt_2'> \n " ;
2014-08-14 07:36:23 +02:00
echo " <option value=''></option> \n " ;
2014-08-14 09:44:05 +02:00
echo " <option value='1' " . (( $destination_prompt_2 ) ? " selected='selected' " : null ) . " > " . $text [ 'label-destination_prompt_confirm' ] . " </option> \n " ;
2014-08-14 07:36:23 +02:00
//echo " <option value='2'>".$text['label-destination_prompt_announce]."</option>\n";
echo " </select> \n " ;
echo " </td> \n " ;
}
echo " </tr> \n " ;
// 3rd destination
echo " <tr> \n " ;
2015-03-18 09:17:57 +01:00
echo " <td><input class='formfld' style='min-width: 135px;' type='text' name='destination_data_3' id='destination_data_3' maxlength='255' value= \" " . $destination_data_3 . " \" ></td> \n " ;
2014-08-14 07:36:23 +02:00
echo " <td> \n " ;
destination_select ( 'destination_delay_3' , $destination_delay_3 , '0' );
echo " </td> \n " ;
echo " <td> \n " ;
destination_select ( 'destination_timeout_3' , $destination_timeout_3 , '30' );
echo " </td> \n " ;
if ( permission_exists ( 'follow_me_prompt' )) {
echo " <td> \n " ;
2014-08-14 09:52:52 +02:00
echo " <select class='formfld' style='width: 90px;' name='destination_prompt_3'> \n " ;
2014-08-14 07:36:23 +02:00
echo " <option value=''></option> \n " ;
2014-08-14 09:44:05 +02:00
echo " <option value='1' " . (( $destination_prompt_3 ) ? " selected='selected' " : null ) . " > " . $text [ 'label-destination_prompt_confirm' ] . " </option> \n " ;
2014-08-14 07:36:23 +02:00
//echo " <option value='2'>".$text['label-destination_prompt_announce]."</option>\n";
echo " </select> \n " ;
echo " </td> \n " ;
}
echo " </tr> \n " ;
// 4th destination
echo " <tr> \n " ;
2015-03-18 09:17:57 +01:00
echo " <td><input class='formfld' style='min-width: 135px;' type='text' name='destination_data_4' id='destination_data_4' maxlength='255' value= \" " . $destination_data_4 . " \" ></td> \n " ;
2014-08-14 07:36:23 +02:00
echo " <td> \n " ;
destination_select ( 'destination_delay_4' , $destination_delay_4 , '0' );
echo " </td> \n " ;
echo " <td> \n " ;
destination_select ( 'destination_timeout_4' , $destination_timeout_4 , '30' );
echo " </td> \n " ;
if ( permission_exists ( 'follow_me_prompt' )) {
echo " <td> \n " ;
2014-08-14 09:52:52 +02:00
echo " <select class='formfld' style='width: 90px;' name='destination_prompt_4'> \n " ;
2014-08-14 07:36:23 +02:00
echo " <option value=''></option> \n " ;
2014-08-14 09:44:05 +02:00
echo " <option value='1' " . (( $destination_prompt_4 ) ? " selected='selected' " : null ) . " > " . $text [ 'label-destination_prompt_confirm' ] . " </option> \n " ;
2014-08-14 07:36:23 +02:00
//echo " <option value='2'>".$text['label-destination_prompt_announce]."</option>\n";
echo " </select> \n " ;
echo " </td> \n " ;
}
echo " </tr> \n " ;
// 5th destination
echo " <tr> \n " ;
2015-03-18 09:17:57 +01:00
echo " <td><input class='formfld' style='min-width: 135px;' type='text' name='destination_data_5' id='destination_data_5' maxlength='255' value= \" " . $destination_data_5 . " \" ></td> \n " ;
2014-08-14 07:36:23 +02:00
echo " <td> \n " ;
destination_select ( 'destination_delay_5' , $destination_delay_5 , '0' );
echo " </td> \n " ;
echo " <td> \n " ;
destination_select ( 'destination_timeout_5' , $destination_timeout_5 , '30' );
echo " </td> \n " ;
if ( permission_exists ( 'follow_me_prompt' )) {
echo " <td> \n " ;
2014-08-14 09:52:52 +02:00
echo " <select class='formfld' style='width: 90px;' name='destination_prompt_5'> \n " ;
2014-08-14 07:36:23 +02:00
echo " <option value=''></option> \n " ;
2014-08-14 09:44:05 +02:00
echo " <option value='1' " . (( $destination_prompt_5 ) ? " selected='selected' " : null ) . " > " . $text [ 'label-destination_prompt_confirm' ] . " </option> \n " ;
2014-08-14 07:36:23 +02:00
//echo " <option value='2'>".$text['label-destination_prompt_announce]."</option>\n";
echo " </select> \n " ;
echo " </td> \n " ;
}
echo " </tr> \n " ;
2012-06-04 16:58:40 +02:00
2014-08-14 07:36:23 +02:00
echo " </table> \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " </tr> \n " ;
2015-07-30 14:21:50 +02:00
echo " <tr> \n " ;
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> " ;
echo $text [ 'label-ignore-busy' ];
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2015-10-29 00:39:16 +01:00
echo " <label for='follow_me_ignore_busy'><input type='radio' name='follow_me_ignore_busy' id='follow_me_ignore_busy' value='false' onclick= \" \" " . (( $follow_me_ignore_busy == " false " || $follow_me_ignore_busy == " " ) ? " checked='checked' " : null ) . " /> " . $text [ 'label-disabled' ] . " </label> \n " ;
echo " <label for='follow_me_ignore_busy'><input type='radio' name='follow_me_ignore_busy' id='follow_me_ignore_busy' value='true' onclick= \" $on_click\ " " .(( $follow_me_ignore_busy == " true " ) ? " checked = 'checked' " : null). " /> " . $text['label-enabled'] . " </ label > \n " ;
echo " <br /> \n " ;
echo $text [ 'description-ignore-busy' ] . " \n " ;
//echo " <br> Interrupt call if one of destination are busy\n";
2015-07-30 14:21:50 +02:00
echo " </td> \n " ;
echo " </tr> \n " ;
2013-05-01 19:05:53 +02:00
if ( permission_exists ( 'follow_me_cid_name_prefix' )) {
echo " <tr> \n " ;
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2014-11-29 19:14:23 +01:00
echo " " . $text [ 'label-cid-name-prefix' ] . " \n " ;
2013-05-01 19:05:53 +02:00
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
echo " <input class='formfld' type='text' name='cid_name_prefix' maxlength='255' value=' $cid_name_prefix '> \n " ;
echo " <br /> \n " ;
echo $text [ 'description-cid-name-prefix' ] . " \n " ;
echo " </td> \n " ;
echo " </tr> \n " ;
}
2012-12-18 08:13:49 +01:00
2013-07-06 06:48:23 +02:00
if ( permission_exists ( 'follow_me_cid_number_prefix' )) {
echo " <tr> \n " ;
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2014-11-29 19:14:23 +01:00
echo " " . $text [ 'label-cid-number-prefix' ] . " \n " ;
2013-07-06 06:48:23 +02:00
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
echo " <input class='formfld' type='text' name='cid_number_prefix' maxlength='255' value=' $cid_number_prefix '> \n " ;
echo " <br /> \n " ;
echo $text [ 'description-cid-number-prefix' ] . " \n " ;
echo " </td> \n " ;
echo " </tr> \n " ;
}
2014-10-30 06:39:04 +01:00
echo " <tr><td colspan='2'><br /></td></tr> \n " ;
2012-06-04 16:58:40 +02:00
echo " <tr> \n " ;
2012-11-21 06:59:07 +01:00
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'> \n " ;
2014-11-29 19:14:23 +01:00
echo " <strong> " . $text [ 'label-dnd' ] . " </strong> \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " <td class='vtable' align='left'> \n " ;
2014-11-29 19:14:23 +01:00
$on_click = " document.getElementById('forward_all_disabled').checked=true; " ;
2014-10-29 17:06:53 +01:00
$on_click .= " document.getElementById('forward_busy_disabled').checked=true; " ;
2014-12-03 06:55:01 +01:00
$on_click .= " document.getElementById('forward_no_answer_disabled').checked=true; " ;
2014-11-29 19:14:23 +01:00
$on_click .= " document.getElementById('follow_me_disabled').checked=true; " ;
echo " <label for='dnd_disabled'><input type='radio' name='dnd_enabled' id='dnd_disabled' value='false' onclick= \" \" " . (( $dnd_enabled == " false " || $dnd_enabled == " " ) ? " checked='checked' " : null ) . " /> " . $text [ 'label-disabled' ] . " </label> \n " ;
echo " <label for='dnd_enabled'><input type='radio' name='dnd_enabled' id='dnd_enabled' value='true' onclick= \" $on_click\ " " .(( $dnd_enabled == " true " ) ? " checked = 'checked' " : null). " /> " . $text['label-enabled'] . " </ label > \n " ;
2012-06-04 16:58:40 +02:00
echo " <br /> \n " ;
echo " </td> \n " ;
echo " </tr> \n " ;
echo " <tr> \n " ;
echo " <td colspan='2' align='right'> \n " ;
if ( $action == " update " ) {
2015-02-15 10:15:34 +01:00
echo " <input type='hidden' name='id' value=' $extension_uuid '> \n " ;
2012-06-04 16:58:40 +02:00
}
2015-02-15 10:15:34 +01:00
echo " <br> " ;
echo " <input type='submit' name='submit' class='btn' value=' " . $text [ 'button-save' ] . " '> \n " ;
2012-06-04 16:58:40 +02:00
echo " </td> \n " ;
echo " </tr> " ;
echo " </table> " ;
2015-02-15 08:59:02 +01:00
echo " <br><br> " ;
2012-06-04 16:58:40 +02:00
echo " </form> " ;
2014-08-14 08:06:20 +02:00
//include the footer
require_once " resources/footer.php " ;
2015-05-20 04:46:06 +02:00
?>