Friday, October 26, 2012

Freeswitch phpmod esl



Just upgraded php on CentOS 5.8 To find your version type:
cat /etc/redhat-release

I needed a more current version of PHP that supported json encoding/decoding without having resort third party libraries. Plus it would be more aligned with my development environment on my notebook.

I used the following link on how to upgrade old versions of CentOS to more current PHP/MySQL.
http://www.webtatic.com/

The upgrade was smooth except that ESL for PHP stopped working. Following error when trying startup PHP.

PHP Warning:  PHP Startup: ESL: Unable to initialize module
Module compiled with module API=20050922
PHP    compiled with module API=20090626
These options need to match
 in Unknown on line 0


Doing the following should have resolved the issue but it didn't work.

cd /usr/local/src/freeswitch/libs/esl
make clean
make phpmod
make phpmod-install

When I removed the old version of PHP it must have removed one of the dependencies. The compile error message indicated that I need to install libtermcap

yum install libtermcap.i386
yum install libtermcap-devel

The libtermcap.i386 was already installed but the devel wasn't.

After this make completed properly and everything was back to normal.

Note: The above make commands are correct. The "make phpmod-install" is the way it should be done.
If you do "make phpmod install" it will fail. This can be easily confused if you are doing things really fast. 


Wednesday, October 24, 2012

Freeswitch CentOS PHP fsocket

Decided a while back to move on to freeswitch for developing IVR applications. Freeswitch is great - it does amazing things - the only thing it can't do is tell you when you are making dumb mistakes.  And most important how to fix them.

Just hoping i can save someone a few hours of pain. If you are developing apps with CentOS/Red Hat/ClearOS with PHP listen carefully. The php fsocket command was bombing on me and the google search didn't give exactly what i was hoping for.  Problem turned out to be selinux. The default settings prevent access to port 8021

to communicate with freeswitch don't forget to disable selinux.

in /etc/selinux/config change


SELINUX=disabled

reboot

or at the command line type

setenforce 0

you can also test from the command line

telnet 127.0.0.1 8021   
(space between ip and port number)
you should get something if it's listening

if you don't have telnet installed

yum install telnet