mod_xml_curl 动态加载号码,拨号方案

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代码   收藏代码
  1. <load module="mod_xml_curl"/>  


第二步 修改 xml_curl.cong.xml 
重点是 http://example1.com:80/fsapi 这个http接口 

Java代码   收藏代码
  1. <configuration name="xml_curl.conf" description="cURL XML Gateway">  
  2.   <bindings>  
  3.     <!-- Ask example1.com for a dialplan config, if we get a valid response  
  4.          then don't continue onto example2.com. However if we don't get a valid  
  5.          response, then continue onto example2.com   
  6.     -->  
  7.     <binding name="dialplan">  
  8.       <param name="gateway-url" value="http://example1.com:80/fsapi" bindings="dialplan"/>  
  9.     </binding>  
  10.   
  11.     <!-- This will only get called if example1.com returns an invalid or  
  12.          not found response. If this gateway also fails to return a valid  
  13.          configuration, then FreeSWITCH will look for the static configuration   
  14.          file on disk  
  15.     -->  
  16.     <binding name="dialplan backup">  
  17.       <param name="gateway-url" value="http://example2.com:80/fsapi" bindings="dialplan"/>  
  18.     </binding>  
  19.   
  20.     <!-- Ask example1.com for a directory config, if not found then revert  
  21.          to disk  
  22.     -->  
  23.     <binding name="directory">  
  24.       <param name="gateway-url" value="http://example1:80/fsapi" bindings="directory"/>  
  25.     </binding>  
  26.   
  27.     <!-- Ask example1.com for a configuration config, if not found then revert  
  28.          to disk  
  29.     -->  
  30.     <binding name="configuration">  
  31.       <param name="gateway-url" value="http://example1:80/fsapi" bindings="configuration"/>  
  32.     </binding>  
  33.   
  34.     <!-- Ask example1.com for a phrases config, if not found then revert  
  35.          to disk  
  36.     -->  
  37.     <binding name="phrases">  
  38.       <param name="gateway-url" value="http://example1:80/fsapi" bindings="phrases"/>  
  39.     </binding>  
  40.   </bindings>  
  41. </configuration>  


接口的详细规范请参考 http://wiki.freeswitch.org/wiki/Mod_xml_curl 

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
配置动态刷新_SpringCloud配置中心动态加载(刷新)配置文件可以通过Spring Cloud Config实现。具体实现步骤如下: 1. 在pom.xml文件中引入Spring Cloud Config依赖: ``` <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-config-server</artifactId> </dependency> ``` 2. 在启动类中添加@EnableConfigServer注解,开启配置中心服务: ``` @SpringBootApplication @EnableConfigServer public class ConfigServerApplication { public static void main(String[] args) { SpringApplication.run(ConfigServerApplication.class, args); } } ``` 3. 在配置文件中添加配置中心相关配置: ``` spring: cloud: config: server: git: uri: https://github.com/{git_username}/{git_repository}.git search-paths: '{config_files_path}' username: {git_username} password: {git_password} ``` 其中,uri为Git仓库地址,search-paths为配置文件路径,username和password为Git仓库的用户名和密码。 4. 在需要动态加载配置的应用程序中,添加@RefreshScope注解,表示该类中的配置可以被动态刷新: ``` @RestController @RefreshScope public class ConfigController { @Value("${config_name}") private String configValue; @GetMapping("/config") public String getConfig() { return configValue; } } ``` 5. 在需要动态刷新配置的时候,向应用程序发送POST请求,请求路径为/actuator/refresh: ``` curl -X POST http://localhost:8080/actuator/refresh ``` 以上就是配置动态刷新_SpringCloud配置中心动态加载(刷新)配置文件的实现步骤。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值