mod_xml_curl 动态加载号码,拨号方案
2014-10-29 11:41
1711 查看
mod_xml_curl:
此模块为与Asterisk realtime 机制差不多,可以通过此模让freeswitch 需要时动态访问外部数据库或Web Server.这样可以实现动态控制freeswitch核心。
比如 分机的添加可以通过在数据库配置,freeswitch通过此模块来加载分机。
通过此模块可以绑定:
1 .dialplan
<param name="gateway-url" value="http://localhost:8080" bindings="Dialplan"/>
每次呼叫,系统都会先访问8080
freeswitch安装完成后默认的是用静态配置文件的方式加载号码本
这对于动态注册的用户,无法实时同步
需要系统reloadxml后号码才能呼入
对于商业系统来说这是无法接受的
动态加载
动态方式其实很简单,开发一个http接口给fs调用
fs发去http请求传参数,接口返回http相应
这样就OK了
下面给出具体配置:
第一步 找到 modules.conf.conf 文件 去掉注释
Java代码
<load module="mod_xml_curl"/>
第二步 修改 xml_curl.cong.xml
重点是 http://example1.com:80/fsapi 这个http接口
Java代码
<configuration name="xml_curl.conf" description="cURL XML Gateway">
<bindings>
<!-- Ask example1.com for a dialplan config, if we get a valid response
then don't continue onto example2.com. However if we don't get a valid
response, then continue onto example2.com
-->
<binding name="dialplan">
<param name="gateway-url" value="http://example1.com:80/fsapi" bindings="dialplan"/>
</binding>
<!-- This will only get called if example1.com returns an invalid or
not found response. If this gateway also fails to return a valid
configuration, then FreeSWITCH will look for the static configuration
file on disk
-->
<binding name="dialplan backup">
<param name="gateway-url" value="http://example2.com:80/fsapi" bindings="dialplan"/>
</binding>
<!-- Ask example1.com for a directory config, if not found then revert
to disk
-->
<binding name="directory">
<param name="gateway-url" value="http://example1:80/fsapi" bindings="directory"/>
</binding>
<!-- Ask example1.com for a configuration config, if not found then revert
to disk
-->
<binding name="configuration">
<param name="gateway-url" value="http://example1:80/fsapi" bindings="configuration"/>
</binding>
<!-- Ask example1.com for a phrases config, if not found then revert
to disk
-->
<binding name="phrases">
<param name="gateway-url" value="http://example1:80/fsapi" bindings="phrases"/>
</binding>
</bindings>
</configuration>
接口的详细规范请参考 http://wiki.freeswitch.org/wiki/Mod_xml_curl
此模块为与Asterisk realtime 机制差不多,可以通过此模让freeswitch 需要时动态访问外部数据库或Web Server.这样可以实现动态控制freeswitch核心。
比如 分机的添加可以通过在数据库配置,freeswitch通过此模块来加载分机。
通过此模块可以绑定:
1 .dialplan
<param name="gateway-url" value="http://localhost:8080" bindings="Dialplan"/>
每次呼叫,系统都会先访问8080
freeswitch安装完成后默认的是用静态配置文件的方式加载号码本
这对于动态注册的用户,无法实时同步
需要系统reloadxml后号码才能呼入
对于商业系统来说这是无法接受的
动态加载
动态方式其实很简单,开发一个http接口给fs调用
fs发去http请求传参数,接口返回http相应
这样就OK了
下面给出具体配置:
第一步 找到 modules.conf.conf 文件 去掉注释
Java代码
<load module="mod_xml_curl"/>
第二步 修改 xml_curl.cong.xml
重点是 http://example1.com:80/fsapi 这个http接口
Java代码
<configuration name="xml_curl.conf" description="cURL XML Gateway">
<bindings>
<!-- Ask example1.com for a dialplan config, if we get a valid response
then don't continue onto example2.com. However if we don't get a valid
response, then continue onto example2.com
-->
<binding name="dialplan">
<param name="gateway-url" value="http://example1.com:80/fsapi" bindings="dialplan"/>
</binding>
<!-- This will only get called if example1.com returns an invalid or
not found response. If this gateway also fails to return a valid
configuration, then FreeSWITCH will look for the static configuration
file on disk
-->
<binding name="dialplan backup">
<param name="gateway-url" value="http://example2.com:80/fsapi" bindings="dialplan"/>
</binding>
<!-- Ask example1.com for a directory config, if not found then revert
to disk
-->
<binding name="directory">
<param name="gateway-url" value="http://example1:80/fsapi" bindings="directory"/>
</binding>
<!-- Ask example1.com for a configuration config, if not found then revert
to disk
-->
<binding name="configuration">
<param name="gateway-url" value="http://example1:80/fsapi" bindings="configuration"/>
</binding>
<!-- Ask example1.com for a phrases config, if not found then revert
to disk
-->
<binding name="phrases">
<param name="gateway-url" value="http://example1:80/fsapi" bindings="phrases"/>
</binding>
</bindings>
</configuration>
接口的详细规范请参考 http://wiki.freeswitch.org/wiki/Mod_xml_curl
相关文章推荐
- 动态决定加载dll多个版本的完美方案
- [转载]动态决定加载dll多个版本的完美方案
- MzTreeView2.0 动态加载树(xml)
- 动态加载资源属性文件实现方案
- 关于C#中hibernate.cfg.xml动态加载问题
- treeview动态加载xml(2)
- WinForm 从XML中动态加载菜单的示例
- C#——通过XML读取左侧菜单实现Extjs菜单动态加载
- android: 静态XML和动态加载XML混合使用,以及重写Layout控件
- Rdlc 动态加载xml 实现图表宽度(高度)自适应
- XML动态加载TreeView
- 从XML中动态加载菜单的示例
- html中的数据岛:利用DSO和javascript在html中动态加载和浏览xml数据
- 水晶报表图片动态加载的另一种简单方案
- Ext Grit动态加载xml数据
- Asterisk 动态拨号方案配置说明
- html中的数据岛:利用DSO和javascript在html中动态加载和浏览xml数据
- asp.net ext treepanel 动态加载XML的实现方法
- 2.Silverlight动态加载外部XML指定地址的WebService-(动态加载外部XML文件中指定的WebService地址)
- WinForm 从XML中动态加载菜单的示例