freeswitch与外部网关链接

简介:

本文来自csdn lidp http://blog.csdn.net/perfectpdl,转载注明出处,谢谢

 

我建了一个 Freeswitch 内核研究 交流群, 45211986, 欢迎加入, 另外,提供基于SIP的通信服务器及客户端解决方案,

承接 sip/ims 视频客户端开发,支持接入sip软交换,ims核心网,支持 语音,视频,即时通信功能,视频格式支持 h263,h264,mpeg4 软编软解,提供硬件编解码接口对接,提供服务器,有兴趣请联系我。



注册到freeswitch的客户端可以互相拨打,但是当客户端想通过freeswitch呼叫那些并没有注册到freeswitch上的客户端怎么办?这就需要freeswitch与外部网关链接,比如与另一个sip server或者pstn测的运营商网络链接。Freeswitch引入网关概念来处理与外部链接问题。

Freeswitch中配置的网关在系统启动时注册到另一个sip服务器,类似于sip客户端注册到freeswitch

配置网关通常需要用户名,密码,以及要注册到的sip服务器ip地址。

网关相关配置保存在目录/conf/sofia_profiles/external

/usr/local/freeswitch/conf/sip_profiles/external.xmlfreeswitch作为客户端注册到另一个网关的全局配置,

/usr/local/freeswitch/conf/sip_profiles/external/目录下可以添加网关。

比如添加注册到asterisk得网关,/usr/local/freeswitch/conf/sip_profiles/external/reg_to_asterisk.xml

reg_to_asterisk.xml内容:

<include>

<gatewayname="asterisk">

<paramname="username" value="freeswitch"/>

<paramname="password" value="freeswitch"/>

<paramname="realm" value="demo.asterisk.org"/>

<paramname="proxy" value="demo.asterisk.org"/>

</gateway>

</include>

~          

保存,控制台重启 sipprofile

freeswitch@openser-dev>sofia profile external restart

2012-08-18 20:21:47.254868[INFO] mod_enum.c:871 ENUM Reloaded

2012-08-18 20:21:47.254868[INFO] switch_time.c:1163 Timezone reloaded 530 definitions

 

Reload XML [Success]

restarting: external

freeswitch@openser-dev>2012-08-18 20:21:47.295211 [NOTICE] sofia.c:2500 Waiting for worker thread

2012-08-18 20:21:47.956692[NOTICE] sofia_glue.c:5707 deleted gateway example.com from profile external

2012-08-18 20:21:47.956692[NOTICE] sofia.c:5202 Started Profile external [sofia_reg_external]

2012-08-18 20:21:47.984023[NOTICE] sofia_reg.c:2944 Added gateway 'asterisk' to profile 'external'

2012-08-18 20:21:47.984023[NOTICE] sofia_reg.c:2944 Added gateway 'example.com' to profile 'external'

2012-08-18 20:21:49.975233[NOTICE] sofia_reg.c:415 Registering asterisk

 

freeswitch@openser-dev>

freeswitch@openser-dev>

查看注册状态

freeswitch@internal> sofiastatus

                     Name          Type                                      Data      State

=================================================================================================

            internal-ipv6       profile                  sip:mod_sofia@[::1]:5060     RUNNING (0)

                 internal         profile                   sip:mod_sofia@192.168.16.111:5060      RUNNING (0)

                 external         profile         sip:mod_sofia@192.168.16.111:5080     RUNNING (0)

    external::example.com       gateway                   sip:joeuser@example.com      NOREG

       external::asterisk       gateway          sip:freeswitch@demo.asterisk.org     TRYING (retry: NEVER)

           192.168.16.111         alias                                  internal      ALIASED

=================================================================================================

3 profiles 1 alias

a.通过网关呼出去

需要修改dialplan,conf/dialplan/default/目录下添加 route_to_asterisk.xml

 

<include>

<extension name="Dial Out asteriskGateway">

<condition field="destination_number"expression="^9(11)$">

<actionapplication="bridge"data="sofia/gateway/asterisk/$1"/>

</condition>

</extension>

</include>

 

Fs_cli 执行 reloadxml,客户端呼叫 911,呼叫会路由到asterisk网关上。

 

b.接收网关送过来的呼叫

通常,对于那些未经认证的呼叫,freeswitch认为是不安全的,包括网关送过来的呼叫,freeswitch会把这类呼叫路由到publicdialplan context中。

/usr/local/freeswitch/conf/dialplan/public.xml为此类呼叫的dialplan,可以在

/usr/local/freeswitch/conf/dialplan/public/目录添加对应网关送过来的dialplan

如:

Vim /usr/local/freeswitch/conf/dialplan/public/asterisk.xml

 

<include>

<extensionname="asterisk-inbound">

<condition field="destination_number"

expression="^(freeswitch)$">

<actionapplication="set" data="domain_name=$${domain}"/>

<actionapplication="transfer" data="1000 XML default"/>

</condition>

</extension>

</include>

asterisk送过来的被叫号码为freeswitch注册到asterisk上的用户号时,freeswitch转移到其用户1000

3)不需要手动配置网关,但与外部链接

如果外部网关需要diguest认证,则需要在freeswitch上配置网关,如果外部网关并不需要digesut认证,则不需要再freeswitch上手动配置(2)中的过程,有一些网关通过ip验证,这种方式相对更简单,但不如(2)中的安全。

比如default.xmldialplan中的

<actionapplication="bridge"data="sofia/${use_profile}/$1@conference.freeswitch.org"/>

即通过 internalsip profile送到freeswitch.org的网关上。



本文转自einyboy博客园博客,原文链接:http://www.cnblogs.com/einyboy/archive/2012/11/21/2780033.html,如需转载请自行联系原作者。

目录
相关文章
|
数据安全/隐私保护 内存技术
Freeswitch落地网关配置
假设Freeswitch服务器地址为192.168.0.204,网关地址为192.168.0.80;外呼前缀为0。
1113 0
|
XML 数据安全/隐私保护 数据格式
FreeSwitch中如何添加新组和新用户以及配置网关的方法
FreeSwitch中如何添加新组和新用户以及配置网关的方法
|
XML 数据格式
FreePBX对接FreeSWITCH/sangoma网关操作教程
FreePBX对接FreeSWITCH/sangoma网关操作教程
|
XML 开发工具 数据安全/隐私保护
freeswitch软电话配置、结合讯时网关,外线电话呼入、呼出配置
文章目录 软电话配置 配置外部电话呼入sip软电话 配置sip软电话呼出 交换机后台配置 参考资料 软电话配置
1874 0
|
2月前
|
运维 网络协议 安全
长连接网关技术专题(十):百度基于Go的千万级统一长连接服务架构实践
本文将介绍百度基于golang实现的统一长连接服务,从统一长连接功能实现和性能优化等角度,描述了其在设计、开发和维护过程中面临的问题和挑战,并重点介绍了解决相关问题和挑战的方案和实践经验。
108 1
|
6月前
|
负载均衡 应用服务中间件 API
微服务技术系列教程(25) - SpringCloud- 接口网关服务Zuul
微服务技术系列教程(25) - SpringCloud- 接口网关服务Zuul
60 0
|
5月前
|
负载均衡 Cloud Native Java
【云原生】Spring Cloud Alibaba 之 Gateway 服务网关实战开发
【云原生】Spring Cloud Alibaba 之 Gateway 服务网关实战开发
465 0
|
3月前
|
缓存 安全 API
【亿级数据专题】「高并发架构」盘点本年度探索对外服务的百万请求量的API网关设计实现
公司对外开放的OpenAPI-Server服务,作为核心内部系统与外部系统之间的重要通讯枢纽,每天处理数百万次的API调用、亿级别的消息推送以及TB/PB级别的数据同步。经过多年流量的持续增长,该服务体系依然稳固可靠,展现出强大的负载能力。
73 9
【亿级数据专题】「高并发架构」盘点本年度探索对外服务的百万请求量的API网关设计实现
|
2月前
|
SpringCloudAlibaba Java 网络架构
【Springcloud Alibaba微服务分布式架构 | Spring Cloud】之学习笔记(七)Spring Cloud Gateway服务网关
【Springcloud Alibaba微服务分布式架构 | Spring Cloud】之学习笔记(七)Spring Cloud Gateway服务网关
117 0