Web Calls 3e1415b0 25ef 11e0 Ac64 0800200c9a66
install phpmod
prepare the necessary dependent libraries for phpmod
sudo apt-get install libxml2-dev libpcre3-dev libcurl4-openssl-dev libgmp3-dev libaspell-dev python-dev php5-dev libonig-dev libqdbm-dev libdb-dev
install apache, php
sudo apt-get install apache2 php5 libapache2-mod-php5 php5-cli

To check whether php is installed and running properly, just create a test.php in your /var/www folder with phpinfo() function exactly as shown below.

nano /var/www/test.php

with content like:

<?php phpinfo(); ?>

chmod 755  /var/www/test.php

Point your browser to http://ip.address/test.php or http://localhost/test.php and this should show all your php configuration and default settings.

Note, install XAMPP(Apache, MySQL, PHP, PHPMyAdmin) can be done like referenced from here

create php symbol link

because php5 is installed as /usr/share/php5 and phpmod will install files into /usr/share/php, thus we need to create a symbol link

sudo ln -s /usr/share/php5 /usr/share/php
fix makefile
cd ~/fs/freeswitch-1.0.7/libs/esl
vim ./Makefile

you need to remove those two compiling parameters in two places, other build will fail.

-Werror -Wno-used-variable

install phpmod
sudo make phpmod-install

you can see some files are copied.

now it is time to set up test calls.
create a bridge.lua file

in /usr/local/freeswitch/scripts, lua syntax

phone1 = argv[1];
phone2 = argv[2];

dialstring1 = "{ignore_early_media=true}user/" .. phone1;
dialstring2 = "{ignore_early_media=true}user/" .. phone2;

session1 = freeswitch.Session(dialstring1);
if session1:ready() or session1:hangupCause() == "SUCCESS" then
  session1:answer();

  session2 = freeswitch.Session(dialstring2);
  if session2:ready() or session2:hangupCause() == "SUCCESS" then
    session2:answer();
    freeswitch.bridge(session1, session2);
  else
    local cause = session1:hangupCause();
    freeswitch.consoleLog("info", "session2:hangupCause() = " .. cause );
  end
else
  local cause = session1:hangupCause();
  freeswitch.consoleLog("info", "session1:hangupCause() = " .. cause );
end

you can test it in console : luarun bridge.lua 1000 1001

enable event_socket access
vim /usr/local/freeswitch/conf/autoload_configs/event_socket.conf.xml

change the line to like:

<param name="listen-ip" value="0.0.0.0"/>

create call.php file

create /var/www/call.php, content is like:

<?php
 if (isset($_GET['phone1']) && isset($_GET['phone2']))
 {
         $phone1 = $_GET['phone1'];
         $phone2 = $_GET['phone2'];
 
         require_once('ESL.php');
 
         $sock = new ESLconnection('127.0.0.1', '8021', 'ClueCon');
         $command = "luarun bridge.lua " . $phone1 . " " . $phone2;
         $res = $sock->api($command);
         if ($res != null)
         {
                 printf("%s\n", $res->getBody());
                 echo "<h2>Calling " . $phone1 . " and " . $phone2 . "</h2><br/>\n";
         }
         else
         {
                 echo "<h2>Error, unable to call</h2><br/>\n";
         }
 }
 ?>
 <form name="clicktocall" action="call.php" method="GET">
 Phone1: <input type="text" name="phone1" /><br/>
 Phone2: <input type="text" name="phone2" /><br/>
 <input type="submit" value="Call Now!" />
chmod 755  /var/www/call.php
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License