概述

freeswitch 是一款简单好用的VOIP开源软交换平台。

当呼叫是同一个入中继,但是有多条出中继时,需要对出中继做负载均衡,mod_distributor模块可以完成对应的配置和路由。

mod_distributor是一个轻量级的线路分发模块,配置简单,支持权重方式分发多条出中继。

环境

centos:CentOS  release 7.0 (Final)或以上版本

freeswitch:v1.10.7

GCC:4.8.5

APP示例

distributor的APP接口使用方法“${distributor(distributor_list)”。

<action application="bridge" data="sofia/gateway/${distributor(distributor_list)}/${destination_number}"/>

<action application="bridge" data="sofia/external/${destination_number}@${distributor(distributor_list)}"/>

配置&测试

distributor模块默认不编译,需要进入目录手动编译安装。

src/mod/applications/mod_distributor

make install

修改conf/autoload_configs/modules.conf.xml,加载distributor模块。

<load module="mod_distributor"/>

配置文件conf/autoload_configs/distributor.conf.xml,设置distributor列表。

<configuration name="distributor.conf" description="Distributor Configuration">

<lists>

<list name="test" total-weight="5">

<node name="10.55.55.138:5080" weight="1"/>

<node name="10.55.55.138:5090" weight="2"/>

<node name="10.55.55.138:15090" weight="2"/>

</list>

</lists>

</configuration>

配置文件conf/dialplan/test.xml,设置拨号计划。

<extension name="test" continue="false">

<condition field="destination_number" expression="^(\d+)$">

<action application="bridge" data="{sip_invite_call_id=${sip_call_id}}sofia/external/$1@${distributor(test)}"/>

</condition>

</extension>

刷新distributor配置数据。

reloadxml

distributor_ctl reload

发起呼叫10011->1002,三次的测试日志如下。

2022-12-13 15:37:37.150797 [INFO] mod_dialplan_xml.c:637 Processing 10011 <10011>->1002 in context public

...

Dialplan: sofia/external/10011@10.55.55.138 Action bridge({sip_invite_call_id=${sip_call_id}}sofia/external/1002@${distributor(test)})

...

EXECUTE sofia/external/10011@10.55.55.138 bridge({sip_invite_call_id=db46fa8f-f55b-123b-7d99-000c29a63969}sofia/external/1002@10.55.55.138:5080)

...

EXECUTE sofia/external/10011@10.55.55.138 bridge({sip_invite_call_id=16ef92f5-f55a-123b-7d99-000c29a63969}sofia/external/1002@10.55.55.138:5090)

...

EXECUTE sofia/external/10011@10.55.55.138 bridge({sip_invite_call_id=1b811933-f55a-123b-7d99-000c29a63969}sofia/external/1002@10.55.55.138:15090)

总结

mod_distributor模块功能简单清晰,配置方便。

在拨号计划的action中使用loop标记配合distributor,可以实现多条出中继的呼叫尝试。

空空如常

求真得真

freeswitch的distributor模块的更多相关文章

  1. FreeSWITCH 加载模块过程解读

    今天来学习FreeSWITCH 加载模块过程. 哪些模块需要编译,是由源码下的 modules.conf 文件决定的. 哪些模块在程序启动时自动加载,是由 freeswitch/conf/autolo ...

  2. freeswitch插件式模块接口实现方式

    概述 freeswitch的外围模块是插件式的,可以动态的加载和卸载,使用起来非常的灵活和方便. 如果我们自己来设计一个开源的代码框架,相信这种插件式的模块结构是非常适合多人合作的模式. 本文对fs的 ...

  3. freeswitch的话单模块

    概述 最近因为业务需要,在看freeswitch中话单相关的一些模块. 在voip的使用过程中,话单是重要的基础模块,涉及到计费和问题查找. 呼叫话单最重要的一点是稳定,不能有错误或遗漏. 本章对fs ...

  4. freeswitch的mod_curl模块

    概述 有时候,我们需要在呼叫的过程中,或过程后调用web api接口. freeswitch的mod_curl模块可以很方便的实现web api的接口调用. mod_curl模块默认不安装,需要进入模 ...

  5. freeswitch使用mod_shout模块播放mp3

    概述 freeswitch 在对VOIP语音通话中,可以通过playback命令播放IVR语音文件. 默认情况下,freeswitch支持wav文件,也可以直接播放VOIP中常见编解码的G711文件. ...

  6. freeswitch编译mod_av模块

    需要先编译libav库 编译libav下载:git clone https://freeswitch.org/stash/scm/sd/libav.git cd libav ./configure - ...

  7. 《FreeSWITCH: VoIP实战》:SIP 模块 - mod_sofia

    SIP 模块是 FreeSWITCH 的主要模块,所以,值得拿出专门一章来讲解. 在前几章时里,你肯定见过几次 sofia 这个词,只是或许还不知道是什么意思.是这样的,Sofia-SIP 是由诺基亚 ...

  8. freeswitch新增模块API

    概述 上一章我们讲解了freeswitch的源码基本结构,以及如何新增一个插件式模块. freeswitch的架构非常适合这种业务开发模式,即以freeswitch的基本功能为开发平台,新增插件式模块 ...

  9. Freeswitch 添加可转码的G729编码

    默认情况下Freeswitch自带的G729模块是pass-through-并不支持转码. 不过我们依然有个好奇的心, 所以我们决定添加一个支持G729转码的模块到Freeswitch. 1. 下载m ...

  10. Freeswitch配置之sofia

    SIP模块 - mod_sofia SIP 模块是 FreeSWITCH的主要模块. 在 FreeSWITCH中,实现一些互联协议接口的模块称为 Endpoint.FreeSWITH支持很多的 End ...

随机推荐

  1. MySQL笔记01: MySQL入门_1.3 MySQL启动停止与登录

    1.3 MySQL启动停止与登录 1.3.1 MySQL启动与停止 MySQL数据库分为客户端和服务器端,只有服务器端服务开启以后,才可以通过客户端登录MySQL服务端. 首先,以管理员身份运行&qu ...

  2. [CF1854D] Michael and Hotel

    题目描述 Michael and Brian are stuck in a hotel with $ n $ rooms, numbered from $ 1 $ to $ n $ , and nee ...

  3. [ABC262D] I Hate Non-integer Number

    Problem Statement You are given a sequence of positive integers $A=(a_1,\ldots,a_N)$ of length $N$. ...

  4. [ABC246A] Four Points

    Problem Statement There is a rectangle in the $xy$-plane. Each edge of this rectangle is parallel to ...

  5. Kubernetes: client-go 源码剖析(一)

    0. 前言 在看 kube-scheduler 组件的过程中遇到了 kube-scheduler 对于 client-go 的调用,泛泛的理解调用过程总有种隔靴搔痒的感觉,于是调转头先把 client ...

  6. 笔记3:Tensorflow2.0实战之MNSIT数据集

    最近Tensorflow相继推出了alpha和beta两个版本,这两个都属于tensorflow2.0版本:早听说新版做了很大的革新,今天就来用一下看看 这里还是使用MNSIT数据集进行测试 导入必要 ...

  7. SpringBoot核心注解:@SpringBootApplication

    @SpringBootApplication它是由三个注解的复合: @ComponentScan @SpringConguration @EnableAutoConfiguration 三个注解的作用 ...

  8. 浅谈 Socket.D 与响应式编程

    一.Socket.D 的主要特性 首先,Scoket.D 是高效一个二进制的网络通讯协议(官方我讲法是:基于事件和语义消息流的网络应用协议),能够满足很多场景下使用.其次,Scoket.D 是温和的响 ...

  9. springboot去除内嵌tomcat

    springboot去除内嵌tomcat步骤 在pom文件中加入以下代码 点击查看代码 <!-- 多模块排除内置tomcat --> <dependency> <grou ...

  10. ElasticSearch之查看集群的参数

    参考Cluster get settings API. 命令样例,不指定参数,如下: curl -X GET "https://localhost:9200/_cluster/setting ...