# test **Repository Path**: longchun4835/test ## Basic Information - **Project Name**: test - **Description**: test - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-06-23 - **Last Updated**: 2021-08-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ###### 环境依赖: * centos 7 * kamailio * freeswitch * mysql * lua5.1 * python3.6 * oss * rabbitmq ###### 安装与使用: * lua5.1依赖安装: ``` yum install -y luarocks luarocks install lua-cjson luarocks install luasocket ``` * python3.6依赖安装: ``` pip3.6 install flask pip3.6 install oss2 pip3.6 isntall pika ``` * freeswitch配置: + cdr配置: - 在freeswitch/autoload_configs/xml_cdr.conf.xml配置文件中增加如下配置: ``` ``` + dialplan: 1.将lua脚本放到/usr/share/freeswitch/scripts/目录下,也可以放到任意目录,需要在public.xml中指定lua脚本目录。 2.在freeswitch/dialplan/public.xml文件中增加配置: ``` ``` * kamailio配置: + dispatcher: kamailio在这里的作用主要是负载均衡,我们主要用的模块是dispatcher模块,配置dispatcher模块路由即可,配置如下(kamailio.cfg): ``` request_route { route(DISPATCH); } route[DISPATCH] { if(!ds_select_dst("1", "4")) { xlog("L_NOTICE", "No destination available!\n"); send_reply("404", "No destination"); exit; } xlog("--- SCRIPT: going to <$ru> via <$du> (attrs: $xavp(_dsdst_=>attrs))\n"); t_on_failure("RTF_DISPATCH"); route(RELAY); exit; } failure_route[RTF_DISPATCH] { if (t_is_canceled()) { exit; } if (t_check_status("500") or (t_branch_timeout() and !t_branch_replied())) { if(ds_next_dst()) { xlog("--- SCRIPT: retrying to <$ru> via <$du> (attrs: $xavp(_dsdst_=>attrs))\n"); t_on_failure("RTF_DISPATCH"); route(RELAY); exit; } } } ```