[asterisk-users] PHP to .call file

Moises Silva moises.silva at gmail.com
Thu Nov 30 22:04:55 MST 2006


If the call is generated, the problem has nothing to do with the PHP
file. By the way, instead of looking into GET and POST, you may want
to use REQUEST global variable.

Regards

On 11/19/06, zero massive <thezerogroup at gmail.com> wrote:
> 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>
>
>
>
>
>
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
>


-- 
"Su nombre es GNU/Linux, no solamente Linux, mas info en http://www.gnu.org"


More information about the asterisk-users mailing list