Example #1
0
function callrecording_hook_core($viewing_itemid, $target_menuid)
{
    switch ($target_menuid) {
        case 'did':
            $extension = isset($_REQUEST['extension']) ? $_REQUEST['extension'] : '';
            $cidnum = isset($_REQUEST['cidnum']) ? $_REQUEST['cidnum'] : '';
            $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : '';
            $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
            $callrecording = isset($_REQUEST['callrecording']) ? $_REQUEST['callrecording'] : '';
            //set $extension,$cidnum if we dont already have them
            if (!$extension && !$cidnum) {
                $opts = explode('/', $extdisplay);
                $extension = $opts['0'];
                $cidnum = isset($opts['1']) ? $opts['1'] : '';
            } else {
                $extension = $extension;
                $cidnum = $cidnum;
            }
            //update if we have enough info
            if ($action == 'edtIncoming' || ($extension != '' || $cidnum != '') && $callrecording != '') {
                callrecording_display_update('did', $callrecording, $extension, $cidnum);
            }
            if ($action == 'delIncoming') {
                callrecording_display_delete('did', $extension, $cidnum);
            }
            $callrecording = callrecording_display_get($target_menuid, $extension, $cidnum);
            break;
        case 'routing':
            $route_id = isset($_REQUEST['route_id']) ? $_REQUEST['route_id'] : (isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : '');
            if (!empty($_SESSION['callrecordingAddRoute'])) {
                $callrecording = $_SESSION['callrecordingAddRoute'];
            } else {
                $callrecording = callrecording_display_get($target_menuid, $route_id);
            }
            break;
    }
    $html = '';
    //if ($target_menuid == 'did'){
    if ($target_menuid == 'did' || $target_menuid == 'routing') {
        global $tabindex;
        if ($target_menuid == 'did') {
            $html .= '<tr><td colspan="2"><h5>' . _("Call Recording") . '<hr></h5></td></tr>';
        }
        $html .= '<tr><td colspan=2><p>' . _("Note that the meaning of these options has changed.") . " <a href='http://wiki.freepbx.org/display/F2/Call+Recording+walk+through'>" . _("Please read the wiki for futher information on these changes.") . "</a></p></td></tr>\n";
        $html .= '<tr><td><a href="#" class="info">' . _('Call Recording') . '<span>' . _("This sets the call recording behavior for calls coming into this DID. Please read the wiki for information on what these settings mean.") . '</span></a>:</td>';
        $html .= '<td><span class="radioset">';
        // Fix any old options.
        if ($callrecording == "delayed") {
            $callrecording = "yes";
        }
        if ($callrecording == "") {
            $callrecording = "dontcare";
        }
        $options = array(_("Force") => "force", _("Yes") => "yes", _("Don't Care") => "dontcare", _("No") => "no", _("Never") => "never");
        foreach ($options as $disp => $name) {
            if ($callrecording == $name) {
                $checked = "checked";
            } else {
                $checked = "";
            }
            $html .= "<input type='radio' id='record_{$name}' name='callrecording' value='{$name}' {$checked}><label for='record_{$name}'>{$disp}</label>";
        }
        $html .= "</span></td>\n";
    }
    return $html;
}
function callrecording_hook_core($viewing_itemid, $target_menuid)
{
    switch ($target_menuid) {
        case 'did':
            $extension = isset($_REQUEST['extension']) ? $_REQUEST['extension'] : '';
            $cidnum = isset($_REQUEST['cidnum']) ? $_REQUEST['cidnum'] : '';
            $extdisplay = isset($_REQUEST['extdisplay']) ? $_REQUEST['extdisplay'] : '';
            $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
            $callrecording = isset($_REQUEST['callrecording']) ? $_REQUEST['callrecording'] : '';
            //set $extension,$cidnum if we dont already have them
            if (!$extension && !$cidnum) {
                $opts = explode('/', $extdisplay);
                $extension = $opts['0'];
                $cidnum = isset($opts['1']) ? $opts['1'] : '';
            } else {
                $extension = $extension;
                $cidnum = $cidnum;
            }
            //update if we have enough info
            if ($action == 'edtIncoming' || ($extension != '' || $cidnum != '') && $callrecording != '') {
                callrecording_display_update('did', $callrecording, $extension, $cidnum);
            }
            if ($action == 'delIncoming') {
                callrecording_display_delete('did', $extension, $cidnum);
            }
            $callrecording = callrecording_display_get($target_menuid, $extension, $cidnum);
            $helptext = _("This sets the call recording behavior for calls coming into this DID. Please read the wiki for information on what these settings mean.");
            break;
        case 'routing':
            $request = $_REQUEST;
            $request['route_id'] = isset($request['id']) ? $request['id'] : '';
            $route_id = isset($request['route_id']) ? $request['route_id'] : (isset($request['extdisplay']) ? $request['extdisplay'] : '');
            if (!empty($_SESSION['callrecordingAddRoute'])) {
                $callrecording = $_SESSION['callrecordingAddRoute'];
            } else {
                $callrecording = callrecording_display_get($target_menuid, $route_id);
            }
            $helptext = _("This sets the call recording behavior for calls going out this route. Please read the wiki for information on what these settings mean.");
            break;
    }
    $html = '';
    //if ($target_menuid == 'did'){
    if ($target_menuid == 'did' || $target_menuid == 'routing') {
        global $tabindex;
        $html = '<!--CALL RECORDING HOOK-->';
        $html .= '<div class="well well-info">';
        $html .= _("Note that the meaning of these options has changed.") . " <a href='http://wiki.freepbx.org/display/FPG/Call+Recording+walk+through'>" . _("Please read the wiki for futher information on these changes.") . '</a>';
        $html .= '</div>';
        $html .= '<div class="element-container">';
        $html .= '<div class="row">';
        $html .= '<div class="col-md-12">';
        $html .= '<div class="row">';
        $html .= '<div class="form-group">';
        $html .= '<div class="col-md-3">';
        $html .= '<label class="control-label" for="crwrapper">' . _("Call Recording") . '</label>';
        $html .= '<i class="fa fa-question-circle fpbx-help-icon" data-for="crwrapper"></i>';
        $html .= '</div>';
        $html .= '<div class="col-md-9 radioset">';
        // Fix any old options.
        if ($callrecording == "delayed") {
            $callrecording = "yes";
        }
        if ($callrecording == "") {
            $callrecording = "dontcare";
        }
        $options = array(_("Force") => "force", _("Yes") => "yes", _("Don't Care") => "dontcare", _("No") => "no", _("Never") => "never");
        foreach ($options as $disp => $name) {
            if ($callrecording == $name) {
                $checked = "checked";
            } else {
                $checked = "";
            }
            $html .= "<input type='radio' id='record_{$name}' name='callrecording' value='{$name}' {$checked}><label for='record_{$name}'>{$disp}</label>";
        }
        $html .= '</div>';
        $html .= '</div>';
        $html .= '</div>';
        $html .= '</div>';
        $html .= '</div>';
        $html .= '<div class="row">';
        $html .= '<div class="col-md-12">';
        $html .= '<span id="crwrapper-help" class="help-block fpbx-help-block">' . $helptext . '</span>';
        $html .= '</div>';
        $html .= '</div>';
        $html .= '</div>';
        $html .= '<!--END CALL RECORDING HOOK-->';
    }
    return $html;
}