[asterisk-users] PHP to .call file

zero massive thezerogroup at gmail.com
Sun Nov 19 10:20:05 MST 2006


Hi all!

Can anyone shed some light on a problem with a php to .call file. I am
trying to input the number I would like to call, as well as the current
phone number where im located. I am able to generate a call to each number,
but I am unable to hear or say anything on either phone.....any ideas would
be great!

PHP File:

<?php

error_reporting( E_ALL );

$caller = $_GET[ "caller" ];
if( $caller == "" )
{ $caller = $_POST[ "caller" ]; }
if( $caller == "" )
{ $caller = "18005550000"; }

$CID = $_GET[ "CID" ];
if( $CID == "" )
{ $CID = $_POST[ "CID" ]; }
if( $CID == "" )
{ $CID = "18005551212"; }


$station_to_call = "SIP/TelaSIP-gw4/15198821111";
$spool_dir = "/var/spool/asterisk/outgoing";
$temp_dir = $spool_dir . "/tmp" . $caller;
$call_file = $temp_dir . "/$caller.call";

mkdir( $temp_dir );

$file = fopen( $call_file, "w" );
fputs( $file, "Channel: $station_to_call\n" );
fputs( $file, "Callerid: $CID\n" );
fputs( $file, "MaxRetries: 5\n" );
fputs( $file, "RetryTime: 300\n" );
fputs( $file, "WaitTime: 45\n" );
fputs( $file, "Context: outbound-allroutes\n" );
fputs( $file, "Extension: $caller\n" );
fputs( $file, "Priority: 1\n" );
fclose( $file );

rename( $call_file, $spool_dir."/$caller.call" );
rmdir( $temp_dir );

Header( "302 Moved" );
Header( "Location: index1.html" );

?>

---Html file---

<body>
 <form name="calling" method="post" action="place-call.php">
   <table>
     <tr>
       <td>Phone:</td>
       <td><input name="caller" type="text" id="un">
     </td>
     </tr>

     <tr>
       <td>CID:</td>
       <td><input name="CID" type="text" id="un1">
     </td>
     </tr>


<tr>
       <td>&nbsp;</td>
       <td><input type="submit" name="Submit" value="Call Me Now"></td>
     </tr>
   </table>
 </form>

</body>
</html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20061119/0de3bcec/attachment.htm


More information about the asterisk-users mailing list