[Freeswitch-users] invoking php scripts from dialplan

Michael Collins msc at freeswitch.org
Fri Jul 29 23:10:48 MSD 2011


Sorry for the delayed response...

I went back to reproduce your symptoms and I noticed something with the port
number you chose (8021). What other REALLY important service is running on
that port? Hint: event socket.

I tried this exact config using port 8040 instead of 8021 and it worked like
a champ.

-MC

On Wed, Jul 20, 2011 at 4:45 PM, Sam <lakersman2006 at yahoo.com> wrote:

> Hi,
>
> I wanted to know is there another method of invoking a php script from the
> dialplan besides using the following because I still cannot get the script
> to run for wahtever reason. Yes, I have opened up the ports on my firewall.
> When I run the php script directly from console it outputs fine, but i
> cannot get it to output via the dialplan.
>
> <!-- dialplan.xml -->
>
> <extension name="outbound-socket">
> <condition field="destination_number" expression="^55(522)$">
> <action application="set" data="ivr_path=/usr/local/freeswitch/scripts/ivrd-demo.php"/>
> <action application="socket" data="127.0.0.1:8021 async full"/>
> </condition>
> </extension>
>
> //I then ran fs_ivrd with this command:
> /usr/local/freeswitch/bin/fs_ivrd -h 127.0.0.1 -p 8021
>
>
> //my php script: ivrd-demo.php
> #!/usr/bin/php -q
>
> <?php
>
> // set a couple of things so we dont kill the system
> ob_implicit_flush(true);
> set_time_limit(30);
>
> // Open stdin so we can read the data in
> $in = fopen("php://stdin", "r");
>
> // Connect
> echo "connect\n\n";
>
> // Answer
> echo "sendmsg\n";
> echo "call-command: execute\n";
> echo "execute-app-name: answer\n\n";
>
> // Play a prompt
> echo "sendmsg\n";
> echo "call-command: execute\n";
> echo "execute-app-name: playback\n";
> echo "execute-app-arg: /usr/local/freeswitch/sounds/en/us/callie/ivr/8000/ivr-welcome_to_freeswitch.wav\n\n";
>
> // Wait
> sleep(5);
>
> // Hangup
> echo "sendmsg\n";
> echo "call-command: hangup\n\n";
>
> fclose($in);
>
> ?>
>
>
>
> _______________________________________________
> Join us at ClueCon 2011, Aug 9-11, Chicago
> http://www.cluecon.com 877-7-4ACLUE
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110729/13387774/attachment.html 


More information about the FreeSWITCH-users mailing list