[Freeswitch-users] PHP ESL & Event Socket Outbound

Milos Jovanovic development.milos at gmail.com
Wed Jul 10 14:23:07 MSD 2013


I am trying to create PHP application that will be receiving information
about each call from freeswitch and send commands to control freeswitch.

I found an example at https://wiki.freeswitch.org/wiki/PHP_ESL#ivrd  BUT
unfortunately they do not explain how I can retrieve information from
freeswitch (so I can do the routing in PHP).

I guess I should use PHP ESL but the documentation is pretty bad so if
someone has some working example, I'd appreciate it.

I tried to read from stdin this way:

*#!/usr/bin/php -q


// set a couple of things so we dont kill the system

// Open stdin so we can read the data in
$in = fopen("php://stdin", "r");

// Connect
echo "connect\n\n";

$text = fgets($in);
file_put_contents('/usr/local/freeswitch/scripts/socketlog.txt' ,$text,

// 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:

// Wait

// Hangup
echo "sendmsg\n";
echo "call-command: hangup\n\n";



*Unfortunately, everything I get as a result in my log file is:*

*Event-Name: CHANNEL_DATA*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130710/dea5e6b0/attachment.html 

Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list