2

I would like to make a web interface in PHP to see the FreeSWITCH activities (calls, etc), possibly hosted on a different server than the one where FS is running.

I've seen the server status on the FS server using command line (php single_command.php status), but now I would like to see this status from another server.

When I try to copy ESL.php file to this remote server and try to check the status, I get this error message:

Fatal error: Call to undefined function new_ESLconnection() in  
/var/www/freeswitch/ESL.php on line 127

This is my index.php file:

<?php
ini_set('display_errors', 1);
$password = "ClueCon";
$port = "8021";
$host = "192.168.2.12";

require_once('ESL.php');

set_time_limit(0); // Remove the PHP time limit of 30 seconds for completion due to loop watching events

// Connect to FreeSWITCH
$sock = new ESLconnection($host, $port, $password);
// We want all Events (probably will want to change this depending on your needs)
$sock->sendRecv("status");

// Grab Events until process is killed
while($sock->connected()){
  $event = $sock->recvEvent();
  print_r($event->serialize());
}
?>

I undestand that the webserver doesn't have FreeSWITCH installed, so the error message is obvious, but i don't see how to access to this information from this webserver.

Thank you for your help.

Anto
  • 6,806
  • 8
  • 43
  • 65
DouzeBri DouzeBra
  • 117
  • 1
  • 2
  • 13
  • It's been a while since the last time I worked with PHP, but isn't it a PHP version issue ? Like `ESL.php` is using v5 constructors and you are running php v4, something among those lines ? – Anto Jun 27 '14 at 10:49

2 Answers2

2

Depending upon your need you can use either Inbound or Outbound socket. I do not know much about PHP and FS Event Socket but yeah tried enough with python. I highly recommended to go through thislink.

So if you just want to do small task like initiating a call, bridging any two given number etc i think you should go with Inbound socket(making cli command from your web server to freeswitch server) or mod_xml_rpc.

And if you want to have full control of everything that happens on FS server like showing live call status and modifying their states or say a complete interactive telephony dashboard then you should go with Outbound socket.(Your FS server will send all events to your web server.)

However in your case problem is I think you did not properly build the php ESL module. this link might help you installing ESL

Satyajeet
  • 2,004
  • 15
  • 22
0

Rather than using ESL, you might want to consider using the XMLRPC. The connection is very straight forward:

https://wiki.freeswitch.org/wiki/Freeswitch_XML-RPC

The credentials for the XMLRPC are in your autoloads_configs/xml_rpc.conf.xml

lvl
  • 101
  • 6