2006-04-21_snapshot

git-svn-id: svn://192.168.202.10@5 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2006-07-07 15:17:45 +00:00
parent 4862328b6e
commit dcbe8f2faa
54 changed files with 2283 additions and 1461 deletions
+114 -93
View File
@@ -1,107 +1,128 @@
<?
### manager_send.php
###
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
###
### This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server
### This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
###
### required variables:
### - $server_ip
### - $session_name
### - $user
### - $pass
### optional variables:
### - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectVD','HangupConfDial')
### - $queryCID - ('CN012345678901234567',...)
### - $format - ('text','debug')
### - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...)
### - $exten - ('1234','913125551212',...)
### - $ext_context - ('default','demo',...)
### - $ext_priority - ('1','2',...)
### - $filename - ('20050406-125623_44444',...)
### - $extenName - ('phone100',...)
### - $parkedby - ('phone100',...)
### - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...)
### - $auto_dial_level - ('0','1','1.1',...)
### - $campaign - ('CLOSER','TESTCAMP',...)
### - $uniqueid - ('1120232758.2406800',...)
### - $lead_id - ('1234',...)
### - $seconds - ('32',...)
### - $outbound_cid - ('3125551212','0000000000',...)
### - $agent_log_id - ('123456',...)
### - $call_server_ip - ('10.10.10.15',...)
### - $CalLCID - ('VD01234567890123456',...)
###
# manager_send.php
#
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
# This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
#
# required variables:
# - $server_ip
# - $session_name
# - $user
# - $pass
# optional variables:
# - $ACTION - ('Originate','Redirect','Hangup','Command','Monitor','StopMonitor','SysCIDOriginate','RedirectName','RedirectNameVmail','MonitorConf','StopMonitorConf','RedirectXtra','RedirectVD','HangupConfDial')
# - $queryCID - ('CN012345678901234567',...)
# - $format - ('text','debug')
# - $channel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...)
# - $exten - ('1234','913125551212',...)
# - $ext_context - ('default','demo',...)
# - $ext_priority - ('1','2',...)
# - $filename - ('20050406-125623_44444',...)
# - $extenName - ('phone100',...)
# - $parkedby - ('phone100',...)
# - $extrachannel - ('Zap/41-1','SIP/test101-1jut','IAX2/iaxy@iaxy',...)
# - $auto_dial_level - ('0','1','1.1',...)
# - $campaign - ('CLOSER','TESTCAMP',...)
# - $uniqueid - ('1120232758.2406800',...)
# - $lead_id - ('1234',...)
# - $seconds - ('32',...)
# - $outbound_cid - ('3125551212','0000000000',...)
# - $agent_log_id - ('123456',...)
# - $call_server_ip - ('10.10.10.15',...)
# - $CalLCID - ('VD01234567890123456',...)
#
# changes
# 50401-1002 First build of script, Hangup function only
# 50404-1045 Redirect basic function enabled
# 50406-1522 Monitor basic function enabled
# 50407-1647 Monitor and StopMonitor full functions enabled
# 50422-1120 basic Originate function enabled
# 50428-1451 basic SysCIDOriginate function enabled for checking voicemail
# 50502-1539 basic RedirectName and RedirectNameVmail added
# 50503-1227 added session_name checking for extra security
# 50523-1341 added Conference call start/stop recording
# 50523-1421 added OriginateName and OriginateNameVmail for local calls
# 50524-1602 added RedirectToPark and RedirectFromPark
# 50531-1203 added RedirecXtra for dual channel redirection
# 50630-1100 script changed to not use HTTP login vars, user/pass instead
# 50804-1148 Added RedirectVD for VICIDIAL blind redirection with logging
# 50815-1204 Added NEXTAVAILABLE to RedirectXtra function
# 50903-2343 Added HangupConfDial function to hangup in-dial channels in conf
# 50913-1057 Added outbound_cid set if present to originate call
# 51020-1556 Added agent_log_id framework for detailed agent activity logging
# 51118-1204 Fixed Blind transfer bug from VICIDIAL when in manual dial mode
# 51129-1014 Added ability to accept calls from other VICIDIAL servers
# 51129-1253 Fixed Hangups of other agents channels in VICIDIAL AD
# 60310-2022 Fixed NEXTAVAILABLE bug in leave-3way-call redirect function
# 50401-1002 - First build of script, Hangup function only
# 50404-1045 - Redirect basic function enabled
# 50406-1522 - Monitor basic function enabled
# 50407-1647 - Monitor and StopMonitor full functions enabled
# 50422-1120 - basic Originate function enabled
# 50428-1451 - basic SysCIDOriginate function enabled for checking voicemail
# 50502-1539 - basic RedirectName and RedirectNameVmail added
# 50503-1227 - added session_name checking for extra security
# 50523-1341 - added Conference call start/stop recording
# 50523-1421 - added OriginateName and OriginateNameVmail for local calls
# 50524-1602 - added RedirectToPark and RedirectFromPark
# 50531-1203 - added RedirecXtra for dual channel redirection
# 50630-1100 - script changed to not use HTTP login vars, user/pass instead
# 50804-1148 - Added RedirectVD for VICIDIAL blind redirection with logging
# 50815-1204 - Added NEXTAVAILABLE to RedirectXtra function
# 50903-2343 - Added HangupConfDial function to hangup in-dial channels in conf
# 50913-1057 - Added outbound_cid set if present to originate call
# 51020-1556 - Added agent_log_id framework for detailed agent activity logging
# 51118-1204 - Fixed Blind transfer bug from VICIDIAL when in manual dial mode
# 51129-1014 - Added ability to accept calls from other VICIDIAL servers
# 51129-1253 - Fixed Hangups of other agents channels in VICIDIAL AD
# 60310-2022 - Fixed NEXTAVAILABLE bug in leave-3way-call redirect function
# 60421-1413 - check GET/POST vars lines with isset to not trigger PHP NOTICES
#
require("dbconnect.php");
#require_once("htglobalize.php");
### These are variable assignments for PHP globals off
$user=$_GET["user"]; if (!$user) {$user=$_POST["user"];}
$pass=$_GET["pass"]; if (!$pass) {$pass=$_POST["pass"];}
$server_ip=$_GET["server_ip"]; if (!$server_ip) {$server_ip=$_POST["server_ip"];}
$session_name=$_GET["session_name"]; if (!$session_name) {$session_name=$_POST["session_name"];}
$ACTION=$_GET["ACTION"]; if (!$ACTION) {$ACTION=$_POST["ACTION"];}
$queryCID=$_GET["queryCID"]; if (!$queryCID) {$queryCID=$_POST["queryCID"];}
$format=$_GET["format"]; if (!$format) {$format=$_POST["format"];}
$channel=$_GET["channel"]; if (!$channel) {$channel=$_POST["channel"];}
$exten=$_GET["exten"]; if (!$exten) {$exten=$_POST["exten"];}
$ext_context=$_GET["ext_context"]; if (!$ext_context) {$ext_context=$_POST["ext_context"];}
$ext_priority=$_GET["ext_priority"]; if (!$ext_priority) {$ext_priority=$_POST["ext_priority"];}
$filename=$_GET["filename"]; if (!$filename) {$filename=$_POST["filename"];}
$extenName=$_GET["extenName"]; if (!$extenName) {$extenName=$_POST["extenName"];}
$parkedby=$_GET["parkedby"]; if (!$parkedby) {$parkedby=$_POST["parkedby"];}
$extrachannel=$_GET["extrachannel"]; if (!$extrachannel) {$extrachannel=$_POST["extrachannel"];}
$auto_dial_level=$_GET["auto_dial_level"]; if (!$auto_dial_level) {$auto_dial_level=$_POST["auto_dial_level"];}
$campaign=$_GET["campaign"]; if (!$campaign) {$campaign=$_POST["campaign"];}
$uniqueid=$_GET["uniqueid"]; if (!$uniqueid) {$uniqueid=$_POST["uniqueid"];}
$lead_id=$_GET["lead_id"]; if (!$lead_id) {$lead_id=$_POST["lead_id"];}
$secondS=$_GET["secondS"]; if (!$secondS) {$secondS=$_POST["secondS"];}
$outbound_cid=$_GET["outbound_cid"]; if (!$outbound_cid) {$outbound_cid=$_POST["outbound_cid"];}
$agent_log_id=$_GET["agent_log_id"]; if (!$agent_log_id) {$agent_log_id=$_POST["agent_log_id"];}
$call_server_ip=$_GET["call_server_ip"]; if (!$call_server_ip) {$call_server_ip=$_POST["call_server_ip"];}
$CalLCID=$_GET["CalLCID"]; if (!$CalLCID) {$CalLCID=$_POST["CalLCID"];}
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
if (isset($_GET["ACTION"])) {$ACTION=$_GET["ACTION"];}
elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];}
if (isset($_GET["queryCID"])) {$queryCID=$_GET["queryCID"];}
elseif (isset($_POST["queryCID"])) {$queryCID=$_POST["queryCID"];}
if (isset($_GET["format"])) {$format=$_GET["format"];}
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
if (isset($_GET["channel"])) {$channel=$_GET["channel"];}
elseif (isset($_POST["channel"])) {$channel=$_POST["channel"];}
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];}
elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];}
if (isset($_GET["ext_priority"])) {$ext_priority=$_GET["ext_priority"];}
elseif (isset($_POST["ext_priority"])) {$ext_priority=$_POST["ext_priority"];}
if (isset($_GET["filename"])) {$filename=$_GET["filename"];}
elseif (isset($_POST["filename"])) {$filename=$_POST["filename"];}
if (isset($_GET["extenName"])) {$extenName=$_GET["extenName"];}
elseif (isset($_POST["extenName"])) {$extenName=$_POST["extenName"];}
if (isset($_GET["parkedby"])) {$parkedby=$_GET["parkedby"];}
elseif (isset($_POST["parkedby"])) {$parkedby=$_POST["parkedby"];}
if (isset($_GET["extrachannel"])) {$extrachannel=$_GET["extrachannel"];}
elseif (isset($_POST["extrachannel"])) {$extrachannel=$_POST["extrachannel"];}
if (isset($_GET["auto_dial_level"])) {$auto_dial_level=$_GET["auto_dial_level"];}
elseif (isset($_POST["auto_dial_level"])) {$auto_dial_level=$_POST["auto_dial_level"];}
if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["secondS"])) {$secondS=$_GET["secondS"];}
elseif (isset($_POST["secondS"])) {$secondS=$_POST["secondS"];}
if (isset($_GET["outbound_cid"])) {$outbound_cid=$_GET["outbound_cid"];}
elseif (isset($_POST["outbound_cid"])) {$outbound_cid=$_POST["outbound_cid"];}
if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];}
elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];}
if (isset($_GET["call_server_ip"])) {$call_server_ip=$_GET["call_server_ip"];}
elseif (isset($_POST["call_server_ip"])) {$call_server_ip=$_POST["call_server_ip"];}
if (isset($_GET["CalLCID"])) {$CalLCID=$_GET["CalLCID"];}
elseif (isset($_POST["CalLCID"])) {$CalLCID=$_POST["CalLCID"];}
# default optional vars if not set
if (!$ACTION) {$ACTION="Originate";}
if (!$format) {$format="alert";}
if (!$ext_priority) {$ext_priority="1";}
if (!isset($ACTION)) {$ACTION="Originate";}
if (!isset($format)) {$format="alert";}
if (!isset($ext_priority)) {$ext_priority="1";}
$version = '0.0.22';
$build = '60310-2022';
$version = '0.0.23';
$build = '60421-1413';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
if (!$query_date) {$query_date = $NOW_DATE;}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
if ($DB) {echo "|$stmt|\n";}
@@ -109,7 +130,7 @@ if (!$query_date) {$query_date = $NOW_DATE;}
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($user)<2) or (strlen($pass)<2) or (!$auth))
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
{
echo "Invalid Username/Password: |$user|$pass|\n";
exit;
@@ -117,7 +138,7 @@ if (!$query_date) {$query_date = $NOW_DATE;}
else
{
if( ( (strlen($server_ip)<6) or (!$server_ip) ) or ( (strlen($session_name)<12) or (!$session_name) ) )
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
{
echo "Invalid server_ip: |$server_ip| or Invalid session_name: |$session_name|\n";
exit;
@@ -129,7 +150,7 @@ if (!$query_date) {$query_date = $NOW_DATE;}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$SNauth=$row[0];
if(!$SNauth)
if($SNauth==0)
{
echo "Invalid session_name: |$session_name|$server_ip|\n";
exit;