Checkdir.php Load page on 'answer' instead of 'ringing'
I'm trying to set FOP2 up so that only when a call is picked up, it'll open a certain web page. Currently the contents of the file are as follows:
<?php
require_once('config.php');
function custom_popup($ALLVAR) {
$clidnum = $ALLVAR;
$clidname = $ALLVAR;
$fromqueue = $ALLVAR;
$exten = $ALLVAR;
$poptype = $ALLVAR;
$clidname = base64_decode($ALLVAR);
$clidnum = base64_decode($ALLVAR);
header("Content-type: text/javascript");
echo "window.open('http://OurSugarCrmServer/crm/AsteriskSugDir.php?&search=$clidnum');\n";
return 0; // We still want regular notifications
}
$ret = custom_popup($_GET);
exit;
Header( "X-JSON: ({ 'clidnum': '$clidnum', 'clidname': '$clidname', 'picture': '$picture', 'queue': '$fromqueue' })");
?>
I'm no PHP coder, so I don't really know what to do at this point. I've tried changing the "If" section that was there from
if($ALLVAR=="ringing") {
to
if($ALLVAR=="answered") {
Of course it wasn't that easy. :roll:
So instead I just got rid of that statement and created this line to help me figure out what other 'poptype' values there were:
echo "window.open('http://$poptype');\n";
That didn't do anything for me.
I'm thinking I'll have to go further up the code tree to find whatever activates the checkdir.php file and set it to only use it when the call is answered instead of when it's ringing. I'm thinking that'll be the swf on the client though... Any Ideas?
Thanks!
--AkkerKid
<?php
require_once('config.php');
function custom_popup($ALLVAR) {
$clidnum = $ALLVAR;
$clidname = $ALLVAR;
$fromqueue = $ALLVAR;
$exten = $ALLVAR;
$poptype = $ALLVAR;
$clidname = base64_decode($ALLVAR);
$clidnum = base64_decode($ALLVAR);
header("Content-type: text/javascript");
echo "window.open('http://OurSugarCrmServer/crm/AsteriskSugDir.php?&search=$clidnum');\n";
return 0; // We still want regular notifications
}
$ret = custom_popup($_GET);
exit;
Header( "X-JSON: ({ 'clidnum': '$clidnum', 'clidname': '$clidname', 'picture': '$picture', 'queue': '$fromqueue' })");
?>
I'm no PHP coder, so I don't really know what to do at this point. I've tried changing the "If" section that was there from
if($ALLVAR=="ringing") {
to
if($ALLVAR=="answered") {
Of course it wasn't that easy. :roll:
So instead I just got rid of that statement and created this line to help me figure out what other 'poptype' values there were:
echo "window.open('http://$poptype');\n";
That didn't do anything for me.
I'm thinking I'll have to go further up the code tree to find whatever activates the checkdir.php file and set it to only use it when the call is answered instead of when it's ringing. I'm thinking that'll be the swf on the client though... Any Ideas?
Thanks!
--AkkerKid
Comments
The stock checkdir.php includes different code blocks (if else) for poptype "ringing" or "onconnect". But there is a really important thing to note, the connect popup only works when receiving AGENTCONNECT manager events. Those events are generated only for calls delivered from a queue and when that queue has the eventwhencalled=yes set.
It will NOT popup on connected calls that are not from the queue.
So, restore the stock checkdir.php , look at the if poptype "ringing", do not touch that part but look at the else, that block is the one you need to modify to output some javascript code for open a popup on connect.
Bet regards,
<?php
require_once('config.php');
function custom_popup($ALLVAR) {
// For Asternic Tag Call
if($ALLVAR=="onconnect") {
// RINGING NOTIFICATION
$clidnum = $ALLVAR;
$poptype = $ALLVAR;
$clidnum = base64_decode($ALLVAR);
header("Content-type: text/javascript");
echo "window.open('http://OurSugarCrmServer/crm/AsteriskSugDir.php?&search=$clidnum');\n";
} else {}
return 0;
}
exit;
?>
The subtext of Event When Called is "When this option is set to YES, the following manager events will be generated: AgentCalled, AgentDump, AgentConnect and AgentComplete." So I also tried "AgentConnect" in the IF statement where "onconnect" is thinking maybe my Trixbox server uses non-standard outputs. That didn't work either. Also, when I make changes in this file, should I restart the server or will the changes take effect as soon as I save?
The easiest way is to work your way in the stock checkdir.php instead of writing your own from scratch.
System Details:
Elastix 2.0.0-38
Asterisk 1.6.2.10
FOP2 2.21(final)
I've run into what appears to be the same problem. I can't generate a screen pop when a call is answered / connected from the queue. The screenpop only works on ringing.
queues_additional.conf has eventwhencalled = yes
fop2.cfg has the ringing = 0 and the connect=1
I'm using the "stock" checkdir.php
Thanks
Steve
I've run into the same problem. I'm unable to get a screen-pop when the call is "connected" from a queue. The screen-pop works fine for "ringing".
System Details:
FOP2 = 2.21 (final)
Asterisk 1.6.2.10
Elastix 2.0.0.38
queues_additional.conf has eventwhencalled=yes
notify_on_ringing = 0 and notify_on_connect = 1 in the /usr/local/fop2/fop2.cfg
Thanks
Steve
The else block is executed on connect, and the stock file has everything commented out. You must uncomment/modify your checkdir.php file so it actually does something useful.
I am not able to get this working either: (sample of checkdir.php file)
fop2_test.txt gets created but not fop2_test2.txt
I have set Event When Called to Yes within the queue config.
Is there anything else that may be missing? I am trying to pass the unique call id to a web service, I assume when a popup is triggered on connect of a call it will pass a variable like uniqueid within $ALLVAR ?
Thanks.