吴伟贤のBlog

Feed Rss

freeswitch g729编码非官方

11.30.2012, freeswitch g729编码非官方已关闭评论, freeswitch, by .

一:http://code.google.com/p/fsg729/

搜索时找到.未测试过.需要inter ipp支持

Codec g.729 for FreeSWITCH with ipp library.

 

IPP需要付费$199

以下网站内的ipp未测试过,留做备注用

https://github.com/opentelecoms-org/ipp_audio_codecs

 

 

二:  itu http://github.com/Deepwalker/fs_itu_g729 不过好像被和谐了,其他地方有找到下载

 

三:http://code.google.com/p/libg729/

freeswitch log 模块

11.30.2012, freeswitch log 模块已关闭评论, freeswitch, by .

转自:http://blog.csdn.net/perfectpdl/article/details/7947686

 

freeswitch支持三种日志,console,file和syslog.

mod_console实现控制台log功能, console.conf.xml 为此模块配置文件,

就两个参数,

  <settings>
    <param name="colorize" value="true"/>
    <param name="loglevel" value="info"/>
  </settings>

Colorize指定用哪些颜色,默认用统一颜色。Loglevel设置系统启动后的log级别。

此模块提供命令console,可以动态设置log级别,

freeswitch@internal>console help

USAGE:

——————————————————————————–

consolehelp

consoleloglevel [[0-7] | <loglevel_string>]

consolecolorize [on|off|toggle]

——————————————————————————–

freeswitch@internal>console log

[            loglevel]

freeswitch@internal>console loglevel 3

+OKlog level 3 [3]

+OKconsole log level set to ERR

默认包含以下级别:

console loglevel console|alert|crit|err|warning|notice|info|debug

mod_logfile.c实现记录日志到文件功能,默认记录到文件 freeswitch.log,达到一定大小后会rotate,后缀为一个时间戳。

日志文件默认放在/usr/local/freeswitch/log目录,此模块的配置文件为 logfile.conf.xml

可以在这里设置文件的保存位置,文件多大时rotate,日志级别等。

freeswitch sip 用户

11.30.2012, freeswitch sip 用户已关闭评论, freeswitch, by .

转自:http://blog.csdn.net/perfectpdl/article/details/7893264

 

Freeswitch可以作为SIP注册服务器,sip终端作为freeswitch user注册到freeswitch上,另外,freeswitch也可以通过sip协议连接外部服务,通常通过网关连接到pstn.

(1)freeswitch 用户

Freeswitch通过引入directory 概念来管理user,一个directory包含若干domain,一个domain可以包含若干个group,每个group 又分若干个真实的用户。

结构如下:

<section name=”directory”>

<domainname=”example.com”>

<groups>

<groupname=”default”>

<userid=”1001″>

<params>

<param name=”password”value=”1234″/>

</params>

</user>

</group>

</groups>

    </domain>

</section>

通常并不需要group,用户部分直接在domain下,默认域名为freeswitch的ip地址。

/usr/local/freeswitch/conf/directory/目录为user配置及保存的位置

当freeswitch收到注册包时首先根据sip from或者to头中的domain查找directory目录下面的用户,freeswitch默认使用的域名为服务器ip,可以通过在控制台上执行sofia status查看。

如果想让服务器使用域名,客户端注册时用域名方式注册,需要修改vars.xml配置文件,设置默认域名。

/usr/local/freeswitch/conf/directory/default.xml为directory主配置文件,这里指定域名,组;系统默认组为default,

此组下的用户都在/usr/local/freeswitch/conf/directory/default/目录下,默认有20个账号。

所以,在default组中添加新账号的步骤:

1.       /usr/local/freeswitch/conf/directory/default/添加xml用户文件,拷贝此目录下其中一个即可,然后再稍作改动。

[root@openser-devdefault]# cp 1000.xml  1111.xml

把1111.xml 中的1000都改成1111,密码为全局密码(vars.xml中配置)1234

2.       修改dialplan;freeswitch对注册到自己的用户的dialplan为cconf/dialplan/default.xml中的Local_Extension部分,

把1111添加到匹配中。

^(10[01][0-9]|1111)$

<conditionfield=”destination_number” expression=”^(10[01][0-9]|1111)$”>

3.       重新加载配置 reloadxml,注册,呼叫 1111

采用多group的一个好处是可以让freeswitch呼叫一组内用户,比如在conf/directory/default.xml里添加sales组,然后再里面添加1001,1002,1003用户,然后再dialplan里添加

<extension name=”group_dial_sales”>

<conditionfield=”destination_number”expression=”^2000$”>

<actionapplication=”bridge”data=”group/sales@${domain_name}”/>

</condition>

</extension>

当用户拨打2000时,freeswitch会同时呼叫salses组里的所有用户,一旦第一个用户应答,停止呼叫其他用户,这与asterisk或者其他pbx里面的队列呼叫策略类似,asteirsk中叫ringall.

也可以在控制台用group_call命令呼叫一个组,这里为group_call salses.

freeswitch与外部网关链接

11.30.2012, freeswitch与外部网关链接已关闭评论, freeswitch, by .

转自:http://blog.csdn.net/perfectpdl/article/details/7893252

 

注册到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 音视频编码支持

11.30.2012, freeswitch 音视频编码支持已关闭评论, freeswitch, by .

转自:http://blog.csdn.net/perfectpdl/article/details/7857961

 

关于编码理论,可以看维基 http://en.wikipedia.org/wiki/Codec

1. freeswtich对高清(HD)语音编码的支持

freeswitch支持 大部分高清语音编码,包括Speex,G.722,G.722.1(Siren) 及SILK,与之对比,asterisk 1.8版本之前只支持采样为8000的常用语音编码,1.10后asterisk开始从新架构其media codec模块,以全面支持高清等宽频语音编码。

2.有些语音编码以模块方式加载(G729等),有的则属于freeswitch core部分(G711),系统默认不加载所有语音编码,对于没有加载的编码,可以通过配置

modules.conf.xml配置,在fs_cli上 执行 “show codec” 会显示当前系统已经加载的编码:

type,name,ikey
codec,ADPCM (IMA),mod_spandsp
codec,AMR,mod_amr
codec,G.711 alaw,CORE_PCM_MODULE
codec,G.711 ulaw,CORE_PCM_MODULE
codec,G.722,mod_spandsp
codec,G.723.1 6.3k,mod_g723_1
codec,G.726 16k,mod_spandsp
codec,G.726 16k (AAL2),mod_spandsp
codec,G.726 24k,mod_spandsp
codec,G.726 24k (AAL2),mod_spandsp
codec,G.726 32k,mod_spandsp
codec,G.726 32k (AAL2),mod_spandsp
codec,G.726 40k,mod_spandsp
codec,G.726 40k (AAL2),mod_spandsp
codec,G.729,mod_g729
codec,GSM,mod_spandsp
codec,H.261 Video (passthru),mod_h26x
codec,H.263 Video (passthru),mod_h26x
codec,H.263+ Video (passthru),mod_h26x
codec,H.263++ Video (passthru),mod_h26x
codec,H.264 Video (passthru),mod_h26x
codec,LPC-10,mod_spandsp
codec,PROXY PASS-THROUGH,CORE_PCM_MODULE
codec,PROXY VIDEO PASS-THROUGH,CORE_PCM_MODULE
codec,Polycom(R) G722.1/G722.1C,mod_siren
codec,RAW Signed Linear (16 bit),CORE_PCM_MODULE
codec,Speex,mod_speex
codec,iLBC,mod_ilbc

以模块方式加载的编码在目录 src\mod\codecs下面,所以如果我们想添加自己的编码,在此目录下参考其他实现即可,freeswitch对新编码的添加接口也及其简单,主要为注册几个四个回调,init,encode,decode,destroy,然后通过 switch_core_codec_add_implementation 把这几个回调的实现注册进去。

3. 设置编码的优先级

vars.xml可以设置系统默认使用的编码,为全局设置,下面两个变量,一个表示呼入,一个表示呼出。

<X-PRE-PROCESS cmd="set" data="global_codec_prefs=G722,PCMA,PCMU,GSM"/>
<X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=G722,PCMA,PCMU,GSM"/>

同时,不同的协议类型(SIP,和H323等)可以设置自己的编码优先级,比如采用SIP协议时,可以在

sofia.conf.xml

<settings>
 <param name="inbound-codec-prefs" value="$${global_codec_prefs}"/>
 <param name="outbound-codec-prefs" value="$${global_codec_prefs}"/>
</settings>

这里,SIP协议类型继承了vars.xml的全局设置(呼入,呼出)。

 

dialplan内也可设置编码

<action application=”bridge” data=”{codec_string=’PCMU’}sofia/gw1/1234″ />

 

4. 对编解码转换的支持

(1)作为B2BUA,freeswitch支持大部分音频编码的转换,但无视频编码转换功能。

(2)对于语音编码 G721 / G728 / G719 / AMR,只支持转发,不支持转换。

(3)freeswitch支持的视频编码 (只转发)

  • H261 – H.261 Video
  • H263 – H.263 Video
  • H263-1998 – H.263-1998 Video
  • H263-2000 – H.263-2000 Video
  • H264 – H.264 Video
    • Provided by mod_h26X.
  • Theora passthrough.
    • Provided by mod_theora.
  • MP4 Video passthrough.
    • Provided by mod_mp4v.

(4)媒体代理

freeswitch对媒体的处理有三种方式:

a.默认方式:媒体通过freeswitch,

RTP被freeswtich转发,

freeswitch控制编码的协商并在协商不一致时提供语音编码转换能力,

支持录音,二次拨号等。

b.代理模式: 媒体通过freeswitch转发,但是不处理媒体

RTP通过freewtich转发(只改动sdp c= ip)

freeswtich不控制 sdp参数,只是转发。

通话的终端必须有一致的语音或者视频编码,因为freeswitch此时不支持转码(适合视频编码)

不支持录音, 二次拨号等功能

c.不转发也不处理媒体

此模式下freeswitch更像是一个信令proxy,媒体不会通过freeswitch,sdp消息体也不做修改,没有录音,二次拨号等功能。

三种方式在不同应用场景下各有优点,对于a,也是默认方式,更适合呼叫中心等富功能应用,但性能相比其他两个也是最差的,对于b,更适合处理nat问题,

可以考虑用这种模式做一个session border controlor,也适合于外部MCU配合做为视频会议,性能也明显好于a,对于 c,更像是一个信令代理,性能最高,但提供的功能有限。

Sofia ,FreeSWITCH的SIP 协议实现的模块

11.28.2012, Sofia ,FreeSWITCH的SIP 协议实现的模块已关闭评论, freeswitch, by .

来自:http://hi.baidu.com/cococup/item/b7aa4917f38052a5ffded52d

 

Sofia 是FreeSWITCH使用的一个SIP 协议栈 。

在mod模块目录下是mod_sofia.dll。提供了UA客户端到freeswitch的连接功能。

这个模块应该是来源于诺基亚研究中心的一个开源项目 : http://opensource.nokia.com/projects/sofia-sip/

 

当FreeSWITCH 启动的时候,它读取 conf/autoload_configs/sofia.conf.xml 文件。 该文件包含的 “X-PRE-PROCESS” 指示FreeSWITCH 去读取conf/sip_profiles/*.xml 文件。 每个*.xml 文件包含一个或多个 SIP客户端的详细描述。 

 

在 FreeSWITCH 的术语里面, UA = User Agent = Sofia Profile = SIP Profile。

 

以下描述了 FreeSWITCH 的SIP/Sofia 配置与使用方法。

Sofia 配置文件是sofia.conf.xml,该文件的详细描述在:Sofia Configuration Files.

 

  • 查看可用的网关(一般在conf/sip_profiles/external/*.xml里面设置)

        freeswitch> sofia profile <profile_name> flush_inbound_reg [<call_id>|<user@host>] [reboot]

 

  • 查看当前注册的SIP终端

    freeswitch> sofia status profile <profile name>
    freeswitch> sofia status profile default
    freeswitch> sofia status profile outbound

  • 用flush_inbound_reg指令更新或重启一个端点的配置:

        freeswitch> sofia profile <profile_name> flush_inbound_reg [<call_id>|<user@host>] [reboot]
如果没有<call_id> 或 user@host参数,将会更新所有端点

 

  • 用[<rescan>|<restart>指令重新载入配置文件:

        freeswitch> sofia profile <profile_name> [<rescan>|<restart>] reloadxml

 

  • 删除网关

        freeswitch> sofia profile <profile_name> killgw <gateway_name>

 

  • 重启网关

        freeswitch> sofia profile <profile_name> killgw <gateway_name>
        freeswitch> sofia profile <profile_name> rescan

 

  • 添加或修改一个已存在的网关(不影响当前通话)
    freeswitch> sofia profile external rescan reloadxml

 

  • 查看调试信息:

        freeswitch> sofia loglevel <all|default|tport|iptsec|nea|nta|nth_client|nth_server|nua|soa|sresolv|stun> [0-9]

        “all” 将会改变所有的组件的调试记录信息

        以下是关闭所有调试输出

        freeswitch> sofia loglevel all 0

FreeSWITCH中lua实例1:实现呼叫中心中电话接通前播放坐席号码的效果

11.28.2012, FreeSWITCH中lua实例1:实现呼叫中心中电话接通前播放坐席号码的效果已关闭评论, freeswitch, by .

转自:http://blog.csdn.net/jizha/article/details/7570447

 

实现效果:

客户A打入呼叫中心,假设是座席B(号码是11102)负责接听,则在B接听前,向A播放“11102话务员为您服务”。

实现该功能的脚本名称是speakworknumber.lua

实现步骤:

1、添加两个号码:1000和11102,1000作为模拟客户,11102作为座席

      目录:/usr/local/freeswitch/conf/directory/default

      添加文件: 1000.xml  11102.xml

2、添加拨号方案,调用功能脚本speakworknumber.lua

      修改文件:/usr/local/freeswitch/conf/dialplan/default.xml

      添加如下内容:

view plaincopyprint?

  1. <extension name=”speakdemo”>
  2. <condition field=”destination_number” expression=”^9999$”>
  3. <action application=”lua” data=”speakworknumber.lua”/>
  4. </condition>
  5. </extension>
   <extension name="speakdemo">
      <condition field="destination_number" expression="^9999$">
        <action application="lua" data="speakworknumber.lua"/>
      </condition>
    </extension>

3、添加脚本speakworknumber.lua

      目录:/usr/local/freeswitch/scripts

      脚本内容如下:

view plaincopyprint?

  1. session1 = session;  
  2. session2 = freeswitch.Session(“user/11102”);  
  3. local waitTimes = 20;  
  4. –如果座席所在的那条通道还没准备好,则进行等待  
  5. while session2:ready() == false and waitTimes > 0 do
  6.      waitTimes = waitTimes – 1;  
  7. end  
  8. –播放语音提示音  
  9. –播放数字11102  
  10. session:say(“11102”, “en”, “name_spelled”, “pronounced”);  
  11. –播放录音文件“号话务员为您服务”  
  12. session1:streamFile(“serviceforyou.wav”);  
  13. if session2:ready() == true then  
  14.      freeswitch.consoleLog(“err”,”\n start to bridge.\n”);  
  15.      — 接通客户与座席  
  16.      freeswitch.bridge(session1, session2);  
  17. else
  18.      freeswitch.consoleLog(“err”, “\n channels2 is not ready, please check it.”);  
  19. end 
session1 = session;
session2 = freeswitch.Session("user/11102");

local waitTimes = 20;

--如果座席所在的那条通道还没准备好,则进行等待
while session2:ready() == false and waitTimes > 0 do
     waitTimes = waitTimes - 1;
end

--播放语音提示音
--播放数字11102
session:say("11102", "en", "name_spelled", "pronounced");
--播放录音文件“号话务员为您服务”
session1:streamFile("serviceforyou.wav");

if session2:ready() == true then
     freeswitch.consoleLog("err","\n start to bridge.\n");
     -- 接通客户与座席
     freeswitch.bridge(session1, session2);

else
     freeswitch.consoleLog("err", "\n channels2 is not ready, please check it.");
end

4、启动FreeSWITCH或使用reloadxml重新载入配置文件

5、使用软电话客户端登陆1000和11102。然后使用1000拨打9999进行测试。

FreeSWITCH中的lua操作小结

11.28.2012, FreeSWITCH中的lua操作小结已关闭评论, freeswitch, by .

转自:http://blog.csdn.net/jizha/article/details/6794920

 

lua中设置当前通道变量:
方法一:
session:setVariable(“fullName”, “xxxxx”);–需判断session是否为空
方法二:
local uuid =getUUID(callerid);
local res=api:executeString(“uuid_setvar “.. uuid ..” fullName “..”xxxxxxx”)
该处设置的变量可以是通道中本没有的变量,设置完了后,在其他地方就可以引用该变量。

lua中设置全局通道变量(在vars.xml中设置)
local ucall_ip = api:executeString(“global_setvar qt_ucall_ip_port 192.168.0.32:9090”);

获取当前的通道变量
local callee_num=session:getVariable(“qt_ucall_callee”);

获取全局通道变量
local ucall_ip = api:executeString(“global_getvar qt_ucall_ip_port”);

获取当前会话uuid
session:get_uuid()

获取当前路径
–USwitch的当前安装目录
syspath = tostring(api:execute(“global_getvar”, “base_dir”));

使用uuid_transfer将当前对话的两个号码同时转入会议中
local trf1=”uuid_transfer ” .. guestuuid .. ” -both ” .. conferenceNum;
OutputConsoleLog(“info” , scriptname ..”: try to get guestNum to conference,command is{“..trf1..”}”);
api:executeString(trf1);

外呼方法总结:
originate user/11103 139316095XX
originate sofia/external/139316095XX@192.168.2.34 &playback(calloutmusic/welcometoyou.mp3)
originate loopback/139316095XX &playback(calloutmusic/20110126164156.mp3)

在lua脚本中放一段录音
session:streamFile(“notonduty.wav”);

判断会话是否已建立
session:ready()==true

挂断当前会话
session:hangup();

将当前会话休眠一段时间
session:sleep(5000);

发起http请求
local http = require(“socket.http”);
–发起http请求,并获取返回结果
local e = http.request(url);

两个FreeSWITCH如何互联

11.28.2012, 两个FreeSWITCH如何互联已关闭评论, freeswitch, by .

转自:http://blog.csdn.net/jizha/article/details/6838384

 

note: 以下FreeSWITCH简称FS,FreeSWITCH BoxA简称FSA,FreeSWITCH BoxB简称FSB。

简介

如何你需要将两个FreeSWITCH系统互联,那你要如何做呢?

讨论

有两种实现方法:ip地址认证摘要认证简短的说,使用ip地址认证方法的话,就可以使用ACL来实现两个FS互联。所有的呼叫都是从公共拨号方案走(public context)。每个FS都允许对方通过ACL拨打过来。只要修改部分xml配置文件即可实现

基于IP认证互联

假设FSA(10.0.0.1)拥有的号码范围是1000-1019.FSB(10.10.0.1)号码范围是1100-1119.

首先我们要确保两个FS都拥有互访的权限

这个在ACL文件(autoload_config/acl.conf.xml)中进行配置。对于FSA,在节点添加如下内容:

对于FSB,在节点中添加如下内容:

设置呼叫拨号方案

现在两个FS已经可以互相拨打,但它们仍不知道对方有哪些分机号。因此你需要告诉FS呼叫要送到哪里。这就是传说中的呼叫路由,由拨号方案中的bridge方法实现。该方法使用internal sofia profile(sip_profiles/internal.xml)来实现。尽管名字叫做内部(internal),并不仅仅处理FS内部的呼叫。

在FSA的拨号方案(dialplan/default.xml)中添加如下内容:

在FSB的拨号方案(dialplan/default.xml)中添加如何内容:

设置public拨号方案

经过上面设置,现在呼叫已经可以送到对方的平台上了。但是对方平台仍然不知道该怎么处理这个呼入的请求,因为对于它来说这是一个公共呼叫(public call)。因此还需要最后一步修改让系统跑起来。我们要告诉FS把这个公共呼叫(public call)给路由到默认的拨号方案上去(default dialplan)。

在FSA的公共拨号方案(public dialplan,dialplan/public.xml)中添加如下内容:

在FSB的公共拨号方案(public dialplan,dialplan/public.xml)中添加如下内容:

在FSA和FSB中执行下述命令: >reloadacl >reloadxml

现在你就可以在FSA上呼叫FSB的11XX了,反之亦然。

基于摘要认证互联

待补全

小结

两个方法没有优劣之分,使用哪种由你选择。

原文链接:http://wiki.freeswitch.org/wiki/Connect_Two_FreeSWITCH_Boxes

freeswitch在多网卡服务器下如何配置

11.28.2012, freeswitch在多网卡服务器下如何配置已关闭评论, freeswitch, by .

转自:http://blog.csdn.net/jizha/article/details/6829886

 

HowTo:freeswitch在多网卡服务器下如何配置

edit by jizhask, 2011-10-20

关于如何指定FreeSWITCH使用多网卡服务器上的某一个IP地址,FS官网给了新的方法,如下:

设置方法:

1、修改文件internal.xml和external.xml

位置:/usr/local/freeswitch/conf/sip_profiles/internal.xml

修改内容:

<param name=”rtp-ip” value=”192.168.1.3″/>
<param name=”sip-ip” value=”192.168.1.3″/>

注:192.168.1.3为指定的IP地址

2、修改文件sofia.conf.xml

位置:/usr/local/freeswitch/conf/autoload_configs/sofia.conf.xml

修改内容:

<param name=”auto-restart” value=”false”/>

该属性设置的目的是防止FS在检测到IP地址发生改变后,自动重启sofia模块。

3、重启FreeSWITCH,开始测试。

over.

下面是旧的设置方法,不担保是否有问题———————————————————-

本篇教程基于Centos 5.5下面的FreeSWITCH1.0.6,使用的是FreeSWITCH自带的样例配置文件。

服务器网络配置如下:
        eth0:连接公网,拥有动态IP(使用DHCP获取)
        eth1:连接内网,拥有静态IP
该教程假设已经有一个号码为1000的sip话机连接到系统上,用于呼入呼出。系统默认配置文件
位于/usr/local/freeswitch/conf.
下面为具体的设置步骤:
1、打开conf目录下的vars.xml文件,并做如下修改:
    1)查找变量domain,并修改为公网IP地址或DNS地址
            <X-PRE-PROCESS cmd=”set” data=”domain=(公网IP)”/>
    2)移动到文件末尾,增加如下变量
        其中,$${local_ip_v4}代表系统所在的公网地址,192.168.100.1是用于连接内网的私有IP地址
            <X-PRE-PROCESS cmd=”set” data=”external_sip_ip=$${local_ip_v4}”/>
            <X-PRE-PROCESS cmd=”set” data=”external_rtp_ip=$${local_ip_v4}”/>
            <X-PRE-PROCESS cmd=”set” data=”internal_sip_ip=192.168.100.1″/>
            <X-PRE-PROCESS cmd=”set” data=”internal_rtp_ip=192.168.100.1″/>
2、修改sip的external与internal配置文件
    打开sip_profile/external.xml文件,反注释下面的行:
        <param name=”force-register-domain” value=”$${domain}”/>
        <param name=”force-register-db-domain” value=”$${domain}”/>
        <param name=”dbname” value=”share_presence”/>
        <param name=”presence-hosts” value=”$${domain}”/>
    打开sip_profile/internal.xml文件,反注释相同的行:
        <param name=”force-register-domain” value=”$${domain}”/>
        <param name=”force-register-db-domain” value=”$${domain}”/>
        <param name=”dbname” value=”share_presence”/>
        <param name=”presence-hosts” value=”$${domain}”/>
3、向sip profile中添加网关配置           
打开文件sip_profile/external/example.xml,进行必要的修改,以便连接到sip服务提供商那。具体的配置教程很多,不再详述。需要注意的是要将网关名称改为“multi-example”,后面会用到。
    <gateway name=”multi-example”>
4、添加由上一步添加的网关呼入的路由
为了让系统可以正确的路由DID,需要修改拨号方案文件:dialplan/public/00_inbound_did.xml。根据sip provider传递过来的目标号码,修改destination_number表达式的值,如下:
修改前:  <condition field=”destination_number” expression=”^(phonenumber)$”>
修改后:  <condition field=”destination_number” expression=”^(4075551234)$”>
5、修改呼出路由,应用上面添加的网关配置
为了能让系统跑起来并运行正常,最后要修改的配置是在呼叫路由中添加第三步中配置的sip provider。修改文件dialplan/default/01_example.com.xml,并做如下修改:
找到<extension name=”domestic.example.com”> 所在的块,
    修改前: <action application=”bridge” data=”sofia/gateway/${default_gateway}/$1″/>
    修改后: <action application=”bridge” data=”sofia/gateway/multi-example /$1″/>
6、最后一步,重新加载配置文件和sip模块
    >reloadxml
    >reload mod_sofia
   或者,直接重启FreeSWITCH。
   所有的操作完成后,就可以拨打你所配置的DID号码,紧接着你的sip话机就会开始振铃。同样,也可以通过sip话机拨打外线电话。
原文地址:http://wiki.freeswitch.org/wiki/Multi_Homed_Dual_NIC_How_To