Exemplo n.º 1
0
function blacklist_hookGet_config($engine)
{
    global $ext;
    switch ($engine) {
        case "asterisk":
            // Code from modules/core/functions.inc.php core_get_config inbound routes
            $didlist = core_did_list();
            if (is_array($didlist)) {
                foreach ($didlist as $item) {
                    $exten = trim($item['extension']);
                    $cidnum = trim($item['cidnum']);
                    if ($cidnum != '' && $exten == '') {
                        $exten = 's';
                        $pricid = $item['pricid'] ? true : false;
                    } else {
                        if ($cidnum != '' && $exten != '' || $cidnum == '' && $exten == '') {
                            $pricid = true;
                        } else {
                            $pricid = false;
                        }
                    }
                    $context = $pricid ? "ext-did-0001" : "ext-did-0002";
                    if (function_exists("empty_freepbx")) {
                        $exten = empty_freepbx($exten) ? "s" : $exten;
                    } else {
                        $exten = empty($exten) ? "s" : $exten;
                    }
                    $exten = $exten . (empty($cidnum) ? "" : "/" . $cidnum);
                    //if a CID num is defined, add it
                    $ext->splice($context, $exten, 1, new ext_gosub('1', 's', 'app-blacklist-check'));
                }
            }
            // else no DID's defined. Not even a catchall.
            break;
    }
}
Exemplo n.º 2
0
echo _("General DIDs") . ($didfilter == 'incoming' ? $toggle_sort : "");
?>
</a></li>
	<li><a <?php 
echo $didfilter == 'unassigned' ? 'class="current"' : '';
?>
 href="<?php 
echo ($didfilter == 'unassigned' ? $display_link_current : $display_link) . '&didfilter=unassigned';
?>
"><?php 
echo _("Unused DIDs") . ($didfilter == 'unassigned' ? $toggle_sort : "");
?>
</a></li><hr>
<?php 
//get unique incoming routes
$inroutes = core_did_list($rnavsort);
switch ($didfilter) {
    case 'directdid':
        foreach ($inroutes as $key => $did_items) {
            $did_dest = explode(',', $did_items['destination']);
            if (!isset($did_dest[0]) || $did_dest[0] != 'from-did-direct') {
                unset($inroutes[$key]);
            }
        }
        break;
    case 'incoming':
        foreach ($inroutes as $key => $did_items) {
            $did_dest = explode(',', $did_items['destination']);
            if (!isset($did_dest[0]) || $did_dest[0] == 'from-did-direct') {
                unset($inroutes[$key]);
            }
Exemplo n.º 3
0
function core_users_configpageload()
{
    global $currentcomponent;
    global $amp_conf;
    // Ensure variables possibly extracted later exist
    $name = $outboundcid = $record_in = $record_out = $sipname = $cid_masquerade = $newdid_name = $newdid = $newdidcid = $call_screen = $pinless = null;
    // Init vars from $_REQUEST[]
    $display = isset($_REQUEST['display']) ? $_REQUEST['display'] : null;
    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
    $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null;
    $tech_hardware = isset($_REQUEST['tech_hardware']) ? $_REQUEST['tech_hardware'] : null;
    if ($action == 'del') {
        // Deleted
        $currentcomponent->addguielem('_top', new gui_subheading('del', $extdisplay . ' ' . _("deleted"), false));
    } elseif ($display == 'extensions' && ($extdisplay == '' && $tech_hardware == '')) {
        // Adding
        // do nothing as you want the Devices to handle this bit
    } else {
        $delURL = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] . '&action=del';
        if (is_string($extdisplay)) {
            if (!isset($GLOBALS['abort']) || $GLOBALS['abort'] !== true) {
                $extenInfo = core_users_get($extdisplay);
                extract($extenInfo);
            }
            if (isset($deviceInfo) && is_array($deviceInfo)) {
                extract($deviceInfo);
            }
            if ($display == 'extensions') {
                $currentcomponent->addguielem('_top', new gui_pageheading('title', _("Extension") . ": {$extdisplay}", false), 0);
                if (!isset($GLOBALS['abort']) || $GLOBALS['abort'] !== true) {
                    $tlabel = sprintf(_("Delete Extension %s"), $extdisplay);
                    $label = '<span><img width="16" height="16" border="0" title="' . $tlabel . '" alt="" src="images/user_delete.png"/>&nbsp;' . $tlabel . '</span>';
                    $currentcomponent->addguielem('_top', new gui_link('del', $label, $delURL, true, false), 0);
                    $usage_list = framework_display_destination_usage(core_getdest($extdisplay));
                    if (!empty($usage_list)) {
                        $currentcomponent->addguielem('_top', new gui_link_label('dests', $usage_list['text'], $usage_list['tooltip'], true), 0);
                    }
                }
            } else {
                $currentcomponent->addguielem('_top', new gui_pageheading('title', _("User") . ": {$extdisplay}", false), 0);
                if (!isset($GLOBALS['abort']) || $GLOBALS['abort'] !== true) {
                    $tlabel = sprintf(_("Delete User %s"), $extdisplay);
                    $label = '<span><img width="16" height="16" border="0" title="' . $tlabel . '" alt="" src="images/user_delete.png"/>&nbsp;' . $tlabel . '</span>';
                    $currentcomponent->addguielem('_top', new gui_link('del', $label, $delURL, true, false), 0);
                    $usage_list = framework_display_destination_usage(core_getdest($extdisplay));
                    if (!empty($usage_list)) {
                        $currentcomponent->addguielem('_top', new gui_link_label('dests', $usage_list['text'], $usage_list['tooltip'], true), 0);
                    }
                }
            }
        } elseif ($display != 'extensions') {
            $currentcomponent->addguielem('_top', new gui_pageheading('title', _("Add User/Extension")), 0);
        }
        // Setup vars for use in the gui later on
        $fc_logon = featurecodes_getFeatureCode('core', 'userlogon');
        $fc_logoff = featurecodes_getFeatureCode('core', 'userlogoff');
        $msgInvalidExtNum = _("Please enter a valid extension number.");
        $msgInvalidCidNum = _("Please enter a valid CID Num Alias (must be a valid number).");
        $msgInvalidExtPwd = _("Please enter valid User Password using numbers only");
        $msgInvalidDispName = _("Please enter a valid Display Name");
        $msgInvalidOutboundCID = _("Please enter a valid Outbound CID");
        $msgInvalidPause = _("Please enter a valid pause time in seconds, using digits only");
        $msgInvalidDIDNum = _("You have entered a non-standard dialpattern for your DID. You can only enter standard dialpatterns. You must use the inbound routing form to enter non-standard patterns");
        $msgInvalidCIDNum = _("Please enter a valid Caller ID Number or leave it blank for your Assigned DID/CID pair");
        // This is the actual gui stuff
        $currentcomponent->addguielem('_top', new gui_hidden('action', $extdisplay ? 'edit' : 'add'));
        $currentcomponent->addguielem('_top', new gui_hidden('extdisplay', $extdisplay));
        if ($display == 'extensions') {
            $section = $extdisplay ? _("Edit Extension") : _("Add Extension");
        } else {
            $section = $extdisplay ? _("Edit User") : _("Add User");
        }
        if (trim($extdisplay) != '') {
            $currentcomponent->addguielem($section, new gui_hidden('extension', $extdisplay), 2);
        } else {
            $currentcomponent->addguielem($section, new gui_textbox('extension', $extdisplay, _("User Extension"), _("The extension number to dial to reach this user."), '!isInteger()', $msgInvalidExtNum, false), 3);
        }
        if ($display != 'extensions') {
            $currentcomponent->addguielem($section, new gui_password('password', $password, _("User Password"), _("A user will enter this password when logging onto a device.") . ' ' . $fc_logon . ' ' . _("logs into a device.") . ' ' . $fc_logoff . ' ' . _("logs out of a device."), '!isInteger() && !isWhitespace()', $msgInvalidExtPwd, true));
            // extra JS function check required for blank password warning -- call last in the onsubmit() function
            $currentcomponent->addjsfunc('onsubmit()', "\treturn checkBlankUserPwd();\n", 9);
        }
        $currentcomponent->addguielem($section, new gui_textbox('name', $name, _("Display Name"), _("The caller id name for calls from this user will be set to this name. Only enter the name, NOT the number."), '!isAlphanumeric() || isWhitespace()', $msgInvalidDispName, false));
        $cid_masquerade = trim($cid_masquerade) == $extdisplay ? "" : $cid_masquerade;
        $currentcomponent->addguielem($section, new gui_textbox('cid_masquerade', $cid_masquerade, _("CID Num Alias"), _("The CID Number to use for internal calls, if different from the extension number. This is used to masquerade as a different user. A common example is a team of support people who would like their internal callerid to display the general support number (a ringgroup or queue). There will be no effect on external calls."), '!isWhitespace() && !isInteger()', $msgInvalidCidNum, false));
        $currentcomponent->addguielem($section, new gui_textbox('sipname', $sipname, _("SIP Alias"), _("If you want to support direct sip dialing of users internally or through anonymous sip calls, you can supply a friendly name that can be used in addition to the users extension to call them.")));
        // If user mode, list devices associated with this user
        //
        if ($display == 'users' && trim($extdisplay != '')) {
            $section = _("User Devices");
            $device_list = core_devices_list('all', 'full');
            usort($device_list, 'dev_grp');
            $link_count = 0;
            foreach ($device_list as $device_item) {
                if ($device_item['user'] == $extdisplay) {
                    $editURL = $_SERVER['PHP_SELF'] . '?type=setup&display=devices&skip=0&extdisplay=' . $device_item['id'];
                    $device_icon = $device_item['devicetype'] == 'fixed' ? 'images/telephone_key.png' : 'images/telephone_edit.png';
                    $device_label = '&nbsp;';
                    $device_label .= _("Edit:");
                    $device_label .= '&nbsp;' . $device_item['id'] . '&nbsp;' . $device_item['description'];
                    $device_label = '<span>
						<img width="16" height="16" border="0" title="Edit Device" alt="Edit Device" src="' . $device_icon . '"/>' . $device_label . '</span> ';
                    $currentcomponent->addguielem($section, new gui_link('dev' . $link_count++, $device_label, $editURL, true, false), 2);
                }
            }
        }
        $section = _("Extension Options");
        $currentcomponent->addguielem($section, new gui_textbox('outboundcid', $outboundcid, _("Outbound CID"), _("Overrides the caller id when dialing out a trunk. Any setting here will override the common outbound caller id set in the Trunks admin.<br><br>Format: <b>\"caller name\" &lt;#######&gt;</b><br><br>Leave this field blank to disable the outbound callerid feature for this user."), '!isCallerID()', $msgInvalidOutboundCID, true), 3);
        $ringtimer = isset($ringtimer) ? $ringtimer : '0';
        $currentcomponent->addguielem($section, new gui_selectbox('ringtimer', $currentcomponent->getoptlist('ringtime'), $ringtimer, _("Ring Time"), _("Number of seconds to ring prior to going to voicemail. Default will use the value set in the General Tab. If no voicemail is configured this will be ignored."), false));
        if (!isset($callwaiting)) {
            if ($amp_conf['ENABLECW']) {
                $callwaiting = 'enabled';
            } else {
                $callwaiting = 'disabled';
            }
        }
        $currentcomponent->addguielem($section, new gui_selectbox('callwaiting', $currentcomponent->getoptlist('callwaiting'), $callwaiting, _("Call Waiting"), _("Set the initial/current Call Waiting state for this user's extension"), false));
        $currentcomponent->addguielem($section, new gui_selectbox('call_screen', $currentcomponent->getoptlist('call_screen'), $call_screen, _("Call Screening"), _("Call Screening requires external callers to say their name, which will be played back to the user and allow the user to accept or reject the call.  Screening with memory only verifies a caller for their caller-id once. Screening without memory always requires a caller to say their name. Either mode will always announce the caller based on the last introduction saved with that callerid. If any user on the system uses the memory option, when that user is called, the caller will be required to re-introduce themselves and all users on the system will have that new introduction associated with the caller's CallerId."), false));
        $currentcomponent->addguielem($section, new gui_selectbox('pinless', $currentcomponent->getoptlist('pinless'), $pinless, _("Pinless Dialing"), _("Enabling Pinless Dialing will allow this extension to bypass any pin codes normally required on outbound calls"), false));
        $section = _("Assigned DID/CID");
        $currentcomponent->addguielem($section, new gui_textbox('newdid_name', $newdid_name, _("DID Description"), _("A description for this DID, such as \"Fax\"")), 4);
        $currentcomponent->addguielem($section, new gui_textbox('newdid', $newdid, _("Add Inbound DID"), _("A direct DID that is associated with this extension. The DID should be in the same format as provided by the provider (e.g. full number, 4 digits for 10x4, etc).<br><br>Format should be: <b>XXXXXXXXXX</b><br><br>.An optional CID can also be associated with this DID by setting the next box"), '!isDialpattern()', $msgInvalidDIDNum, true), 4);
        $currentcomponent->addguielem($section, new gui_textbox('newdidcid', $newdidcid, _("Add Inbound CID"), _("Add a CID for more specific DID + CID routing. A DID must be specified in the above Add DID box. In addition to standard dial sequences, you can also put Private, Blocked, Unknown, Restricted, Anonymous and Unavailable in order to catch these special cases if the Telco transmits them."), "!frm_{$display}_isValidCID()", $msgInvalidCIDNum, true), 4);
        $dids = core_did_list('extension');
        $did_count = 0;
        foreach ($dids as $did) {
            $did_dest = split(',', $did['destination']);
            if (isset($did_dest[1]) && $did_dest[1] == $extdisplay) {
                $did_title = $did['description'] != '' ? $did['description'] : _("DID / CID");
                $addURL = $_SERVER['PHP_SELF'] . '?type=setup&display=did&&extdisplay=' . $did['extension'] . '/' . $did['cidnum'];
                $did_icon = 'images/email_edit.png';
                $did_label = trim($did['extension']) == '' ? ' ' . _("Any DID") : ' ' . $did['extension'];
                if (trim($did['cidnum']) != '') {
                    $did_label .= ' / ' . $did['cidnum'];
                }
                if (trim($did['description']) != '') {
                    $did_label .= ' (' . $did['description'] . ')';
                }
                $did_label = '&nbsp;<span>
					<img width="16" height="16" border="0" title="' . $did_title . '" alt="" src="' . $did_icon . '"/>' . $did_label . '</span> ';
                $currentcomponent->addguielem($section, new gui_link('did_' . $did_count++, $did_label, $addURL, true, false), 4);
            }
        }
        $section = _("Recording Options");
        $currentcomponent->addguielem($section, new gui_selectbox('record_in', $currentcomponent->getoptlist('recordoptions'), $record_in, _("Record Incoming"), _("Record all inbound calls received at this extension."), false));
        $currentcomponent->addguielem($section, new gui_selectbox('record_out', $currentcomponent->getoptlist('recordoptions'), $record_out, _("Record Outgoing"), _("Record all outbound calls received at this extension."), false));
    }
}
Exemplo n.º 4
0
function core_users_configpageload()
{
    global $currentcomponent;
    global $amp_conf;
    // Ensure variables possibly extracted later exist
    $name = $outboundcid = $sipname = $cid_masquerade = $newdid_name = $newdid = $newdidcid = $call_screen = $pinless = null;
    // Init vars from $_REQUEST[]
    $display = isset($_REQUEST['display']) ? $_REQUEST['display'] : null;
    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
    $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : null;
    $tech_hardware = isset($_REQUEST['tech_hardware']) ? $_REQUEST['tech_hardware'] : null;
    if ($action == 'del') {
        // Deleted
        $currentcomponent->addguielem('_top', new gui_subheading('del', $extdisplay . ' ' . _("deleted"), false));
    } elseif ($display == 'extensions' && ($extdisplay == '' && $tech_hardware == '')) {
        // Adding
        // do nothing as you want the Devices to handle this bit
    } else {
        $delURL = '?' . $_SERVER['QUERY_STRING'] . '&action=del';
        if (is_string($extdisplay)) {
            if (!isset($GLOBALS['abort']) || $GLOBALS['abort'] !== true) {
                $extenInfo = core_users_get($extdisplay);
                extract($extenInfo);
            }
            if (isset($deviceInfo) && is_array($deviceInfo)) {
                extract($deviceInfo);
            }
            if ($display == 'extensions') {
                $currentcomponent->addguielem('_top', new gui_pageheading('title', _("Extension") . ": {$extdisplay}", false), 0);
                if (!isset($GLOBALS['abort']) || $GLOBALS['abort'] !== true) {
                    $tlabel = sprintf(_("Delete Extension %s"), $extdisplay);
                    $label = '<span><img width="16" height="16" border="0" title="' . $tlabel . '" alt="" src="images/user_delete.png"/>&nbsp;' . $tlabel . '</span>';
                    $currentcomponent->addguielem('_top', new gui_link('del', $label, $delURL, true, false), 0);
                    $usage_list = framework_display_destination_usage(core_getdest($extdisplay));
                    if (!empty($usage_list)) {
                        $currentcomponent->addguielem('_top', new gui_link_label('dests', $usage_list['text'], $usage_list['tooltip'], true), 0);
                    }
                }
            } else {
                $currentcomponent->addguielem('_top', new gui_pageheading('title', _("User") . ": {$extdisplay}", false), 0);
                if (!isset($GLOBALS['abort']) || $GLOBALS['abort'] !== true) {
                    $tlabel = sprintf(_("Delete User %s"), $extdisplay);
                    $label = '<span><img width="16" height="16" border="0" title="' . $tlabel . '" alt="" src="images/user_delete.png"/>&nbsp;' . $tlabel . '</span>';
                    $currentcomponent->addguielem('_top', new gui_link('del', $label, $delURL, true, false), 0);
                    $usage_list = framework_display_destination_usage(core_getdest($extdisplay));
                    if (!empty($usage_list)) {
                        $currentcomponent->addguielem('_top', new gui_link_label('dests', $usage_list['text'], $usage_list['tooltip'], true), 0);
                    }
                }
            }
        } elseif ($display != 'extensions') {
            $currentcomponent->addguielem('_top', new gui_pageheading('title', _("Add User/Extension")), 0);
        }
        // Setup vars for use in the gui later on
        $fc_logon = featurecodes_getFeatureCode('core', 'userlogon');
        $fc_logoff = featurecodes_getFeatureCode('core', 'userlogoff');
        $msgInvalidExtNum = _("Please enter a valid extension number.");
        $msgInvalidCidNum = _("Please enter a valid CID Num Alias (must be a valid number).");
        $msgInvalidExtPwd = _("Please enter valid User Password using numbers only");
        $msgInvalidDispName = _("Please enter a valid Display Name");
        $msgInvalidOutboundCID = _("Please enter a valid Outbound CID");
        $msgInvalidPause = _("Please enter a valid pause time in seconds, using digits only");
        $msgInvalidDIDNum = _("You have entered a non-standard dialpattern for your DID. You can only enter standard dialpatterns. You must use the inbound routing form to enter non-standard patterns");
        $msgInvalidCIDNum = _("Please enter a valid CallerID Number or leave it blank for your Assigned DID/CID pair");
        // This is the actual gui stuff
        $currentcomponent->addguielem('_top', new gui_hidden('action', $extdisplay ? 'edit' : 'add'));
        $currentcomponent->addguielem('_top', new gui_hidden('extdisplay', $extdisplay));
        if ($display == 'extensions') {
            $section = $extdisplay ? _("Edit Extension") : _("Add Extension");
        } else {
            $section = $extdisplay ? _("Edit User") : _("Add User");
        }
        if (trim($extdisplay) != '') {
            $currentcomponent->addguielem($section, new gui_hidden('extension', $extdisplay), 2);
        } else {
            $currentcomponent->addguielem($section, new gui_textbox('extension', $extdisplay, _("User Extension"), _("The extension number to dial to reach this user."), '!isInteger()', $msgInvalidExtNum, false), 3);
        }
        if ($display != 'extensions') {
            $currentcomponent->addguielem($section, new gui_password('password', $password, _("User Password"), _("A user will enter this password when logging onto a device.") . ' ' . $fc_logon . ' ' . _("logs into a device.") . ' ' . $fc_logoff . ' ' . _("logs out of a device."), '!isInteger() && !isWhitespace()', $msgInvalidExtPwd, true));
            // extra JS function check required for blank password warning -- call last in the onsubmit() function
            $currentcomponent->addjsfunc('onsubmit()', "\treturn checkBlankUserPwd();\n", 9);
        }
        if ($action == 'add') {
            $currentcomponent->addjsfunc('onsubmit()', "\n\t\t\tvar exten = \$('#extension').val();\n\t\t\tvar ajax_result = true;\n\t\t\t\$('#error').remove();\n\t\t\t\$.ajax({\n\t\t\t\ttype: 'POST',\n\t\t\t\turl: 'config.php',\n\t\t\t\tdata: 'handler=api&function=framework_get_conflict_url_helper&args=' + exten,\n\t\t\t\tdataType: 'json',\n\t\t\t\tcache: false,\n\t\t\t\tasync: false,\n\t\t\t\tsuccess: function(data, textStatus, XMLHttpRequest) {\n\t\t\t\t\tif (data.length !== 0) {\n\t\t\t\t\t\t\$('#title').after('<div id=\"error\"><h5>" . _("Conflicting Extensions") . "</h5>' + data + '</div>');\n\t\t\t\t\t\tajax_result = false;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\terror: function(data) {\n\t\t\t\t\tconsole.log('an error was recevied: ' + data);\n\t\t\t\t\t// TODO: Should we stop the submital and do something here?\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (!ajax_result) {\n\t\t\t\talert('" . _("Extension number conflict, please choose another.") . "');\n\t\t\t\t\$('#extension').focus();\n\t\t\t\treturn false;\n\t\t\t}", 9);
        }
        $currentcomponent->addguielem($section, new gui_textbox('name', $name, _("Display Name"), _("The CallerID name for calls from this user will be set to this name. Only enter the name, NOT the number."), '(typeof isCorrectLengthExtensions != "undefined") ? !isCorrectLengthExtensions() || !isAlphanumeric() || isWhitespace() : !isAlphanumeric() || isWhitespace()', $msgInvalidDispName, false));
        $cid_masquerade = trim($cid_masquerade) == $extdisplay ? "" : $cid_masquerade;
        $currentcomponent->addguielem($section, new gui_textbox('cid_masquerade', $cid_masquerade, _("CID Num Alias"), _("The CID Number to use for internal calls, if different from the extension number. This is used to masquerade as a different user. A common example is a team of support people who would like their internal CallerID to display the general support number (a ringgroup or queue). There will be no effect on external calls."), '!isWhitespace() && !isInteger()', $msgInvalidCidNum, false));
        $currentcomponent->addguielem($section, new gui_textbox('sipname', $sipname, _("SIP Alias"), _("If you want to support direct sip dialing of users internally or through anonymous sip calls, you can supply a friendly name that can be used in addition to the users extension to call them.")));
        // If user mode, list devices associated with this user
        //
        if ($display == 'users' && trim($extdisplay != '')) {
            $section = _("User Devices");
            $device_list = core_devices_list('all', 'full');
            usort($device_list, 'dev_grp');
            $link_count = 0;
            foreach ($device_list as $device_item) {
                if ($device_item['user'] == $extdisplay) {
                    $editURL = '?display=devices&skip=0&extdisplay=' . $device_item['id'];
                    $device_icon = $device_item['devicetype'] == 'fixed' ? 'images/telephone_key.png' : 'images/telephone_edit.png';
                    $device_label = '&nbsp;';
                    $device_label .= _("Edit:");
                    $device_label .= '&nbsp;' . $device_item['id'] . '&nbsp;' . $device_item['description'];
                    $device_label = '<span>
					<img width="16" height="16" border="0" title="Edit Device" alt="Edit Device" src="' . $device_icon . '"/>' . $device_label . '</span> ';
                    $currentcomponent->addguielem($section, new gui_link('dev' . $link_count++, $device_label, $editURL, true, false), 2);
                }
            }
        }
        $section = _("Extension Options");
        $currentcomponent->addguielem($section, new gui_textbox('outboundcid', $outboundcid, _("Outbound CID"), _("Overrides the CallerID when dialing out a trunk. Any setting here will override the common outbound CallerID set in the Trunks admin.<br><br>Format: <b>\"caller name\" &lt;#######&gt;</b><br><br>Leave this field blank to disable the outbound CallerID feature for this user."), '!isCallerID()', $msgInvalidOutboundCID, true), 3);
        $ringtimer = isset($ringtimer) ? $ringtimer : '0';
        $dialopts = isset($dialopts) ? $dialopts : false;
        $disable_dialopts = $dialopts === false;
        $currentcomponent->addguielem($section, new gui_textbox_check('dialopts', $dialopts, _("Asterisk Dial Options"), _("Cryptic Asterisk Dial Options, check to customize for this extension or un-check to use system defaults set in Advanced Options. These will not apply to trunk options which are configured with the trunk."), '', '', true, 0, $disable_dialopts, '<small>' . _("Override") . '</small>', $amp_conf['DIAL_OPTIONS'], true));
        $currentcomponent->addguielem($section, new gui_selectbox('ringtimer', $currentcomponent->getoptlist('ringtime'), $ringtimer, _("Ring Time"), _("Number of seconds to ring prior to going to voicemail. Default will use the value set in Advanced Settings. If no voicemail is configured this will be ignored."), false));
        if (!isset($cfringtimer)) {
            if ($amp_conf['CFRINGTIMERDEFAULT'] < 0 || ctype_digit($amp_conf['CFRINGTIMERDEFAULT'])) {
                $cfringtimer = $amp_conf['CFRINGTIMERDEFAULT'] < 0 ? -1 : ($amp_conf['CFRINGTIMERDEFAULT'] > 120 ? 120 : $amp_conf['CFRINGTIMERDEFAULT']);
            } else {
                $cfringtimer = 0;
            }
        }
        $currentcomponent->addguielem($section, new gui_selectbox('cfringtimer', $currentcomponent->getoptlist('cfringtime'), $cfringtimer, _("Call Forward Ring Time"), _("Number of seconds to ring during a Call Forward, Call Forward Busy or Call Forward Unavailable call prior to continuing to voicemail or specified destination. Setting to Always will not return, it will just continue to ring. Default will use the current Ring Time. If voicemail is disabled and their is not destination specified, it will be forced into Always mode"), false));
        if (!isset($callwaiting)) {
            if ($amp_conf['ENABLECW']) {
                $callwaiting = 'enabled';
            } else {
                $callwaiting = 'disabled';
            }
        }
        $concurrency_limit = isset($concurrency_limit) ? $concurrency_limit : $amp_conf['CONCURRENCYLIMITDEFAULT'];
        $currentcomponent->addguielem($section, new gui_selectbox('concurrency_limit', $currentcomponent->getoptlist('concurrency_limit'), $concurrency_limit, _("Outbound Concurrency Limit"), _("Maximum number of outbound simultaneous calls that an extension can make. This is also very useful as a Security Protection against a system that has been compromised. It will limit the number of simultaneous calls that can be made on the compromised extension."), false));
        $currentcomponent->addguielem($section, new gui_selectbox('callwaiting', $currentcomponent->getoptlist('callwaiting'), $callwaiting, _("Call Waiting"), _("Set the initial/current Call Waiting state for this user's extension"), false));
        if (function_exists('paging_get_config')) {
            $answermode = isset($answermode) ? $answermode : $amp_conf['DEFAULT_INTERNAL_AUTO_ANSWER'];
            $currentcomponent->addguielem($section, new gui_selectbox('answermode', $currentcomponent->getoptlist('answermode'), $answermode, _("Internal Auto Answer"), _("When set to Intercom, calls to this extension/user from other internal users act as if they were intercom calls meaning they will be auto-answered if the endpoint supports this feature and the system is configured to operate in this mode. All the normal white list and black list settings will be honored if they are set. External calls will still ring as normal, as will certain other circumstances such as blind transfers and when a Follow Me is configured and enabled. If Disabled, the phone rings as a normal phone."), false));
        }
        $currentcomponent->addguielem($section, new gui_selectbox('call_screen', $currentcomponent->getoptlist('call_screen'), $call_screen, _("Call Screening"), _("Call Screening requires external callers to say their name, which will be played back to the user and allow the user to accept or reject the call.  Screening with memory only verifies a caller for their CallerID once. Screening without memory always requires a caller to say their name. Either mode will always announce the caller based on the last introduction saved with that CallerID. If any user on the system uses the memory option, when that user is called, the caller will be required to re-introduce themselves and all users on the system will have that new introduction associated with the caller's CallerID."), false));
        $currentcomponent->addguielem($section, new gui_selectbox('pinless', $currentcomponent->getoptlist('pinless'), $pinless, _("Pinless Dialing"), _("Enabling Pinless Dialing will allow this extension to bypass any pin codes normally required on outbound calls"), false));
        $section = _("Assigned DID/CID");
        $currentcomponent->addguielem($section, new gui_textbox('newdid_name', $newdid_name, _("DID Description"), _("A description for this DID, such as \"Fax\"")), 4);
        $currentcomponent->addguielem($section, new gui_textbox('newdid', $newdid, _("Add Inbound DID"), _("A direct DID that is associated with this extension. The DID should be in the same format as provided by the provider (e.g. full number, 4 digits for 10x4, etc).<br><br>Format should be: <b>XXXXXXXXXX</b><br><br>.An optional CID can also be associated with this DID by setting the next box"), '!isDialpattern()', $msgInvalidDIDNum, true), 4);
        $currentcomponent->addguielem($section, new gui_textbox('newdidcid', $newdidcid, _("Add Inbound CID"), _("Add a CID for more specific DID + CID routing. A DID must be specified in the above Add DID box. In addition to standard dial sequences, you can also put Private, Blocked, Unknown, Restricted, Anonymous, Withheld and Unavailable in order to catch these special cases if the Telco transmits them."), "!frm_{$display}_isValidCID()", $msgInvalidCIDNum, true), 4);
        $dids = core_did_list('extension');
        $did_count = 0;
        foreach ($dids as $did) {
            $did_dest = preg_split('/,/', $did['destination']);
            if (isset($did_dest[1]) && $did_dest[1] === $extdisplay) {
                $did_title = $did['description'] != '' ? $did['description'] : _("DID / CID");
                $addURL = '?display=did&&extdisplay=' . $did['extension'] . '/' . $did['cidnum'];
                $did_icon = 'images/email_edit.png';
                $did_label = trim($did['extension']) == '' ? ' ' . _("Any DID") : ' ' . $did['extension'];
                if (trim($did['cidnum']) != '') {
                    $did_label .= ' / ' . $did['cidnum'];
                }
                if (trim($did['description']) != '') {
                    $did_label .= ' (' . $did['description'] . ')';
                }
                $did_label = '&nbsp;<span>
				<img width="16" height="16" border="0" title="' . $did_title . '" alt="" src="' . $did_icon . '"/>' . $did_label . '</span> ';
                $currentcomponent->addguielem($section, new gui_link('did_' . $did_count++, $did_label, $addURL, true, false), 4);
            }
        }
        $section = _("Recording Options");
        $recording_in_external = isset($recording_in_external) ? $recording_in_external : 'dontcare';
        $recording_out_external = isset($recording_out_external) ? $recording_out_external : 'dontcare';
        $recording_in_internal = isset($recording_in_internal) ? $recording_in_internal : 'dontcare';
        $recording_out_internal = isset($recording_out_internal) ? $recording_out_internal : 'dontcare';
        $recording_ondemand = isset($recording_ondemand) ? $recording_ondemand : 'disabled';
        $recording_priority = isset($recording_priority) ? $recording_priority : '10';
        $currentcomponent->addguielem($section, new gui_radio('recording_in_external', $currentcomponent->getoptlist('recording_options'), $recording_in_external, _('Inbound External Calls'), _("Recording of inbound calls from external sources.")));
        $currentcomponent->addguielem($section, new gui_radio('recording_out_external', $currentcomponent->getoptlist('recording_options'), $recording_out_external, _('Outbound External Calls'), _("Recording of outbound calls to external sources.")));
        $currentcomponent->addguielem($section, new gui_radio('recording_in_internal', $currentcomponent->getoptlist('recording_options'), $recording_in_internal, _('Inbound Internal Calls'), _("Recording of calls received from other extensions on the system.")));
        $currentcomponent->addguielem($section, new gui_radio('recording_out_internal', $currentcomponent->getoptlist('recording_options'), $recording_out_internal, _('Outbound Internal Calls'), _("Recording of calls made to other extensions on the system.")));
        $currentcomponent->addguielem($section, new gui_radio('recording_ondemand', $currentcomponent->getoptlist('recording_ondemand_options'), $recording_ondemand, _('On Demand Recording'), _("Enable or disable the ability to do on demand (one-touch) recording. The overall calling policy rules still apply and if calls are already being recorded by 'Force' or 'Never', the can not be paused unless 'Override' is selected..")));
        $currentcomponent->addguielem($section, new gui_selectbox('recording_priority', $currentcomponent->getoptlist('recording_priority_options'), $recording_priority, _("Record Priority Policy"), _("Call recording policy priority relative to other extensions when there is a conflict between an extension wanting recording and the other not wanting it. The higher of the two determines the policy, on a tie the global policy (caller or callee) determines the policy."), false));
        $section = _("Optional Destinations");
        $noanswer_dest = isset($noanswer_dest) ? $noanswer_dest : '';
        $busy_dest = isset($busy_dest) ? $busy_dest : '';
        $chanunavail_dest = isset($chanunavail_dest) ? $chanunavail_dest : '';
        $noanswer_cid = isset($noanswer_cid) ? $noanswer_cid : '';
        $busy_cid = isset($busy_cid) ? $busy_cid : '';
        $chanunavail_cid = isset($chanunavail_cid) ? $chanunavail_cid : '';
        if ($amp_conf['CWINUSEBUSY']) {
            $helptext = _('Optional destination call is routed to when the call is not answered on an otherwise idle phone. If the phone is in use and the call is simply ignored, then the busy destination will be used.');
        } else {
            $helptext = _('Optional destination call is routed to when the call is not answered.');
        }
        $nodest_msg = _('Unavail Voicemail if Enabled');
        $currentcomponent->addguielem($section, new gui_drawselects('noanswer_dest', '0', $noanswer_dest, _('No Answer'), $helptext, false, '', $nodest_msg), 5, 9);
        $currentcomponent->addguielem($section, new gui_textbox('noanswer_cid', $noanswer_cid, '&nbsp;&nbsp;' . _("CID Prefix"), _("Optional CID Prefix to add before sending to this no answer destination.")), 5, 9);
        if ($amp_conf['CWINUSEBUSY']) {
            $helptext = _('Optional destination the call is routed to when the phone is busy or the call is rejected by the user. This destination is also used on an unanswered call if the phone is in use and the user chooses not to pickup the second call.');
        } else {
            $helptext = _('Optional destination the call is routed to when the phone is busy or the call is rejected by the user.');
        }
        $nodest_msg = _('Busy Voicemail if Enabled');
        $currentcomponent->addguielem($section, new gui_drawselects('busy_dest', '1', $busy_dest, _('Busy'), $helptext, false, '', $nodest_msg), 5, 9);
        $currentcomponent->addguielem($section, new gui_textbox('busy_cid', $busy_cid, '&nbsp;&nbsp;' . _("CID Prefix"), _("Optional CID Prefix to add before sending to this busy destination.")), 5, 9);
        $helptext = _('Optional destination the call is routed to when the phone is offline, such as a softphone currently off or a phone unplugged.');
        $nodest_msg = _('Unavail Voicemail if Enabled');
        $currentcomponent->addguielem($section, new gui_drawselects('chanunavail_dest', '2', $chanunavail_dest, _('Not Reachable'), $helptext, false, '', $nodest_msg), 5, 9);
        $currentcomponent->addguielem($section, new gui_textbox('chanunavail_cid', $chanunavail_cid, '&nbsp;&nbsp;' . _("CID Prefix"), _("Optional CID Prefix to add before sending to this not reachable destination.")), 5, 9);
    }
}