Copyright (C) 2008-2012 All Rights Reserved. Contributor(s): Mark J Crane */ include "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; if (permission_exists('extension_add') || permission_exists('extension_edit')) { //access granted } else { echo "access denied"; exit; } //set the action as an add or an update if (isset($_REQUEST["id"])) { $action = "update"; $extension_uuid = check_str($_REQUEST["id"]); } else { $action = "add"; } //get the http values and set them as php variables if (count($_POST)>0) { //get the values from the HTTP POST and save them as PHP variables $extension = check_str($_POST["extension"]); $number_alias = check_str($_POST["number_alias"]); $password = check_str($_POST["password"]); //prepare the provisioning list for the database $provisioning_list = $_POST["provisioning_list"]; if (strlen($provisioning_list) > 0) { $provisioning_list_array = explode("\n", $provisioning_list); if (count($provisioning_list_array) == 0) { $provisioning_list = ''; } else { $provisioning_list = '|'; foreach($provisioning_list_array as $value){ if(strlen(trim($value)) > 0) { $provisioning_list .= check_str(trim($value))."|"; } } } } //get the values from the HTTP POST and save them as PHP variables $vm_password = check_str($_POST["vm_password"]); $accountcode = check_str($_POST["accountcode"]); $effective_caller_id_name = check_str($_POST["effective_caller_id_name"]); $effective_caller_id_number = check_str($_POST["effective_caller_id_number"]); $outbound_caller_id_name = check_str($_POST["outbound_caller_id_name"]); $outbound_caller_id_number = check_str($_POST["outbound_caller_id_number"]); $emergency_caller_id_number = check_str($_POST["emergency_caller_id_number"]); $directory_full_name = check_str($_POST["directory_full_name"]); $directory_visible = check_str($_POST["directory_visible"]); $directory_exten_visible = check_str($_POST["directory_exten_visible"]); $limit_max = check_str($_POST["limit_max"]); $limit_destination = check_str($_POST["limit_destination"]); $vm_enabled = check_str($_POST["vm_enabled"]); $vm_mailto = check_str($_POST["vm_mailto"]); $vm_attach_file = check_str($_POST["vm_attach_file"]); $vm_keep_local_after_email = check_str($_POST["vm_keep_local_after_email"]); $user_context = check_str($_POST["user_context"]); $range = check_str($_POST["range"]); $autogen_users = check_str($_POST["autogen_users"]); $toll_allow = check_str($_POST["toll_allow"]); $call_group = check_str($_POST["call_group"]); $hold_music = check_str($_POST["hold_music"]); $auth_acl = check_str($_POST["auth_acl"]); $cidr = check_str($_POST["cidr"]); $sip_force_contact = check_str($_POST["sip_force_contact"]); $sip_force_expires = check_str($_POST["sip_force_expires"]); $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"]); } //delete the user from the v_extension_users if ($_GET["a"] == "delete" && permission_exists("user_delete")) { //set the variables $user_uuid = check_str($_REQUEST["user_uuid"]); $extension_uuid = check_str($_REQUEST["id"]); //delete the group from the users $sql = "delete from v_extension_users "; $sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "and extension_uuid = '".$extension_uuid."' "; $sql .= "and user_uuid = '".$user_uuid."' "; $db->exec(check_sql($sql)); //redirect the browser require_once "includes/header.php"; echo "\n"; echo "
Delete Complete
"; require_once "includes/footer.php"; return; } //assign the extension to the user if (strlen($_REQUEST["user_uuid"]) > 0 && strlen($_REQUEST["id"]) > 0 && $_GET["a"] != "delete") { //set the variables $user_uuid = check_str($_REQUEST["user_uuid"]); $extension_uuid = check_str($_REQUEST["id"]); //assign the user to the extension $sql_insert = "insert into v_extension_users "; $sql_insert .= "("; $sql_insert .= "extension_user_uuid, "; $sql_insert .= "domain_uuid, "; $sql_insert .= "extension_uuid, "; $sql_insert .= "user_uuid "; $sql_insert .= ")"; $sql_insert .= "values "; $sql_insert .= "("; $sql_insert .= "'".uuid()."', "; $sql_insert .= "'$domain_uuid', "; $sql_insert .= "'".$extension_uuid."', "; $sql_insert .= "'".$user_uuid."' "; $sql_insert .= ")"; $db->exec($sql_insert); //redirect the browser require_once "includes/header.php"; echo "\n"; echo "
Add Complete
"; require_once "includes/footer.php"; return; } if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $msg = ''; if ($action == "update") { $extension_uuid = check_str($_POST["extension_uuid"]); } //check for all required data //if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid
\n"; } if (strlen($extension) == 0) { $msg .= "Please provide: Extension
\n"; } //if (strlen($number_alias) == 0) { $msg .= "Please provide: Number Alias
\n"; } //if (strlen($vm_password) == 0) { $msg .= "Please provide: Voicemail Password
\n"; } //if (strlen($accountcode) == 0) { $msg .= "Please provide: Account Code
\n"; } //if (strlen($effective_caller_id_name) == 0) { $msg .= "Please provide: Effective Caller ID Name
\n"; } //if (strlen($effective_caller_id_number) == 0) { $msg .= "Please provide: Effective Caller ID Number
\n"; } //if (strlen($outbound_caller_id_name) == 0) { $msg .= "Please provide: Outbound Caller ID Name
\n"; } //if (strlen($outbound_caller_id_number) == 0) { $msg .= "Please provide: Outbound Caller ID Number
\n"; } //if (strlen($emergency_caller_id_number) == 0) { $msg .= "Please provide: Emergency Caller ID Number
\n"; } //if (strlen($directory_full_name) == 0) { $msg .= "Please provide: Directory Full Name
\n"; } //if (strlen($directory_visible) == 0) { $msg .= "Please provide: Directory Visible
\n"; } //if (strlen($directory_exten_visible) == 0) { $msg .= "Please provide: Directory Extension Visible
\n"; } //if (strlen($limit_max) == 0) { $msg .= "Please provide: Max Callsr
\n"; } //if (strlen($limit_destination) == 0) { $msg .= "Please provide: Transfer Destination Number
\n"; } //if (strlen($vm_mailto) == 0) { $msg .= "Please provide: Voicemail Mail To
\n"; } //if (strlen($vm_attach_file) == 0) { $msg .= "Please provide: Voicemail Attach File
\n"; } //if (strlen($vm_keep_local_after_email) == 0) { $msg .= "Please provide: VM Keep Local After Email
\n"; } //if (strlen($user_context) == 0) { $msg .= "Please provide: User Context
\n"; } //if (strlen($toll_allow) == 0) { $msg .= "Please provide: Toll Allow
\n"; } //if (strlen($call_group) == 0) { $msg .= "Please provide: Call Group
\n"; } //if (strlen($hold_music) == 0) { $msg .= "Please provide: Hold Music
\n"; } //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) { require_once "includes/header.php"; require_once "includes/persistformvar.php"; echo "
\n"; echo "
\n"; echo $msg."
"; echo "
\n"; persistformvar($_POST); echo "
\n"; require_once "includes/footer.php"; return; } //set the default user context if (if_group("superadmin")) { //allow a user assigned to super admin to change the user_context } else { //if the user_context was not set then set the default value if (strlen($user_context) == 0) { if (count($_SESSION["domains"]) > 1) { $user_context = $_SESSION['domain_name']; } else { $user_context = "default"; } } } //add or update the database if ($_POST["persistformvar"] != "true") { if ($action == "add" && permission_exists('extension_add')) { $user_email = ''; if ($autogen_users == "true") { $auto_user = $extension; for ($i=1; $i<=$range; $i++){ $user_last_name = $auto_user; $user_password = generate_password(); user_add($auto_user, $user_password, $user_email); $generated_users[$i]['username'] = $auto_user; $generated_users[$i]['password'] = $user_password; $auto_user++; } unset($auto_user); } $db->beginTransaction(); for ($i=1; $i<=$range; $i++) { if (extension_exists($extension)) { //extension exists } else { //extension does not exist add it $extension_uuid = uuid(); $password = generate_password(); $sql = "insert into v_extensions "; $sql .= "("; $sql .= "domain_uuid, "; $sql .= "extension_uuid, "; $sql .= "extension, "; $sql .= "number_alias, "; $sql .= "password, "; $sql .= "provisioning_list, "; $sql .= "vm_password, "; $sql .= "accountcode, "; $sql .= "effective_caller_id_name, "; $sql .= "effective_caller_id_number, "; $sql .= "outbound_caller_id_name, "; $sql .= "outbound_caller_id_number, "; $sql .= "emergency_caller_id_number, "; $sql .= "directory_full_name, "; $sql .= "directory_visible, "; $sql .= "directory_exten_visible, "; $sql .= "limit_max, "; $sql .= "limit_destination, "; $sql .= "vm_enabled, "; $sql .= "vm_mailto, "; $sql .= "vm_attach_file, "; $sql .= "vm_keep_local_after_email, "; $sql .= "user_context, "; if (permission_exists('extension_toll')) { $sql .= "toll_allow, "; } $sql .= "call_group, "; $sql .= "hold_music, "; $sql .= "auth_acl, "; $sql .= "cidr, "; $sql .= "sip_force_contact, "; if (strlen($sip_force_expires) > 0) { $sql .= "sip_force_expires, "; } if (strlen($nibble_account) > 0) { $sql .= "nibble_account, "; } if (strlen($mwi_account) > 0) { $sql .= "mwi_account, "; } $sql .= "sip_bypass_media, "; $sql .= "dial_string, "; $sql .= "enabled, "; $sql .= "description "; $sql .= ")"; $sql .= "values "; $sql .= "("; $sql .= "'$domain_uuid', "; $sql .= "'$extension_uuid', "; $sql .= "'$extension', "; $sql .= "'$number_alias', "; $sql .= "'$password', "; $sql .= "'$provisioning_list', "; $sql .= "'user-choose', "; $sql .= "'$accountcode', "; $sql .= "'$effective_caller_id_name', "; $sql .= "'$effective_caller_id_number', "; $sql .= "'$outbound_caller_id_name', "; $sql .= "'$outbound_caller_id_number', "; $sql .= "'$emergency_caller_id_number', "; $sql .= "'$directory_full_name', "; $sql .= "'$directory_visible', "; $sql .= "'$directory_exten_visible', "; $sql .= "'$limit_max', "; $sql .= "'$limit_destination', "; $sql .= "'$vm_enabled', "; $sql .= "'$vm_mailto', "; $sql .= "'$vm_attach_file', "; $sql .= "'$vm_keep_local_after_email', "; $sql .= "'$user_context', "; if (permission_exists('extension_toll')) { $sql .= "'$toll_allow', "; } $sql .= "'$call_group', "; $sql .= "'$hold_music', "; $sql .= "'$auth_acl', "; $sql .= "'$cidr', "; $sql .= "'$sip_force_contact', "; if (strlen($sip_force_expires) > 0) { $sql .= "'$sip_force_expires', "; } if (strlen($nibble_account) > 0) { $sql .= "'$nibble_account', "; } if (strlen($mwi_account) > 0) { if (strpos($mwi_account, '@') === false) { if (count($_SESSION["domains"]) > 1) { $mwi_account .= "@".$_SESSION['domain_name']; } else { $mwi_account .= "@\$\${domain}"; } } $sql .= "'$mwi_account', "; } $sql .= "'$sip_bypass_media', "; $sql .= "'$dial_string', "; $sql .= "'$enabled', "; $sql .= "'$description' "; $sql .= ")"; $db->exec(check_sql($sql)); unset($sql); } $extension++; } $db->commit(); //syncrhonize configuration save_extension_xml(); //write the provision files if (strlen($provisioning_list)>0) { require_once "app/provision/provision_write.php"; } //prepare for alternating the row style $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; //show the action and redirect the user require_once "includes/header.php"; echo "
\n"; echo "
\n"; if (count($generated_users) == 0) { //action add echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
Message
Add Complete
\n"; echo "
\n"; } else { // auto-generate user with extension as login name echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; foreach($generated_users as $tmp_user){ echo " \n"; echo " \n"; echo " \n"; echo " \n"; } if ($c==0) { $c=1; } else { $c=0; } echo "
New User Accounts
UsernamePassword
".$tmp_user['username']."".$tmp_user['password']."
"; } echo "
\n"; require_once "includes/footer.php"; return; } //if ($action == "add") if ($action == "update" && permission_exists('extension_edit')) { if (strlen($password) == 0) { $password = generate_password(); } $sql = "update v_extensions set "; $sql .= "extension = '$extension', "; $sql .= "number_alias = '$number_alias', "; $sql .= "password = '$password', "; $sql .= "provisioning_list = '$provisioning_list', "; if (strlen($vm_password) > 0) { $sql .= "vm_password = '$vm_password', "; } else { $sql .= "vm_password = 'user-choose', "; } $sql .= "accountcode = '$accountcode', "; $sql .= "effective_caller_id_name = '$effective_caller_id_name', "; $sql .= "effective_caller_id_number = '$effective_caller_id_number', "; $sql .= "outbound_caller_id_name = '$outbound_caller_id_name', "; $sql .= "outbound_caller_id_number = '$outbound_caller_id_number', "; $sql .= "emergency_caller_id_number = '$emergency_caller_id_number', "; $sql .= "directory_full_name = '$directory_full_name', "; $sql .= "directory_visible = '$directory_visible', "; $sql .= "directory_exten_visible = '$directory_exten_visible', "; $sql .= "limit_max = '$limit_max', "; $sql .= "limit_destination = '$limit_destination', "; $sql .= "vm_enabled = '$vm_enabled', "; $sql .= "vm_mailto = '$vm_mailto', "; $sql .= "vm_attach_file = '$vm_attach_file', "; $sql .= "vm_keep_local_after_email = '$vm_keep_local_after_email', "; $sql .= "user_context = '$user_context', "; if (permission_exists('extension_toll')) { $sql .= "toll_allow = '$toll_allow', "; } $sql .= "call_group = '$call_group', "; $sql .= "hold_music = '$hold_music', "; $sql .= "auth_acl = '$auth_acl', "; $sql .= "cidr = '$cidr', "; $sql .= "sip_force_contact = '$sip_force_contact', "; if (strlen($sip_force_expires) == 0) { $sql .= "sip_force_expires = null, "; } else { $sql .= "sip_force_expires = '$sip_force_expires', "; } if (strlen($nibble_account) == 0) { $sql .= "nibble_account = null, "; } else { $sql .= "nibble_account = '$nibble_account', "; } if (strlen($mwi_account) > 0) { if (strpos($mwi_account, '@') === false) { if (count($_SESSION["domains"]) > 1) { $mwi_account .= "@".$_SESSION['domain_name']; } else { $mwi_account .= "@\$\${domain}"; } } } $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' "; $sql .= "and extension_uuid = '$extension_uuid'"; $db->exec(check_sql($sql)); unset($sql); //syncrhonize configuration save_extension_xml(); //write the provision files if (strlen($provisioning_list)>0) { require_once "app/provision/provision_write.php"; } //determine the voicemail_id if (is_numeric($extension)) { $voicemail_id = $extension; } else { $voicemail_id = $number_alias; } //update the voicemail settings $sql = "select * from v_voicemails "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and voicemail_id = '$voicemail_id' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); if (count($result) == 0) { //add the voicemail box $sql = "insert into v_voicemails "; $sql .= "("; $sql .= "domain_uuid, "; $sql .= "voicemail_uuid, "; $sql .= "voicemail_id, "; $sql .= "voicemail_password, "; if (strlen($greeting_id) > 0) { $sql .= "greeting_id, "; } $sql .= "voicemail_mail_to, "; $sql .= "voicemail_attach_file, "; $sql .= "voicemail_local_after_email, "; $sql .= "voicemail_enabled, "; $sql .= "voicemail_description "; $sql .= ")"; $sql .= "values "; $sql .= "("; $sql .= "'$domain_uuid', "; $sql .= "'".uuid()."', "; $sql .= "'$voicemail_id', "; $sql .= "'$vm_password', "; $sql .= "'$vm_mailto', "; $sql .= "'$vm_attach_file', "; $sql .= "'$vm_keep_local_after_email', "; $sql .= "'$vm_enabled', "; $sql .= "'$description' "; $sql .= ")"; $db->exec(check_sql($sql)); unset($sql); } else { //update the voicemail box $sql = "update v_voicemails set "; $sql .= "voicemail_password = '$vm_password', "; $sql .= "voicemail_mail_to = '$vm_mailto', "; $sql .= "voicemail_attach_file = '$vm_attach_file', "; $sql .= "voicemail_local_after_email = '$vm_keep_local_after_email', "; $sql .= "voicemail_enabled = '$vm_enabled', "; $sql .= "voicemail_description = '$description' "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and voicemail_id = '$voicemail_id'"; $db->exec(check_sql($sql)); unset($sql); } unset ($prep_statement); //delete extension from memcache $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); if ($fp) { $switch_cmd = "memcache delete directory:".$extension."@".$_SESSION['domain_name']; $switch_result = event_socket_request($fp, 'api '.$switch_cmd); } //show the action and redirect the user require_once "includes/header.php"; echo "\n"; echo "
\n"; echo "
\n"; //action update echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
Message
Update Complete
\n"; echo "
\n"; echo "
\n"; require_once "includes/footer.php"; return; } //if ($action == "update") } //if ($_POST["persistformvar"] != "true") } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true") { $extension_uuid = $_GET["id"]; $sql = "select * from v_extensions "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and extension_uuid = '$extension_uuid' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { $extension = $row["extension"]; $number_alias = $row["number_alias"]; $password = $row["password"]; $provisioning_list = $row["provisioning_list"]; $provisioning_list = strtolower($provisioning_list); $vm_password = $row["vm_password"]; $vm_password = str_replace("#", "", $vm_password); //preserves leading zeros $accountcode = $row["accountcode"]; $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"]; $emergency_caller_id_number = $row["emergency_caller_id_number"]; $directory_full_name = $row["directory_full_name"]; $directory_visible = $row["directory_visible"]; $directory_exten_visible = $row["directory_exten_visible"]; $limit_max = $row["limit_max"]; $limit_destination = $row["limit_destination"]; $vm_enabled = $row["vm_enabled"]; $vm_mailto = $row["vm_mailto"]; $vm_attach_file = $row["vm_attach_file"]; $vm_keep_local_after_email = $row["vm_keep_local_after_email"]; $user_context = $row["user_context"]; $toll_allow = $row["toll_allow"]; $call_group = $row["call_group"]; $hold_music = $row["hold_music"]; $auth_acl = $row["auth_acl"]; $cidr = $row["cidr"]; $sip_force_contact = $row["sip_force_contact"]; $sip_force_expires = $row["sip_force_expires"]; $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 } unset ($prep_statement); } //set the defaults if (strlen($limit_max) == 0) { $limit_max = '5'; } //begin the page content require_once "includes/header.php"; echo ""; echo "
"; echo "\n"; echo "\n"; echo " "; echo " "; echo "
\n"; echo "
"; echo "
\n"; echo "
\n"; echo "\n"; echo "\n"; if ($action == "add") { echo "\n"; } if ($action == "update") { echo "\n"; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; if ($action == "update") { echo "\n"; echo "\n"; echo "\n"; echo "\n"; } if ($action == "add") { echo "\n"; echo "\n"; echo "\n"; echo "\n"; } if ($action == "update") { echo " "; echo " "; echo " "; echo " "; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; if (if_group("superadmin")) { if (strlen($user_context) == 0) { if (count($_SESSION["domains"]) > 1) { $user_context = $_SESSION['domain_name']; } else { $user_context = "default"; } } echo "\n"; echo "\n"; echo "\n"; echo "\n"; } //--- begin: show_advanced ----------------------- echo "\n"; echo "\n"; echo "\n"; //--- end: show_advanced ----------------------- echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo " "; echo "
Extension AddExtension Edit\n"; echo " \n"; echo " \n"; echo " \n"; echo "

\n"; echo "
\n"; echo " Extension:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the alphanumeric extension. The default configuration allows 2 - 7 digit extensions.\n"; echo "
\n"; echo " Number Alias:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "If the extension is numeric then number alias is optional.\n"; echo "
\n"; echo " Password:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the password here. \n"; echo "
\n"; echo " Range:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the number of extensions to create. Increments each extension by 1.
\n"; echo " Auto-generate user with extension as login name
\n"; echo "\n"; echo "
User List:"; echo " \n"; $sql = "SELECT u.username, e.user_uuid FROM v_extension_users as e, v_users as u "; $sql .= "where e.user_uuid = u.user_uuid "; $sql .= "and u.user_enabled = 'true' "; $sql .= "and e.domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "and e.extension_uuid = '".$extension_uuid."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result_count = count($result); foreach($result as $field) { echo " \n"; echo " \n"; echo " \n"; echo " \n"; } echo "
".$field['username']."\n"; echo " $v_link_label_delete\n"; echo "
\n"; echo "
\n"; $sql = "SELECT * FROM v_users "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "and user_enabled = 'true' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); echo " "; echo " \n"; unset($sql, $result); echo "
\n"; echo " Assign the users that are assigned to this extension.\n"; echo "
\n"; echo "
\n"; echo " Voicemail Password:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the voicemail password here. \n"; echo "
\n"; echo " Account Code:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the account code here.\n"; echo "
\n"; echo " Effective Caller ID Name:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the internal caller id name here.\n"; echo "
\n"; echo " Effective Caller ID Number:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the internal caller id number here.\n"; echo "
\n"; echo " Outbound Caller ID Name:\n"; echo "\n"; if (permission_exists('outbound_caller_id_select')) { $sql = "select * from v_destinations "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and destination_type = 'inbound' "; $sql .= "order by destination_number asc "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); if (count($result) > 0) { echo " \n"; echo "
\n"; echo "Select the external caller id name.\n"; } else { echo " \n"; } unset ($prep_statement); } else { echo " \n"; } echo "
\n"; echo " Outbound Caller ID Number:\n"; echo "\n"; if (permission_exists('outbound_caller_id_select')) { $sql = "select * from v_destinations "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and destination_type = 'inbound' "; $sql .= "order by destination_number asc "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); if (count($result) > 0) { echo " \n"; echo "
\n"; echo "Select the inbound destination number.\n"; } else { echo " \n"; } unset ($prep_statement); } else { echo " \n"; } echo "
\n"; echo "Enter the external caller id number here.\n"; echo "
\n"; echo " Emergency Caller ID Number:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the emergency caller id number here.\n"; echo "
\n"; echo " Directory Full Name:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the first name followed by the last name.\n"; echo "
\n"; echo " Directory Visible:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "
\n"; echo "Select whether to hide the name from the directory.\n"; echo "
\n"; echo " Directory Extension Visible:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "
\n"; echo "Select whether announce the extension when calling the directory.\n"; echo "
\n"; echo " Limit Max:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the max number of outgoing calls for this user.\n"; echo "
\n"; echo " Limit Destination:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the destination to send the calls when the max number of outgoing calls has been reached. \n"; echo "
\n"; echo " Phone Provisioning:\n"; echo "\n"; $onchange = "document.getElementById('provisioning_list').value += document.getElementById('select_mac_address').value;"; $onchange .= "document.getElementById('provisioning_list').value += ':'+document.getElementById('prov_line').value + '\\n'"; $sql = "select * from v_hardware_phones "; $sql .= "where domain_uuid = '".$domain_uuid."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result_count = count($result); unset ($prep_statement, $sql); echo "\n"; echo "
\n"; echo "Select a device to assign to this extension by its MAC addresses.\n"; echo "
\n"; echo "
\n"; echo " \n"; echo "
\n"; echo "Select a line number.
\n"; echo "
\n"; //replace the vertical bar with a line feed to display in the textarea $provisioning_list = trim($provisioning_list, "|"); $provisioning_list_array = explode("|", $provisioning_list); $provisioning_list = ''; foreach($provisioning_list_array as $value){ $provisioning_list .= trim($value)."\n"; } echo " \n"; echo "
\n"; echo "If a MAC address is not in the select list it can be added manually.
MAC Address:Line Number\n"; echo "
\n"; echo "
\n"; echo " Voicemail Enabled:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enable/disable voicemail for this extension.\n"; echo "
\n"; echo " Voicemail Mail To:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Optional: Enter the email address to send voicemail to.\n"; echo "
\n"; echo " Voicemail Attach File:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Choose whether to attach the file to the email.\n"; echo "
\n"; echo " VM Keep Local After Email:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Keep local file after sending the email. \n"; echo "
\n"; echo " Toll Allow:\n"; echo "\n"; if (permission_exists('extension_toll')) { echo " \n"; echo "
\n"; echo "Enter the toll allow value here. example: domestic,international,local\n"; } echo "
\n"; echo " Call Group:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the user call group here. Groups available by default: sales, support, billing\n"; echo "
\n"; echo " Hold Music:\n"; echo "\n"; require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; $moh= new switch_music_on_hold; $moh->select_name = "hold_music"; $moh->select_value = $hold_music; echo $moh->select(); echo "
\n"; echo " Select the MOH Category here.\n"; echo "
\n"; echo " User Context:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the user context here.\n"; echo "
\n"; echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
Show Advanced\n"; echo " \n"; echo "
\n"; echo "
\n"; echo "
\n"; echo " \n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo " Auth ACL:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the Auth ACL here.\n"; echo "
\n"; echo " CIDR:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the cidr here.\n"; echo "
\n"; echo " SIP Force Contact:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Choose whether to rewrite the contact port, or rewrite both the contact IP and port.\n"; echo "
\n"; echo " SIP Force Expires:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the sip force expire seconds.\n"; echo "
\n"; echo " Nibblebill Account:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the account number for nibblebill to use.\n"; echo "
\n"; echo " MWI Account:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "MWI Account with user@domain of the voicemail to monitor.\n"; echo "
\n"; echo " SIP Bypass Media:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Choose whether to send the media stream point to point or in transparent proxy mode.\n"; echo "
\n"; echo " Dial String:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Location of the endpoint.\n"; echo "
\n"; echo "
"; echo "
\n"; echo " Enabled:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "
\n"; echo " Description:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "\n"; echo "
\n"; if ($action == "update") { echo " \n"; } echo " \n"; echo "
"; echo ""; echo "
"; echo "
"; require_once "includes/footer.php"; ?>