【FreeSWITCH 】CTI-DEMO

CTI-Demo

# directory
cd /usr/src/freeswitch/libs/esl

# compile
gcc -o testclient testclient.c -pthread -lm -lesl -lcjson -Isrc/include
# 
  • compile
gcc -o testclient testclient.c -pthread -lm -lesl -L. -Isrc/include

https://freeswitch.org/confluence/display/FREESWITCH/Event+Socket+Library
https://blog.csdn.net/huoyin/article/details/39394189

Errors

  • gcc -o testserver testserver.c -lpthread -lm -lesl -lcjson -Isrc/include
admin~: gcc -o testserver testserver.c -lpthread -lm -lesl -lcjson -Isrc/include

//usr/local/lib/libesl.so: undefined reference to `pthread_mutexattr_settype'
//usr/local/lib/libesl.so: undefined reference to `pthread_attr_setstacksize'
//usr/local/lib/libesl.so: undefined reference to `pthread_mutex_trylock'
//usr/local/lib/libesl.so: undefined reference to `pthread_create'
//usr/local/lib/libesl.so: undefined reference to `pthread_mutexattr_init'
//usr/local/lib/libesl.so: undefined reference to `pthread_mutexattr_destroy'
collect2: error: ld returned 1 exit status

# solution
-lpthread change to -pthread

https://stackoverflow.com/questions/22180354/why-am-i-getting-undefined-reference-to-pthread-mutexattr-settype

  • /usr/bin/ld: cannot find -lesl
# errors
gcc -o testserver testserver.c -lpthread -lm -lesl -lcjson -Isrc/include
/usr/bin/ld: cannot find -lesl
collect2: error: ld returned 1 exit status

# solution
gcc -fPIC -g -c -Wall esl.c -Isrc/include
gcc -fPIC -g -c -Wall esl_buffer.c -Isrc/include
gcc -fPIC -g -c -Wall esl_config.c -Isrc/include
gcc -fPIC -g -c -Wall esl_event.c -Isrc/include
gcc -fPIC -g -c -Wall esl_json.c -Isrc/include
gcc -fPIC -g -c -Wall esl_threadmutex.c -Isrc/include

gcc -shared -Wl,-soname,libesl.so.1 -o libesl.so.1.0.1 esl_buffer.o esl.o esl_config.o esl_event.o esl_json.o esl_threadmutex.o -lm 
# [-lm must be at the end of the line]

cp -p /usr/src/freeswitch/libs/esl/src/libesl.so.1.0.1 /usr/local/lib  
ln -s /usr/src/freeswitch/libs/esl/src/libesl.so.1.0.1 /usr/local  /lib/libesl.so.1
ln -s /usr/src/freeswitch/libs/esl/src/libesl.so.1 /usr/local/lib/libesl.so

echco '/usr/local/lib' > /etc/ld.conf.d/libesl.conf

# run ldconfig
ldconfig

https://stackoverflow.com/questions/28205692/freeswitch-esl-cannot-find-lesl

  • /usr/bin/ld: cannot find -lcjson
# error
/usr/bin/ld: cannot find -lcjson
collect2: error: ld returned 1 exit status

# solution
git clone https://github.com/DaveGamble/cJSON.git
cd cJSON/

make && make install

# run ldconfig
ldconfig

https://stackoverflow.com/questions/40857103/cjson-error-while-compiling-and-printing-file
https://www.jianshu.com/p/9aa57961b17b

Reference

https://blog.csdn.net/huoyin/article/details/39394189
https://blog.csdn.net/u011304970/article/details/54944723
https://www.jellythink.com/archives/373

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值