Reputation: 97
I have one simple script that is to pass the number 15 on to the other script that is called, and it needs to be in the sleep() statement. It is not working and it also messes up the second script so the last line in the 2nd script does not execute. The 2nd script dials the linphone, phone call connects, it waits 15 seconds then kills the linphone daemon by the exec("killit"); If I manually put the 15 in that sleep statement, my linphone dialing script works perfect but when I try to put the 15 in to the sleep by using session variable passing, the phone call only stays up for 9 seconds (which is also wrong, should be 15 and I don't know where the 9 is coming from in seconds) and the last line to automatically kill the linphone daemon doesn't work, I have to do it by command line. That last line is actually a small script in C that has the bash shell script in it to do a pkill of linphone, of which I learned from here.
session_start();
$_SESSION['15'];
header('Location: linphone.php');
-------------------------------
session_start();
$output1=shell_exec ("linphonecsh init");
sleep(1);
$output2=shell_exec ("linphonecsh register --host 142.100.64.220 --username 5555 --password 5555");
sleep(2);
$output=shell_exec ("linphonecsh dial [email protected]");
sleep($_SESSION);
exec("killit");
I have tried this syntax as well, from this site, but does not work.
session_start();
$wait = (15);
$_SESSION['timer'] = $wait;
session_start();
$sec = $_SESSION['timer'];
sleep($sec);
Upvotes: 1
Views: 37
Reputation: 2040
Your $_SESSION[15]
doesn't do anything. $_SESSION
is a global array so you have to set a [key]
and a value
. Try setting a $_SESSION['timer']
variable to 15 and passing that. As below.
session_start();
$_SESSION['timer'] = 15;
header('Location: linphone.php');
session_start();
$output1=shell_exec ("linphonecsh init");
sleep(1);
$output2=shell_exec ("linphonecsh register --host 142.100.64.220 --
username 5555 --password 5555");
sleep(2);
$output=shell_exec ("linphonecsh dial [email protected]");
sleep((int) $_SESSION['timer']);
exec("killit");
Upvotes: 1