1、參考資料
https://freeswitch.org/confluence/display/FREESWITCH/mod_amqp
項(xiàng)目地址:
https://github.com/Atoms-Cat/softswitch-gateway
https://gitee.com/atoms-cat/softswitch-gateway
2愿棋、安裝
# 安裝freeswitch mod_amqp模塊枉氮,源碼目錄 src/mod/event_handlers/mod_amqp
make && make install
需要準(zhǔn)備好 RabbitMQ 環(huán)境
3舔亭、加載模塊配置
<!-- 添加以下配置在 conf/autoload_configs/modules.conf.xml 文件 -->
<load module="mod_amqp"/>
4蝗碎、配置mod_amqp模塊
修改 /usr/local/freeswitch/conf/autoload_configs/amqp.conf.xml
- 將交換機(jī)名稱(chēng)
TAP.Events
剃袍、TAP.Logging
的exchange-type參數(shù)修改成fanout
<connections>
<connection name="primary">
<param name="hostname" value="192.168.181.130"/>
<param name="virtualhost" value="/"/>
<param name="username" value="guest"/>
<param name="password" value="guest"/>
<param name="port" value="5672"/>
<param name="heartbeat" value="0"/>
</connection>
</connections>
<params>
<!-- name="exchange-name" 交換機(jī)名稱(chēng)分別是:TAP.Events 善绎、TAP.Logging -->
<!-- 交換機(jī)的模式: topic -->
<!-- <param name="exchange-type" value="topic"/> -->
<!-- 交換機(jī)的模式: fanout 廣播消息 -->
<param name="exchange-type" value="fanout"/>
<!-- 需要在Rabbitmq新建命名為`fs.Events`,`fs.Logging`的queues黔漂,分別綁定`TAP.Events` 、`TAP.Logging`交換機(jī) -->
</params>
- 將交換機(jī)名稱(chēng)
TAP.Commands
=的binding_key參數(shù)修改成fs_node_1
禀酱,binding_key參數(shù)需要是freeswitch集群里的唯一標(biāo)識(shí)
<params>
<param name="exchange-name" value="TAP.Commands"/>
<!-- binding_key 是 spring boot amqp convertAndSend 方法中的 routingKey 參數(shù)-->
<!-- 參考https://github.com/Atoms-Cat/softswitch-gateway中freeswitch-esl-spring-boot-starter模塊炬守,MqListenerTemplate.class -->
<param name="binding_key" value="fs_node_1"/>
</params>
5、生效mod_amqp模塊
# fs_cli
reloadxml
load mod_amqp