예제 #1
0
function skipDiallist($dialnumber, $diallistid)
{
    global $locate;
    $objResponse = new xajaxResponse();
    $row = astercrm::getRecordByID($diallistid, 'diallist');
    if ($row['dialnumber'] != '') {
        $row['callresult'] = 'skip';
        astercrm::deleteRecord($row['id'], "diallist");
        $row['dialednumber'] = $phoneNum;
        $row['dialedby'] = $_SESSION['curuser']['extension'];
        $row['trytime'] = $row['trytime'] + 1;
        astercrm::insertNewDialedlist($row);
    } else {
        $objResponse->addAlert($locate->translate("Option failed"));
        return $objResponse;
    }
    $objResponse->addScript("xajax_clearPopup()");
    $objResponse->loadXML(getPrivateDialListNumber($_SESSION['curuser']['extension']));
    return $objResponse;
}
예제 #2
-1
function placeCall($campaignid)
{
    global $config;
    $myAsterisk = new Asterisk();
    $row =& astercrm::getDialNumber($campaignid);
    // 待拨号码为空
    if (!$row) {
        return false;
    }
    //print_r($row);
    $id = $row['id'];
    $groupid = $row['groupid'];
    $campaignid = $row['campaignid'];
    $phoneNum = $row['dialnumber'];
    $trytime = $row['trytime'];
    $assign = $row['assign'];
    $pdcontext = $row['incontext'];
    $outcontext = $row['outcontext'];
    if ($row['inexten'] != "") {
        $pdextension = $row['inexten'];
    } else {
        if ($row['assign'] != "") {
            $pdextension = $row['assign'];
        } else {
            $pdextension = $row['dialnumber'];
        }
    }
    $res = astercrm::deleteRecord($id, "diallist");
    $f['dialednumber'] = $phoneNum;
    $f['dialedby'] = $_SESSION['curuser']['username'];
    $f['groupid'] = $groupid;
    $f['trytime'] = $trytime + 1;
    $f['assign'] = $assign;
    $f['campaignid'] = $campaignid;
    $res = astercrm::insertNewDialedlist($f);
    $actionid = md5(uniqid(""));
    $strChannel = "local/" . $phoneNum . "@" . $outcontext . "/n";
    if ($config['system']['allow_dropcall'] == true) {
        $myAsterisk->dropCall($actionid, array('Channel' => "{$strChannel}", 'WaitTime' => 30, 'Exten' => $pdextension, 'Context' => $pdcontext, 'Variable' => "{$strVariable}", 'Priority' => 1, 'MaxRetries' => 0, 'CallerID' => $phoneNum));
    } else {
        $myAsterisk->config['asmanager'] = $config['asterisk'];
        $res = $myAsterisk->connect();
        $myAsterisk->sendCall($strChannel, $pdextension, $pdcontext, 1, NULL, NULL, 30, $phoneNum, NULL, NULL, NULL, $actionid);
    }
    return true;
}