我建了一个 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.xml为freeswitch作为客户端注册到另一个网关的全局配置,

/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的网关上。

freeswitch与外部网关链接的更多相关文章

  1. Excel中如何查找并列出所有链接(外部数据链接)?

    在 Excel 中,有时会需要创建外部链接来引用其他工作簿的单元格内容,但是如果想要找出所有链接并且还要将这些外部数据链接列在一个工作簿当中是有点难度的.下面我会介绍一些快捷方法,不仅能够快速帮你找出 ...

  2. 在Vue文件中引入外部URL链接

    前言:最近做一个vueNuxt的项,没有index.html 也没有main.js项目需要引入一些外部的包,没什么技术含量只是一种思路 在vue生命钩子函数中动态创建JavaScript标签追加到HT ...

  3. OpenERP在product中增加外部网络链接图片

    最近的一个项目要求在Product_Template中增加类似与HTML中<img src=”" />的形式的图片 product_img_extra.py from osv i ...

  4. Excel中外部数据链接无法删除的解决方法【转】

    [摘要] 当Excel中公式引用了外部数据,每次打开时,总是自动弹出自动更新链接的对话框.如何找到这些链接?有没有办法实现断开原有链接,而保持数值不变? 有客户反应,当Excel无法链接到外部数据后, ...

  5. freeswitch 获取当前网关通道数

    1.使用show xmlstatus可以获取网关实时负载. 无session 有session

  6. redis 安装成功后外部服务器链接不上

    1.reids服务器的6379端口telnet不通 2. 查看reids进程和端口,都是存在的.只是ip地址是127.0.0.1而不是0.0.0.0,只是本机能使用 3.查找redis的配置文件red ...

  7. 小程序之web-view打开外部链接

    小程序之web-view - 传送门 web-view 组件是一个可以用来承载网页的容器,会自动铺满整个小程序页面.个人类型与海外类型的小程序暂不支持使用. 一:小程序使用web-view打开链接的前 ...

  8. 个人永久性免费-Excel催化剂功能第70波-工作薄外部链接维护管理

    Excel在数据领域万物互联的特性,其中一个使用场景是连接非本工作薄的外部性文件内容,如其他Excel工作薄文件里的内容或直接用OLE对象的方式嵌入一个文件链接,使其在不离开Excel环境,也可提供类 ...

  9. API 网关

    使用 API 网关   链接:https://github.com/oopsguy/microservices-from-design-to-deployment-chinese译者:Oopsguy ...

随机推荐

  1. Failed to Attach to Process ID Xcode 解决办法

    方法1. go to the Product menu and find the Edit Scheme menu there. While in Edit Scheme window, select ...

  2. CentOS 6.9下iptables通过raw表实现日志输出和调试

    说明:iptables调试的最好方式应该是输出日志了.并且iptables有个raw的表,优先级别最好,且调试时针对icmp协议(ping)进行,那么日志输出就是整条链路串起来输出的,非常的清晰. 前 ...

  3. Linux通用KVM自动安装Shell脚本(兼容所有Linux发行版/CentOS/Ubuntu)

    官网: https://github.com/retspen/webvirtmgr/wiki/Setup-Host-Server 安装: wget -O - https://retspen.githu ...

  4. 解决myeclipse不编译的方法

    请按照下面方法对号入座: MyEclipse不编译解决1. 确保 project->build automatically 已经被选上(最基本). MyEclipse不编译解决2. 如果选上了, ...

  5. VMware虚拟机怎么从U盘启动

    VMware虚拟机怎么从U盘启动 发布时间:2016-01-12 18:50发布者:系统城-xtcjh浏览数:41951 VMware Workstation虚拟机可以安装各种操作系统,很多用户就想在 ...

  6. pgfplots画二维图真的很方便,多例比较

    %直接PDFLATEX编译即可\documentclass[border=1mm]{standalone}\usepackage{tkz-euclide,pgfplots}\begin{documen ...

  7. exVim安装

    安装 安装必备 Vim 7.3 or higher. Vundle or Pathogen 下载/更新exVim 注意事项 安装exVim将不会覆盖你已经存在的Vim环境,这个仓库所包含的文件,变化, ...

  8. redis-3.28 一主二从模式介绍、主从从模式介绍、sentinel模式一主两从高可用

    一.redis-3.28部署 yum install gcc tclwget http://download.redis.io/releases/redis-3.2.8.tar.gztar -zxvf ...

  9. C语言i++和++i的区别和指针*(a++)和*(++a)的区别

    i++ :先引用后增加++i :先增加后引用i++ :先在i所在的表达式中使用i的当前值,后让i加1 ++i :让i先加1,然后在i所在的表达式中使用i的新值 一.c语言中i++和++i的运行效果是不 ...

  10. 内向者沟通圣经:4P法(Preparation,Presence,Push,Practice)

    一.对于内向者的态度 坦白,坦白也许是个不错的方法,内向不是缺点,只是性格: 拥抱和全面衡量你自己,无论内向还是外向:(我觉得无论是内向还是外向,都应该这么做) 当你无法与自身的思想和平共处,你们开始 ...