/** * check if there's new event happen * */ function transfer($aFormValues) { global $config; $myAsterisk = new Asterisk(); $myAsterisk->config['asmanager'] = $config['asterisk']; $res = $myAsterisk->connect(); $objResponse = new xajaxResponse(); if ($aFormValues['iptTtansfer'] != '') { $action = $aFormValues['iptTtansfer']; } elseif ($aFormValues['sltExten'] != '') { $action = $aFormValues['sltExten']; } else { return $objResponse; } if ($aFormValues['direction'] == 'in') { $myAsterisk->Redirect($aFormValues['callerChannel'], '', $action, $config['system']['outcontext'], 1); } else { $myAsterisk->Redirect($aFormValues['calleeChannel'], '', $action, $config['system']['outcontext'], 1); } $objResponse->addAssign("divMsg", "style.visibility", "hidden"); return $objResponse; }
function bargeInvite($srcchan, $dstchan, $exten) { //echo $srcchan,$dstchan,$exten;exit; global $config, $locate; $myAsterisk = new Asterisk(); $objResponse = new xajaxResponse(); $myAsterisk->config['asmanager'] = $config['asterisk']; $res = $myAsterisk->connect(); if (!$res) { return; } //$group_info = astercrm::getRecordByID($_SESSION['curuser']['groupid'],"astercrm_accountgroup"); if ($_SESSION['curuser']['group']['incontext'] != '') { $incontext = $_SESSION['curuser']['group']['incontext']; } else { $incontext = $config['system']['incontext']; } //if ($group_info['outcontext'] != '' ) $outcontext = $group_info['outcontext']; //else $outcontext = $config['system']['outcontext']; $strChannel = "local/" . $exten . "@" . $incontext . "/n"; $myAsterisk->Originate($strChannel, '', '', 1, 'meetme', $exten . $_SESSION['asterisk']['paramdelimiter'] . "pqdx", 30, $exten, NULL, NULL); $myAsterisk->Redirect($srcchan, $dstchan, $exten, "astercc-barge", "1"); //$objResponse->addAssign("divMsg", "style.visibility", "hidden"); return $objResponse; }
function barge($srcchan, $dstchan) { global $config, $locate; $myAsterisk = new Asterisk(); $objResponse = new xajaxResponse(); $myAsterisk->config['asmanager'] = $config['asterisk']; $res = $myAsterisk->connect(); if (!$res) { return; } $group_info = astercrm::getRecordByID($_SESSION['curuser']['groupid'], "astercrm_accountgroup"); if ($group_info['incontext'] != '') { $incontext = $group_info['incontext']; } else { $incontext = $config['system']['incontext']; } //if ($group_info['outcontext'] != '' ) $outcontext = $group_info['outcontext']; //else $outcontext = $config['system']['outcontext']; $strChannel = "local/" . $_SESSION['curuser']['extension'] . "@" . $incontext . "/n"; $myAsterisk->Originate($strChannel, '', '', 1, 'meetme', $_SESSION['curuser']['extension'] . $_SESSION['asterisk']['paramdelimiter'] . "pqdx", 30, $_SESSION['curuser']['extension'], NULL, $_SESSION['curuser']['accountcode']); $myAsterisk->Redirect($srcchan, $dstchan, $_SESSION['curuser']['extension'], "astercc-barge", "1"); return $objResponse; }