[asterisk-users] click to call with php

salaheddine elharit salah.elharit200 at gmail.com
Fri May 20 06:47:29 CDT 2011


thanks a lot for your help and support

2011/5/20 A J Stiles <asterisk_list at earthshod.co.uk>

> On Friday 20 May 2011, salaheddine elharit wrote:
> > Ok thank you so much for all advice
>
> This might help you a bit, too:
>
> <?php
> $spool = "/var/spool/asterisk/outgoing/"; # outgoing callfile folder
>
> $filename = "asterisk-" . date("U") . "-" . $_SERVER["REMOTE_PORT"] .
> ".call";
> # this should end up being fairly unique.  (if logging to a database with
> an
> # auto increment field, you can also use mysql_insert_id() as a unique
> # reference)
>
> $src = ... ; # source extension
> # you can determine this based on $_SERVER["REMOTE_ADDR"], which is the
> # IP address of the requesting client, by looking up in an array or a
> database
> $ctxt = ... ; # context
> $dest = ... ; # destination number
> # you probably want to get this from $_REQUEST
>
> $callfile = "Channel: SIP/$src\nContext: $ctxt\nExtension: $dest\nPriority:
> 1\nCallerId: $src\n"; # line break added by email, not used in real life!
> if ($fh = fopen("/tmp/$filename", "w")) {
>    fwrite($fh, $callfile);
>    fclose($fh);
>    system("mv /tmp/$filename $spool");
> }
> else {
>    die("Call file creation failed");
> };
> ?>
>
> --
>  AJS
>
> Answers come *after* questions.
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110520/38c83e87/attachment-0001.htm>


More information about the asterisk-users mailing list