fixed problems with dialing local extensions in transfer-conf in vicidial.php

affects vicidial.php and AST_manager_listen.pl
must wait two seconds to answer phone due to Asterisk manager limitations

git-svn-id: svn://192.168.202.10@251 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2006-09-06 20:15:16 +00:00
parent c9fa6dac88
commit 34415de64f
2 changed files with 74 additions and 4 deletions
+67
View File
@@ -265,6 +265,55 @@ while($one_day_interval > 0)
$ILcount=0;
foreach(@input_lines)
{
##### look for special vicidial conference call event #####
if ( ($input_lines[$ILcount] =~ /CallerIDName: DCagcW/) && ($input_lines[$ILcount] =~ /Event: Dial|State: Up/) )
{
### BEGIN 1.2.X tree versions
$input_lines[$ILcount] =~ s/^\n|^\n\n//gi;
@command_line=split(/\n/, $input_lines[$ILcount]);
if ($input_lines[$ILcount] =~ /Event: Dial/)
{
if ($command_line[3] =~ /Destination: /i)
{
$channel = $command_line[3];
$channel =~ s/Destination: |\s*$//gi;
$callid = $command_line[5];
$callid =~ s/CallerIDName: |\s*$//gi;
$callid =~ s/^\"//gi; $callid =~ s/\".*$//gi;
$uniqueid = $command_line[6];
$uniqueid =~ s/SrcUniqueID: |\s*$//gi;
$stmtA = "UPDATE vicidial_manager set status='UPDATED', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'";
if ($channel !~ /local/i)
{
print STDERR "|$stmtA|\n";
my $affected_rows = $dbhA->do($stmtA);
if($DB){print "|$affected_rows Conference DIALs updated|\n";}
}
}
}
if ($input_lines[$ILcount] =~ /State: Up/)
{
if ($command_line[2] =~ /Channel: /i)
{
$channel = $command_line[2];
$channel =~ s/Channel: |\s*$//gi;
$callid = $command_line[5];
$callid =~ s/CallerIDName: |\s*$//gi;
$callid =~ s/^\"//gi; $callid =~ s/\".*$//gi;
$uniqueid = $command_line[6];
$uniqueid =~ s/SrcUniqueID: |\s*$//gi;
$stmtA = "UPDATE vicidial_manager set status='UPDATED', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid' and status='SENT';";
print STDERR "|$stmtA|\n";
my $affected_rows = $dbhA->do($stmtA);
if($DB){print "|$affected_rows Conference DIALs updated|\n";}
}
}
### END 1.2.X tree versions
}
##### parse through all other important events #####
if ( ($input_lines[$ILcount] =~ /State: Ringing|State: Up|State: Dialing|Event: Newstate|Event: Hangup|Event: Newcallerid|Event: Shutdown/) && ($input_lines[$ILcount] !~ /ZOMBIE/) )
{
$input_lines[$ILcount] =~ s/^\n|^\n\n//gi;
@@ -479,6 +528,7 @@ while($one_day_interval > 0)
$channel =~ s/Channel: |\s*$//gi;
$callid = $command_line[5];
$callid =~ s/Callerid: |\s*$//gi;
# $callid =~ s/CallerIDName: |\s*$//gi;
$callid =~ s/^\"//gi; $callid =~ s/\".*$//gi;
$uniqueid = $command_line[6];
$uniqueid =~ s/Uniqueid: |\s*$//gi;
@@ -490,6 +540,23 @@ while($one_day_interval > 0)
if($DB){print "|$affected_rows RINGINGs updated|\n";}
}
}
# if ( ($command_line[2] =~ /^Channel: /i) && ($command_line[5] =~ /^Uniqueid: /i) ) ### post 2006-06-21 SVN -- Changed from CallerID to CallerIDName
# {
# $channel = $command_line[2];
# $channel =~ s/Channel: |\s*$//gi;
# $callid = $command_line[4];
# $callid =~ s/CallerIDName: |\s*$//gi;
# $callid =~ s/^\"//gi; $callid =~ s/\".*$//gi;
# $uniqueid = $command_line[5];
# $uniqueid =~ s/Uniqueid: |\s*$//gi;
# $stmtA = "UPDATE vicidial_manager set status='UPDATED', channel='$channel', uniqueid = '$uniqueid' where server_ip = '$server_ip' and callerid = '$callid'";
# if ($channel =~ /local/i)
# {
# print STDERR "|$stmtA|\n";
# my $affected_rows = $dbhA->do($stmtA);
# if($DB){print "|$affected_rows RINGINGs updated|\n";}
# }
# }
}
}
+7 -4
View File
@@ -1555,7 +1555,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
}
}
if (taskFromConf == 'YES')
{basic_originate_call(manual_string,'NO','YES',dial_conf_exten);}
{basic_originate_call(manual_string,'NO','YES',dial_conf_exten,'NO',taskFromConf);}
else
{basic_originate_call(manual_string,'NO','NO');}
@@ -1564,7 +1564,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
// ################################################################################
// Send Originate command to manager to place a phone call
function basic_originate_call(tasknum,taskprefix,taskreverse,taskdialvalue,tasknowait)
function basic_originate_call(tasknum,taskprefix,taskreverse,taskdialvalue,tasknowait,taskconfxfer)
{
var xmlhttp=false;
/*@cc_on @*/
@@ -1633,7 +1633,10 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
}
var originatevalue = protodial + "/" + extendial;
}
var queryCID = "DVagcW" + epoch_sec + user_abb;
if (taskconfxfer == 'YES')
{var queryCID = "DCagcW" + epoch_sec + user_abb;}
else
{var queryCID = "DVagcW" + epoch_sec + user_abb;}
VMCoriginate_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Originate&format=text&channel=" + originatevalue + "&queryCID=" + queryCID + "&exten=" + orig_prefix + "" + dialnum + "&ext_context=" + ext_context + "&ext_priority=1&outbound_cid=" + campaign_cid;
xmlhttp.open('POST', 'manager_send.php');
@@ -2548,7 +2551,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
{
XDuniqueid = MDlookResponse_array[0];
XDchannel = MDlookResponse_array[1];
if ( (XDchannel.match(regMDL)) && (asterisk_version != '1.0.8') && (asterisk_version != '1.0.9') )
if ( (XDchannel.match(regMDL)) && (asterisk_version != '1.0.8') && (asterisk_version != '1.0.9') && (MD_ring_secondS < 10) )
{
// bad grab of Local channel, try again
MD_ring_secondS++;