/asterisk-stats/trunk/originate_call.php |
---|
9,14 → 9,12 |
$dst = $_POST['dst']; |
try { |
$ast = new Net_AsteriskManager(array( |
'server' => $g_config['mgr_host'], |
'port' => $g_config['mgr_port'])); |
$ast = new Net_AsteriskManager(array('server' => $mgr_host, 'port' => $mgr_port)); |
$ast->connect(); |
$ast->login($g_config['mgr_user'], $g_config['mgr_password']); |
$ast->login($mgr_user, $mgr_password); |
$ast->originateCall($dst, $g_config['mgr_channel'] . "/$src", $g_config['mgr_context'], $src); |
$ast->originateCall($dst, "$mgr_channel/$src", $mgr_context, $src); |
$g_display->add_text("A call from $src to $dst is originated"); |
} |
catch(PEAR_Exception $e) { |
/asterisk-stats/trunk/includes/config.php-dist |
---|
1,24 → 1,22 |
<?php |
$g_config['db_type'] = 'PGSQL'; |
$g_config['db_host'] = 'localhost'; |
$g_config['db_user'] = 'astweb'; |
$g_config['db_password'] = 'password1'; |
$g_config['db_database'] = 'asterisk'; |
$db_type = 'PGSQL'; |
$db_host = 'localhost'; |
$db_user = 'astweb'; |
$db_password = 'password'; |
$db_database = 'asterisk'; |
$g_config['mgr_host'] = 'localhost'; |
$g_config['mgr_port'] = 5038; |
$g_config['mgr_user'] = 'originator'; |
$g_config['mgr_password'] = 'password2'; |
$g_config['mgr_channel'] = 'SIP'; |
$g_config['mgr_context'] = 'default'; |
$mgr_host = 'localhost'; |
$mgr_port = 5038; |
$mgr_user = 'originator'; |
$mgr_password = 'password2'; |
$mgr_channel = 'SIP'; |
$mgr_context = 'default'; |
$g_config['originate_src'] = 'I'; // which 'entry_title' may originate a call |
// any local specific query for list of calls |
function CdrBaseQueryWhere() |
// any local specific query |
function BaseQuery() |
{ |
return " (dcontext is null or dcontext != 'incoming_fix_callerid' and dcontext != 'incoming_delayed')"; |
return " (dstchannel is null or dstchannel != '')"; |
} |
?> |
/asterisk-stats/trunk/includes/defaults.php |
---|
1,14 → 1,12 |
<?php |
$g_config = array( |
'site_title' => 'Asterisk Web Interface', |
'site_style' => 'style.css', |
$g_site_title = 'Asterisk Web Interface'; |
$g_site_style = 'style.css'; |
'db_type' => 'PGSQL', |
'db_host' => 'localhost', |
'db_user' => 'astweb', |
'db_password' => 'password', |
'db_database' => 'asterisk', |
); |
$db_type = 'PGSQL'; |
$db_host = 'localhost'; |
$db_user = 'astweb'; |
$db_password = 'password'; |
$db_database = 'asterisk'; |
?> |
/asterisk-stats/trunk/includes/common.php |
---|
19,14 → 19,14 |
function ShowMenu($display) |
{ |
global $g_config; |
global $g_site_style, $g_site_title; |
$display->add_template('menu'); |
$display->add_variables(array( |
'AST_STYLESHEET' => $g_config['site_style'], |
'AST_SITETITLE' => $g_config['site_title'], |
'AST_DATETIME' => date('Y-m-d H:i:s'), |
'AST_STYLESHEET' => $g_site_style, |
'AST_SITETITLE' => $g_site_title, |
'AST_DATETIME' => date('Y-m-d H:i:s'), |
)); |
} |
/asterisk-stats/trunk/includes/db.php |
---|
12,13 → 12,12 |
# more information. # |
#################################################### |
switch($g_config['db_type']) { |
switch($db_type) { |
case 'PGSQL': |
include('includes/db/postgresql.php'); |
break; |
} |
$db = new db_obj($g_config['db_host'], $g_config['db_user'], |
$g_config['db_password'], $g_config['db_database']); |
$db = new db_obj($db_host, $db_user, $db_password, $db_database); |
?> |
/asterisk-stats/trunk/originate_form.php |
---|
11,7 → 11,7 |
. " from telbook_entries join telbook_persons on person_id=entry_person" |
. " where entry_title=$1" |
. " order by person_name, entry_title, entry_value", |
array($g_config['originate_src'])); |
array('I')); |
$src_list = ""; |
while($line = $db->fetch_row()) { |
/asterisk-stats/trunk/cdr_list.php |
---|
43,7 → 43,7 |
} |
# Construct Query Here |
$query = CdrBaseQueryWhere(); |
$query = BaseQuery(); |
$params = array(); |
$active = false; |
/asterisk-stats/trunk/index.php |
---|
7,7 → 7,7 |
{ |
global $db, $g_display; |
$query = "select count(acctid), sum(billsec) from cdr where" . CdrBaseQueryWhere() |
$query = "select count(acctid), sum(billsec) from cdr where" . BaseQuery() |
. ($interval ? " and date_trunc('" . $interval . "', calldate)" |
. ($diff ? " + interval '$diff $interval'" : "") . " = date_trunc('" |
. $interval . "', current_date)" : ""); |
19,7 → 19,7 |
# active calls |
$db->query("select count(acctid), sum(extract(epoch from date_trunc('second',current_timestamp-linkdate)))" |
. " from activecalls where" . CdrBaseQueryWhere() . " and duration is null"); |
. " from activecalls where" . BaseQuery() . " and duration is null"); |
$db->fetch_row_idx(); |
$g_display->add_variables(array('CS_ACTIVE' => $db->get_field(0), |
'CS_ACTIVE_DUR' => FormatDuration($db->get_field(1)))); |