FreeSWITCH编译mod_callcenter模块

245 阅读3分钟

修改模块配置文件

进入FreeSWITCH源码目录,编辑modules.conf文件,将applications/mod_callcenter取消注释

image.png

编译模块

执行make mod_callcenter-install 编译模块,在执行编译之前需要先配置安装了FreeSWITCH,具体步骤可以参考Debian12编译安装FreeSWITCH

~# make mod_callcenter-install 
make[1]: Entering directory '/root/freeswitch'
  CXXLD    libfreeswitch.la

*** Warning: Linking the shared library libfreeswitch.la against the
*** static library libs/libvpx/libvpx.a is not portable!
 /usr/bin/mkdir -p '/usr/local/freeswitch/lib'
 /bin/bash /root/freeswitch/libtool   --mode=install /usr/bin/install -c   libfreeswitch.la '/usr/local/freeswitch/lib'
libtool: install: /usr/bin/install -c .libs/libfreeswitch.so.1.0.0 /usr/local/freeswitch/lib/libfreeswitch.so.1.0.0
libtool: install: (cd /usr/local/freeswitch/lib && { ln -s -f libfreeswitch.so.1.0.0 libfreeswitch.so.1 || { rm -f libfreeswitch.so.1 && ln -s libfreeswitch.so.1.0.0 libfreeswitch.so.1; }; })
libtool: install: (cd /usr/local/freeswitch/lib && { ln -s -f libfreeswitch.so.1.0.0 libfreeswitch.so || { rm -f libfreeswitch.so && ln -s libfreeswitch.so.1.0.0 libfreeswitch.so; }; })
libtool: install: /usr/bin/install -c .libs/libfreeswitch.lai /usr/local/freeswitch/lib/libfreeswitch.la
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/local/freeswitch/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/freeswitch/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[1]: Leaving directory '/root/freeswitch'
make[1]: Entering directory '/root/freeswitch/src/mod'

making install mod_callcenter
make[2]: Entering directory '/root/freeswitch/src/mod/applications/mod_callcenter'
  CC       mod_callcenter_la-mod_callcenter.lo
  CCLD     mod_callcenter.la
make[3]: Entering directory '/root/freeswitch/src/mod/applications/mod_callcenter'
make[3]: Nothing to be done for 'install-exec-am'.
 /usr/bin/mkdir -p '/usr/local/freeswitch/mod'
 /bin/bash /root/freeswitch/libtool   --mode=install /usr/bin/install -c   mod_callcenter.la '/usr/local/freeswitch/mod'
libtool: warning: relinking 'mod_callcenter.la'
libtool: install: (cd /root/freeswitch/src/mod/applications/mod_callcenter; /bin/bash "/root/freeswitch/libtool"  --silent --tag CC --mode=relink gcc -I/usr/include/uuid -I/root/freeswitch/src/include -I/root/freeswitch/src/include -I/root/freeswitch/libs/libteletone/src -fPIC -ffast-math -Werror -Wno-unused-result -Wno-misleading-indentation -fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DCJSON_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 -g -ggdb -DHAVE_OPENSSL -Wall -std=c99 -pedantic -Wdeclaration-after-statement -g -O2 -avoid-version -module -no-undefined -shared -o mod_callcenter.la -rpath /usr/local/freeswitch/mod mod_callcenter_la-mod_callcenter.lo /root/freeswitch/libfreeswitch.la -lssl -lcrypto )
libtool: install: /usr/bin/install -c .libs/mod_callcenter.soT /usr/local/freeswitch/mod/mod_callcenter.so
libtool: install: /usr/bin/install -c .libs/mod_callcenter.lai /usr/local/freeswitch/mod/mod_callcenter.la
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/local/freeswitch/mod
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/freeswitch/mod

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[3]: Leaving directory '/root/freeswitch/src/mod/applications/mod_callcenter'
make[2]: Leaving directory '/root/freeswitch/src/mod/applications/mod_callcenter'
make[1]: Leaving directory '/root/freeswitch/src/mod'

加载模块

在FreeSWITCH控制台中执行load mod_callcenter加载模块

freeswitch@debianb85> load mod_callcenter 
2025-04-01 22:57:02.204812 97.30% [INFO] switch_stun.c:915 External ip address detected using STUN: 27.213.30.131
2025-04-01 22:57:02.484812 97.30% [INFO] switch_stun.c:915 External ip address detected using STUN: 27.213.30.131
2025-04-01 22:57:02.504784 97.30% [INFO] mod_enum.c:884 ENUM Reloaded
2025-04-01 22:57:02.504784 97.30% [INFO] switch_time.c:1436 Timezone reloaded 597 definitions
2025-04-01 22:57:02.504784 97.30% [INFO] mod_callcenter.c:781 Added queue support@default
2025-04-01 22:57:02.504784 97.30% [CONSOLE] mod_callcenter.c:2777 Agent Dispatch Thread Started
2025-04-01 22:57:02.504784 97.30% [CONSOLE] switch_loadable_module.c:1772 Successfully Loaded [mod_callcenter]
2025-04-01 22:57:02.504784 97.30% [NOTICE] switch_loadable_module.c:329 Adding Application 'callcenter'
2025-04-01 22:57:02.504784 97.30% [NOTICE] switch_loadable_module.c:329 Adding Application 'callcenter_track'
2025-04-01 22:57:02.504784 97.30% [NOTICE] switch_loadable_module.c:389 Adding API Function 'callcenter_config'
2025-04-01 22:57:02.504784 97.30% [NOTICE] switch_loadable_module.c:389 Adding API Function 'callcenter_break'
2025-04-01 22:57:02.504784 97.30% [NOTICE] switch_loadable_module.c:419 Adding JSON API Function 'callcenter_config'

+OK Reloading XML
+OK

配置FreeSWITCH启动时候自动加载模块

如果我们需要在FreeSWICTH启动时候自动加载模块,可以修改conf/autoload_configs/modules.conf.xml文件,添加<load module="mod_callcenter">

image.png

参考文档