freeswitch php esl,FreeSWITCH增加PHP ESL模块支持

若FreeSWITCH以前已经编译过,需要增加PHP ESL模块支持,操作步骤如下

安装依赖

yum -y install libxml2-devel pcre-devel bzip2-devel curl-devel gmp-devel aspell-devel libtermcap-devel gdbm-devel db4-devel libedit-devel php-devel

进如FreeSWITCH源码目录,执行如下命令

/root/freeswitch-1.4.26

./configure

cd libs/esl/

[root@localhost esl]# make phpmod-install

make MYLIB=".././.libs/libesl.a" SOLINK="-shared -Xlinker -x" CFLAGS="-I/root/freeswitch-1.4.26/libs/esl/src/include -I/root/freeswitch-1.4.26/src/include -I/root/freeswitch-1.4.26/src/include -I/root/freeswitch-1.4.26/libs/libteletone/src -fPIC -fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 -g -ggdb -DHAVE_OPENSSL" CXXFLAGS="-I/root/freeswitch-1.4.26/libs/esl/src/include -I/root/freeswitch-1.4.26/src/include -I/root/freeswitch-1.4.26/src/include -I/root/freeswitch-1.4.26/libs/libteletone/src -fPIC -fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1" CXX_CFLAGS="" -C php

make[1]: Entering directory `/root/freeswitch-1.4.26/libs/esl/php'

g++ -I/root/freeswitch-1.4.26/libs/esl/src/include -I/root/freeswitch-1.4.26/src/include -I/root/freeswitch-1.4.26/src/include -I/root/freeswitch-1.4.26/libs/libteletone/src -fPIC -fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 -I/root/freeswitch-1.4.26/libs/esl/src/include -I/root/freeswitch-1.4.26/src/include -I/root/freeswitch-1.4.26/src/include -I/root/freeswitch-1.4.26/libs/libteletone/src -fPIC -fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -Wno-unused-label -Wno-unused-function -c esl_wrap.cpp -o esl_wrap.o

g++ -shared -Xlinker -x esl_wrap.o .././.libs/libesl.a -lcrypt -lcrypt -ledit -lncurses -lm -ldl -lnsl -lm -lm -lcrypt -lm -lcrypt -lpthread -o ESL.so -L. -lssl -lcrypto

make[1]: Leaving directory `/root/freeswitch-1.4.26/libs/esl/php'

make -C php install

make[1]: Entering directory `/root/freeswitch-1.4.26/libs/esl/php'

test -d "/usr/lib64/php/modules" || mkdir -p "/usr/lib64/php/modules"

cp ESL.so "/usr/lib64/php/modules"

test -d "/usr/share/pear" || mkdir -p "/usr/share/pear"

cp ESL.php "/usr/share/pear"

test -d "/etc/php.d" || mkdir -p "/etc/php.d"

test -f "/etc/php.d/esl.ini" || echo 'extension=ESL.so' > "/etc/php.d/esl.ini"

make[1]: Leaving directory `/root/freeswitch-1.4.26/libs/esl/php'

到此为止已经编译完成,进入到目录,该目录下有如下文件

cd freeswitch-1.4.26/libs/esl/php/

[root@localhost /]# ls

ESL.php ESL.so esl_wrap.cpp esl_wrap.o Makefile Makefile.am Makefile.in php_ESL.h single_command.php test.php

测试是否成功,可运行single_command.php脚本,传入任何FreeSWITCH命令作为参数,如下已经成功执行命令

[root@localhost /]# ./single_command.php version

Command to run is: version

FreeSWITCH Version 1.4.26~64bit ( 64bit)

后期ESL开发过程中只需拷贝文件ESL.php和ESL.so到项目目录,并引入ESL.php文件即可

参考官方文档https://freeswitch.org/confluence/display/FREESWITCH/Event+Socket+Library

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值