[Freeswitch-users] invoking php scripts from dialplan

Sam lakersman2006 at yahoo.com
Thu Jul 21 03:45:33 MSD 2011


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);

?> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110720/7105ec9a/attachment-0001.html 


More information about the FreeSWITCH-users mailing list