What is wrong with my PHP code, I have no idea. Could you please check it and let me know what's wrong. Im using SER 0.9.3, but ser_fifo documentation is not available, so i used one from ser 0.8.12 (admin guide). Im sure there's a little error, but I can figure out which one. Btw, below the code is the output from message log
<?
/* config values */ $domain="sip.mydomain.org"; $user="webme"; $web_aor="sip:".$user."@".$domain; $expires=3600; $type="student"; $fifo="/tmp/ser_fifo";
/* open reply fifo */ $replyfilename="webfifo_".rand(); $replypath="/tmp/".$replyfilename;
echo "Initiating your request...<p>";
/* open fifo now */ $fifo_handle=fopen( $fifo, "w" ); if (!$fifo_handle) { exit ("Sorry -- cannot open fifo: ".$fifo); }
/* construct FIFO command */ $fifo_cmd=":ul_add:".$replyfilename."\n". "location\n". //table $web_aor."\n". //aor "sip:".$user."@".$_SERVER['REMOTE_ADDR']."\n". //contact $expires."\n". //expires "0.00\n". //priority "0\n\n";
/* create fifo for replies */ system("mkfifo -m 666 ".$replypath );
/* write fifo command */ if (fwrite( $fifo_handle, $fifo_cmd)==-1) { unlink($replypath); fclose($fifo_handle); exit("Sorry -- fifo writing error"); } fclose($fifo_handle);
/* read output now */ if (readfile( $replypath )==-1) { unlink($replypath); exit("Sorry -- fifo reading error"); } unlink($replypath); echo "<p>You are now signed in<p>";
?>
///MESSAGE LOG Dec 6 16:35:24 sip /usr/local/sbin/ser[206]: ERROR: read_line: request line too long Dec 6 16:35:24 sip /usr/local/sbin/ser[206]: ERROR: ul_add: flags expected Dec 6 16:35:24 sip /usr/local/sbin/ser[206]: ERROR: fifo_server: command must begin with :: location Dec 6 16:35:24 sip /usr/local/sbin/ser[206]: ERROR: fifo_server: command must begin with :: sip:webme@203.159.32.50;type=student Dec 6 16:35:24 sip /usr/local/sbin/ser[206]: ERROR: fifo_server: command must begin with :: 0.00 Dec 6 16:35:54 sip /usr/local/sbin/ser[206]: ERROR: ul_add: flags expected
I do not remember the fifo command interface by heart ... but i would recommend you to take a look at the source code related to the fifo, i am sure you can infere the command structure. Take a look in the tm module ... uac_fifo.c, for example, and go from there.
Cesc
On 12/6/05, Andrey Kouprianov andrey.kouprianov@gmail.com wrote:
What is wrong with my PHP code, I have no idea. Could you please check it and let me know what's wrong. Im using SER 0.9.3, but ser_fifo documentation is not available, so i used one from ser 0.8.12 (admin guide). Im sure there's a little error, but I can figure out which one. Btw, below the code is the output from message log
<? /* config values */ $domain="sip.mydomain.org"; $user="webme"; $web_aor="sip:".$user."@".$domain; $expires=3600; $type="student"; $fifo="/tmp/ser_fifo"; /* open reply fifo */ $replyfilename="webfifo_".rand(); $replypath="/tmp/".$replyfilename; echo "Initiating your request...<p>"; /* open fifo now */ $fifo_handle=fopen( $fifo, "w" ); if (!$fifo_handle) { exit ("Sorry -- cannot open fifo: ".$fifo); } /* construct FIFO command */ $fifo_cmd=":ul_add:".$replyfilename."\n". "location\n". //table $web_aor."\n". //aor "sip:".$user."@".$_SERVER['REMOTE_ADDR']."\n". //contact $expires."\n". //expires "0.00\n". //priority "0\n\n"; /* create fifo for replies */ system("mkfifo -m 666 ".$replypath ); /* write fifo command */ if (fwrite( $fifo_handle, $fifo_cmd)==-1) { unlink($replypath); fclose($fifo_handle); exit("Sorry -- fifo writing error"); } fclose($fifo_handle); /* read output now */ if (readfile( $replypath )==-1) { unlink($replypath); exit("Sorry -- fifo reading error"); } unlink($replypath); echo "<p>You are now signed in<p>"; ?>
///MESSAGE LOG Dec 6 16:35:24 sip /usr/local/sbin/ser[206]: ERROR: read_line: request line too long Dec 6 16:35:24 sip /usr/local/sbin/ser[206]: ERROR: ul_add: flags expected Dec 6 16:35:24 sip /usr/local/sbin/ser[206]: ERROR: fifo_server: command must begin with :: location Dec 6 16:35:24 sip /usr/local/sbin/ser[206]: ERROR: fifo_server: command must begin with :: sip:webme@203.159.32.50;type=student Dec 6 16:35:24 sip /usr/local/sbin/ser[206]: ERROR: fifo_server: command must begin with :: 0.00 Dec 6 16:35:54 sip /usr/local/sbin/ser[206]: ERROR: ul_add: flags expected
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers