PHP And Asterisk Problem in socket programming

I want to make asterisk to call a number from a trunk and after playing a wave file , saying digits but , after running my code , it drop the line. i wish any one could help me on this.
my php code .

<?php
$pbx="localhost";
 
$pbx="127.0.0.1";
$trunk="MYTRUNK";
$src=$_GET[src];
$dest=$_GET[dest];
$callerid=$_GET[cid];
$message=$_GET[code];

  $socket = fsockopen($pbx,"5038", $errno, $errstr, $timeout);
 
 fputs($socket, "Action: Login\r\n");
 fputs($socket, "UserName: MYUSER\r\n");     //
 fputs($socket, "Secret: MYPASS\r\n\r\n");  //
   $wrets=fgets($socket,128);
fputs($socket, "Action: Originate\r\n" );
fputs($socket, "Channel: SIP/$trunk/$dest\r\n" );
fputs($socket, "Application: Playback\r\n" );
fputs($socket, "Data: silence/2\r\n" );
fputs($socket, "Application: SayDigits\r\n" );  // MY PROBLEM IS HERE M 
fputs($socket, "Data: $message\r\n" );
fputs($socket, "CallerID: $callerid\r\n" );        
fputs($socket, "Async: yes\r\n\r\n" );
fputs($socket, "Action: Logoff\r\n\r\n");
 sleep (1);
 $wrets=fgets($socket,128);


 
echo $wrets
 

?>

You have more than one application and more than one data item, in your Originate. You can only have, at most, one of each.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.