吴伟贤のBlog

Feed Rss

freeswitch originate 回拨

09.16.2013, freeswitch originate 回拨已关闭评论, freeswitch, by .

转自:http://www.8000hz.com/archives/freeswitch-originate.html

 

需求

回拨, 外呼

命令行

呼通主叫后, 转到拨号方案

originate user/1000 2000 XML default

呼通主叫后, 播放XML IVR

originate {origination_caller_id_number=137XXXX4955,origination_caller_id_name=137XXXX4955}sofia/external/180XXXX9957@10.0.1.2:5060 &ivr(demo_ivr)

呼通主叫后, 执行脚本, 不带参数

originate {origination_caller_id_number=137XXXX4955,origination_caller_id_name=137XXXX4955}sofia/external/180XXXX9957@10.0.1.202:9080 &lua(demo_ivr.lua)

呼通主叫后, 执行脚本, 带参数

originate {origination_caller_id_number=137XXXX4955,origination_caller_id_name=137XXXX4955}sofia/external/180XXXX9957@10.0.1.202:9080 '&lua(dy_ivr.lua tier)'

更进一步
默认originate是阻塞的, 使用 bgapi 实现非阻塞回拨.

例如

bgapi originate {origination_caller_id_number=13771114955,origination_caller_id_name=13771114955}sofia/external/18051799957@10.0.1.2:5060 &ivr(demo_ivr)

应用
可以使用shell&fs_cli, esl, xml_rpc 外部控制FreeSWITCH进行外呼或回拨, 以实现批量外呼.

Freeswitch点亮话机上的留言灯

09.16.2013, Freeswitch点亮话机上的留言灯已关闭评论, freeswitch, by .

转自:http://www.8000hz.com/archives/freeswitch-mwi-message.html

准备

话机是要注册到Freeswitch上
已经安装mod_lua

点灯  lighting.lua

local event = freeswitch.Event("SWITCH_EVENT_MESSAGE_WAITING");
event:addHeader("MWI-Messages-Waiting", "yes");
event:addHeader("MWI-Message-Account", "5001@p.8000hz.com");
event:addHeader("MWI-Voice-Message", "1/0");
event:fire();

灭灯 lightsoff.lua

local event_t = freeswitch.Event("SWITCH_EVENT_MESSAGE_WAITING");
event_t:addHeader("MWI-Messages-Waiting", "no");
event_t:addHeader("MWI-Message-Account", "5001@p.8000hz.com");
event_t:addHeader("MWI-Voice-Message", "0/0");
event_t:fire();

将内容保存到脚本目录

打开fs_cli

执行

lua lighting.lua

lua lightsoff.lua

查看话机上的 MESSAGE 灯的变化.

FreeSWITCH 显示号码

09.16.2013, FreeSWITCH 显示号码已关闭评论, freeswitch, by .

来自:http://www.8000hz.com/archives/124.html

sip_cid_type 

变量说明

修改外呼时显示的号码的方式, 可以设置为 none, default, pid, 和 rpid(默认)

rpid=Remote-Party-ID header
pid=P-Asserted-Identity header
none=主叫显示号码会在SIP的From 头中

用法

{sip_cid_type=none}sofia/default/user@example.com
显示号码,不携带其他字段,使用from

{sip_cid_type=rpid}sofia/default/user@example.com
显示号码,携带Remote-Party-ID字段

协议:
Remote-Party-ID: "9094445555" <sip:9094445555@1.2.3.4>;party=calling;screen=yes;privacy=off

{sip_cid_type=pid}sofia/default/user@example.com
显示号码,携带P-Asserted-Identity

协议: 
P-Asserted-Identity: "9094445555" <sip:9094445555@1.2.3.4>

{sip_cid_type=rpid,origination_caller_id_name=test,origination_caller_id_number=1234}sofia/default/user@example.com
显示号码,使用Remote-Party-ID显示自己指定的号码和姓名

{sip_cid_type=rpid,origination_caller_id_name=test,origination_caller_id_number=1234,origination_privacy=screen+hide_name+hide_number}sofia/default/user@example.com
显示为私人号码

{sip_cid_type=none,origination_caller_id_name=anonymous,origination_caller_id_number=anonymous}sofia/default/user@example.com
显示为私人号码,不同系统可能不同。

freeswitch 动态加载directory用户 http_cache xml_curl

09.15.2013, freeswitch 动态加载directory用户 http_cache xml_curl已关闭评论, freeswitch, by .

freeswitch安装完成后默认的是用静态配置文件的方式加载号码本
这对于动态注册的用户,无法实时同步
需要系统reloadxml后号码才能呼入

对于商业系统来说这是无法接受的

xml_curl模块
xml_curl模块主要作用是可以实现将freeswitch的相关xml配置文件通过webserver的方式管理,如下图,当在freeswitch开启了xml_curl接口的时候,通过配置文件,比如将freeswitch的注册用户都通过webserver来管理,这样当有用户注册请求发给freeswitch的时候,就会向webserver发起request请求,webserver返回一个XML,从而实现对freeswitch的配置文件进行管理。

设置
第一步 找到 modules.conf.conf 文件 去掉注释 重新编译

第二步 修改 xml_curl.cong.xml

重点是 http://example1.com:80/fsapi 这个为http接口地址

 

可以通过xml_curl debug_on将其Debug模式打开,观察详细的日志。

详细参考 http://wiki.freeswitch.org/wiki/Mod_xml_curl

 

 

http_cache 模块

      配置类似于xml_curl模块,详细参考

http://wiki.freeswitch.org/wiki/Mod_http_cache

 

 

Windows不重启就使环境变量PATH修改生效

09.14.2013, Windows不重启就使环境变量PATH修改生效已关闭评论, windows, by .

在“我的电脑”->“属性”->“高级”->“环境变量”中增加或修改环境变量后,需重启系统才能使之生效。有没有什么方法可让它即时生效呢?下面介绍一种方法:

  以修改环境变量“PATH”为例,修改完成后,进入DOS命令提示符,输入:set PATH=C: ,关闭DOS窗口。再次打开DOS窗口,输入:echo %PATH% ,可以发现“我的电脑”->“属性”->“高级”->“环境变量”中设置的 PATH 值已经生效。

  不用担心DOS窗口中的修改会影响环境变量的值,DOS窗口中的环境变量只是Windows环境变量的一个副本而已。但是对副本的修改却会引发Windows环境变量的刷新,这正是我们想要的!

诡异啊,使用win+R->cmd 启动的cmd.exe 会发现在电脑属性中设置的环境变量立马生效了,在其他模式下启动的cmd却没有发生效果,怪哉!!查看了一下资料,在电脑属性中设置环境变量以后,以后启动的程序和线程会生效,而对以前驻留内存的程序不起作用,也有人说kill explorer.exe 再启动explorer.exe 可以激发设置其作用。

这里要理解的是,一个程序启动时,环境变量被复制到该程序所在的环境中,在该程序执行过程中不会被除该程序以外的其他程序所改变。也就是说,假设我们启动了一个cmd程序,然后通过控制面板修改了环境变量设置,但是已经启动了的cmd所拥有的环境变量并不会被改变。如果我们在修改环境变量之后启动cmd程序,则该程序将拥有新的环境变量。
那么结论就很明显了:修改环境变量之后,如果受影响的是应用程序,那么只要简单地重新启动此应用程序,环境变量的修改就会反映到该程序中,而不必重新启动计算机;但是,如果受影响的是系统服务,就必须重新启动才能将环境变量的修改反映到系统服务中(因为没有办法在不重启计算机的情况下重新启动系统服务管理器)。

freeswitch 两FS对呼进行压力测试

08.08.2013, freeswitch 两FS对呼进行压力测试已关闭评论, freeswitch, by .

两FS对呼 压力测试,
来自freeswitch-cn QQ群,未测试过

北京-SevenDU(93800061) 2013-07-30 11:16:09

#!/bin/bash
IP=192.168.1.20

for f in `seq 1 6`; do
for f in `seq 1 10`; do
fs_cli -x "bgapi originate {absolute_codec_string=g729}sofia/internal/loadtest@$IP:5080 

&echo"
done
sleep 2
done

asterisk OCN 050对接

08.02.2013, asterisk OCN 050对接已关闭评论, asterisk, by .

asterisk 跟OCN 050对接

一:NAT设置

不能开NAT功能,不然会认到400 Bad Request

二:sip.conf

context=default
bindaddr=0.0.0.0
port=5060
srvlookup=yes
maxexpirey=3600
defaultexpirey=3600
allowguest=no
disallow=all
allow=ulaw
allow=alaw
language=jp
dtmfmode=inband
externrefresh=60
useragent=Fletsphone/2.3 (VOIP_AD 3.00\; NTTEAST/NTTWEST)

register => 050号码@ocn.ne.jp:注册密码:注册用户@ocn/050号码

[ocn]
type=friend
secret=注册密码
username=注册用户
fromuser=050号码
fromdomain=ocn.ne.jp
host=注册地址
context=default
dtmfmode=inband
canreinvite=no
qualify=yes
insecure=invite,port
progressinband=no
nat=no

以下为asterisk register
register => user[:secret[:authuser]]@host[:port][/extension]

freeswitch internal UA conf/sip_profiles/internal.xml

07.24.2013, freeswitch internal UA conf/sip_profiles/internal.xml已关闭评论, freeswitch, by .

来自:http://www.freeswitch.org.cn/2010/08/03/di-qi-zhang-sip-mo-kuai-mod_sofia.html

conf/sip_profiles/internal.xml说明

internal.xml

internel.xml 定义了一个 profile,在本节,我们以系统默认的配置逐行来解释:

<profile name="internal">

profile 的名字就叫 internal,这个名字本身并没有特殊的意义,也不需要与文件名相同,你可以改成任何你喜欢的名字,只是需要记住它,因为很多地方要使用这个名字。

  <aliases>
    <!--   <alias name="default"/>  -->
  </aliases>

如果你喜欢,可以为该 profile 起一个别名。注意默认是加了注释的,也就是说不起作用。再说一遍,“<!– –>”在 XML 中的含义是注释。

  <gateways>
    <X-PRE-PROCESS cmd="include" data="internal/*.xml"/>
  </gateways>

即然 profile 是一个 UA,它就可以注册到别的 SIP 服务器上去,它要注册的 SIP 服务器就称为 Gateway。我们一般不在 internal 这个 profile 上使用 Gateway,这个留到 external 时再讲。

  <domains>
    <!--<domain name="$${domain}" parse="true"/>-->
    <domain name="all" alias="true" parse="false"/> 
  </domains>

定义该 profile 所属的 domain。它可以是 IP 地址,或一个 DNS 域名。需要注意,直接在 hosts 文件中设置的 IP-域名可能不好用。

  <settings>

settings 部分设置 profile 的参数。

    <!--<param name="media-option" value="resume-media-on-hold"/> -->

如果 FreeSWITCH 是没有媒体(no media)的,那么如果设置了该参数,当你在话机上按下 hold 键时,FreeSWITCH 将会回到有媒体的状态。

那么什么叫有媒体无媒体呢?如下图,bob 和 alice 通过 FreeSWITCH 使用 SIP 接通了电话,他们谈话的语音(或视频)数据要通过 RTP 包传送的。RTP 可以 像 SIP 一样经过 FreeSWITCH 转发,但是,RTP 占用很大的带宽,如果 FreeSWITCH 不需要“偷听”他们谈话的话,为了节省带宽,完全可以让 RTP 直接在两者间传送,这种情况对 FreeSWITCH 来讲就是没有 media 的,在 FreeSWITCH 中也称 bypass media(绕过媒体)。

                FreeSWITCH
          SIP /            \ SIP
            /                \
        bob  ------RTP------  alice

.

    <!--<param name="media-option" value="bypass-media-after-att-xfer"/>-->

Attended Transfer 称为出席转移,它需要 media 才能完成工作。但如果在执行 att-xfer 之前没有媒体,该参数能让 att-xfer 执行时有 media,转移结束后再回到 bypass media 状态。

    <!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->

不用解释,就是设置 SIP 消息中显示的 User-Agent 字段。

    <param name="debug" value="0"/>

debug 级别。

    <!-- <param name="shutdown-on-fail" value="true"/> -->

由于各种原因(如端口被占用,IP地址错误等),都可能造成 UA 在初始化时失败,该参数在失败时会停止 FreeSWITCH。

    <param name="sip-trace" value="no"/>

是否开启 SIP 消息跟踪。另外,也可以在控制台上用以下命令开启和关闭 sip-trace:

sofia profile internal siptrace on
sofia profile internal siptrace off

.

    <param name="log-auth-failures" value="true"/>

是否将认证错误写入日志。

    <param name="context" value="public"/>

context 是 dialplan 中的环境。在此指定来话要落到 dialplan 的哪个 context 环境中。需要指出,如果用户注册到该 profile 上(或是经过认证的用户,即本地用户),则用户目录(directory)中设置的 contex 优先级要比这里高。

    <param name="rfc2833-pt" value="101"/>

设置 SDP 中 RFC2833 的值。RFC2833 是传递 DTMF 的标准。

    <param name="sip-port" value="$${internal_sip_port}"/>

监听的 SIP 端口号,变量 internal_sip_port 在 vars.xml 中定义,默认是 5060。

    <param name="dialplan" value="XML"/>

设置对应默认的 dialplan。我们后面会专门讲 dialplan。

    <param name="dtmf-duration" value="2000"/>

设置 DTMF 的时长。

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

支持的来话语音编码,用于语音编码协商。global_codec_prefs 是在 vars.xml中定义的。

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

支持的去话语音编码。

    <param name="rtp-timer-name" value="soft"/>

RTP 时钟名称

    <param name="rtp-ip" value="$${local_ip_v4}"/>

RTP 的 IP 地址,仅支持 IP 地址而不支持域名。虽然 RTP 标准说应该域名,但实际情况是域名解析有时不可靠。

    <param name="sip-ip" value="$${local_ip_v4}"/>

SIP 的 IP。不支持域名。

    <param name="hold-music" value="$${hold_music}"/>

UA 进行 hold 状态时默认播放的音乐。

    <param name="apply-nat-acl" value="nat.auto"/>

使用哪个 NAT ACL。

    <!-- <param name="extended-info-parsing" value="true"/> -->

扩展 INFO 解析支持。

    <!--<param name="aggressive-nat-detection" value="true"/>-->

NAT穿越,检测 SIP 消息中的 IP 地址与实际的 IP 地址是否相符,详见 NAT穿越。

    <!--
    There are known issues (asserts and segfaults) when 100rel is enabled.
    It is not recommended to enable 100rel at this time.
    -->
    <!--<param name="enable-100rel" value="true"/>-->

该功能暂时还不推荐使用。

    <!--<param name="enable-compact-headers" value="true"/>-->

支持压缩 SIP 头。

    <!--<param name="enable-timer" value="false"/>-->

开启、关闭 SIP 时钟。

    <!--<param name="minimum-session-expires" value="120"/>-->

SIP 会话超时值,在 SIP 消息中设置 Min-SE。

    <param name="apply-inbound-acl" value="domains"/>

对来话采用哪个 ACL。详见 ACL。

    <param name="local-network-acl" value="localnet.auto"/>

默认情况下,FreeSWITCH 会自动检测本地网络,并创建一条 localnet.auto ACL 规则。

    <!--<param name="apply-register-acl" value="domains"/>-->

对注册请求采用哪个 ACL。

    <!--<param name="dtmf-type" value="info"/>-->

DTMF 收号的类型。有三种方式,info、inband、rfc2833。

  • info 方式是采用 SIP 的 INFO 消息传送 DTMF 按键信息的,由于 SIP 和 RTP 是分开走的,所以,可能会造成不同步。
  • inband 是在 RTP 包中象普通语音数据那样进行带内传送,由于需要对所有包进行鉴别和提取,需要占用更多的资源。
  • rfc2833 也是在带内传送,但它的 RTP 包有特殊的标记,因而比 inband 方式节省资源。它是在 RFC2833 中定义的。
      <!-- 'true' means every time 'first-only' means on the first register -->
      <!--<param name="send-message-query-on-register" value="true"/>-->
    

如何发送请求消息。true 是每次都发送,而 first-only 只是首次注册时发送。

<!--<param name="caller-id-type" value="rpid|pid|none"/>-->

设置来电显示的类型,rpid 将会在 SIP 消息中设置 Remote-Party-ID,而 pid 则会设置 P-*-Identity,如果不需要这些,可以设置成 none。

    <param name="record-path" value="$${recordings_dir}"/>

录音文件的默认存放路径。

    <param name="record-template" value="${caller_id_number}.${target_domain}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>

录音文件名模板。

    <param name="manage-presence" value="true"/>

是否支持列席。

    <!--<param name="manage-shared-appearance" value="true"/>-->

是否支持 SLA – Shared Line Apperance。

    <!--<param name="dbname" value="share_presence"/>-->
    <!--<param name="presence-hosts" value="$${domain}"/>-->

这两个参数用以在多个 profile 间共享列席信息。

    <!-- This setting is for AAL2 bitpacking on G726 -->
    <!-- <param name="bitpacking" value="aal2"/> -->

    <!--<param name="max-proceeding" value="1000"/>-->

最大的开放对话(SIP Dialog)数。

    <!--session timers for all call to expire after the specified seconds -->
    <!--<param name="session-timeout" value="120"/>-->

会话超时时间。

    <!-- Can be 'true' or 'contact' -->
    <!--<param name="multiple-registrations" value="contact"/>-->

是否支持多点注册,可以是 contact 或 true。开启多点注册后多个 UA 可以注册上来,有人呼叫这些 UA 时所有 UA 都会振铃。

    <!--set to 'greedy' if you want your codec list to take precedence -->
    <param name="inbound-codec-negotiation" value="generous"/>

SDP 中的语音编协商,如果设成 greedy,则自己提供的语音编码列表会有优先权.

    <!-- if you want to send any special bind params of your own -->
    <!--<param name="bind-params" value="transport=udp"/>-->

    <!--<param name="unregister-on-options-fail" value="true"/>-->

为了 NAT 穿越或 keep alive,如果 FreeSWITCH 向其它网关注册时,可以周期性地发一些 OPTIONS 包,相当于 ping 功能。该参数说明当 ping 失败时是否自动取消注册。

    <param name="tls" value="$${internal_ssl_enable}"/>

是否支持 TLS,默认否。

    <!-- additional bind parameters for TLS -->
    <param name="tls-bind-params" value="transport=tls"/>
    <!-- Port to listen on for TLS requests. (5061 will be used if unspecified) -->
    <param name="tls-sip-port" value="$${internal_tls_port}"/>
    <!-- Location of the agent.pem and cafile.pem ssl certificates (needed for TLS server) -->
    <param name="tls-cert-dir" value="$${internal_ssl_dir}"/>
    <!-- TLS version ("sslv23" (default), "tlsv1"). NOTE: Phones may not work with TLSv1 -->
    <param name="tls-version" value="$${sip_tls_version}"/>

下面都是与 TLS 有关的参数,略。

    <!--<param name="rtp-autoflush-during-bridge" value="false"/>-->

该选项默认为 true。即在桥接电话是是否自动 flush 媒体数据(如果套接字上已有数据时,它会忽略定时器睡眠,能有效减少延迟)。

    <!--<param name="rtp-rewrite-timestamps" value="true"/>-->

是否透传 RTP 时间戳。

    <!--<param name="pass-rfc2833" value="true"/>-->

是否透传 RFC2833 DTMF 包。

    <!--<param name="odbc-dsn" value="dsn:user:pass"/>-->

使用 ODBC 数据库代替默认的 SQLite。

    <!--<param name="inbound-bypass-media" value="true"/>-->

将所有来电设置为媒体绕过。

    <!--<param name="inbound-proxy-media" value="true"/>-->

将所有来电设置为媒体透传。

    <!--Uncomment to let calls hit the dialplan *before* you decide if the codec is ok-->
    <!--<param name="inbound-late-negotiation" value="true"/>-->

对所有来电来讲,晚协商有助于在协商媒体编码之前,先前电话送到 Dialplan,因而在 Dialplan 中可以进行个性化的媒体协商。

    <!-- <param name="accept-blind-reg" value="true"/> -->     

该选项允许任何电话注册,而不检查用户和密码及其它设置。

    <!-- <param name="accept-blind-auth" value="true"/> -->

与上一条类似,该选项允许任何电话通过认证。

    <!-- <param name="suppress-cng" value="true"/> -->

抑制 CNG。

    <param name="nonce-ttl" value="60"/>

SIP 认证中 nonce 的生存时间。

    <!--<param name="disable-transcoding" value="true"/>-->

禁止译码,如果该项为 true 则在 bridge 其它电话时,只提供与 a-leg 兼容或相同的语音编码列表进行协商,以避免译码。

    <!--<param name="manual-redirect" value="true"/> -->     

允许在 Dialplan 中进行人工转向。

    <!--<param name="disable-transfer" value="true"/> -->

禁止转移。

    <!--<param name="disable-register" value="true"/> -->

禁止注册。

    <!-- Used for when phones respond to a challenged ACK with method INVITE in the hash -->
    <!--<param name="NDLB-broken-auth-hash" value="true"/>-->
    <!-- add a ;received="<ip>:<port>" to the contact when replying to register for nat handling -->
    <!--<param name="NDLB-received-in-nat-reg-contact" value="true"/>-->

    <param name="auth-calls" value="$${internal_auth_calls}"/>

是否对电话进行认证。

    <!-- Force the user and auth-user to match. -->

    <param name="inbound-reg-force-matching-username" value="true"/>

强制用户与认证用户必须相同。

    <param name="auth-all-packets" value="false"/>

在认证时,对所有 SIP 消息都进行认证,而不是仅针对 INVITE 消息。

    <!-- external_sip_ip
      Used as the public IP address for SDP.
      Can be an one of:
           ip address            - "12.34.56.78"
           a stun server lookup  - "stun:stun.server.com"
           a DNS name            - "host:host.server.com"
           auto                  - Use guessed ip.
           auto-nat              - Use ip learned from NAT-PMP or UPNP
       -->
    <param name="ext-rtp-ip" value="auto-nat"/>
    <param name="ext-sip-ip" value="auto-nat"/>

设置 NAT 环境中公网的 RTP IP。该设置会影响 SDP 中的 IP 地址。有以下几种可能:

  • 一个IP 地址,如 12.34.56.78
  • 一个 stun 服务器,它会使用 stun 协议获得公网 IP, 如 stun:stun.server.com
  • 一个 DNS 名称,如 host:host.server.com
  • auto , 它会自动检测 IP 地址
  • auto-nat,如果路由器支持 NAT-PMP 或 UPNP,则可以使用这些协议获取公网 IP。
      <param name="rtp-timeout-sec" value="300"/>
    

指定的时间内 RTP 没有数据传送,则挂机。

    <param name="rtp-hold-timeout-sec" value="1800"/>

RTP 处理保持状态的最大时长。

    <!-- <param name="vad" value="in"/> -->
    <!-- <param name="vad" value="out"/> -->
    <!-- <param name="vad" value="both"/> -->

语音活动状态检测,有三种可能,可设为入、出,或双向,通常来说“出”(out)是一个比较好的选择。

    <!--<param name="alias" value="sip:10.0.1.251:5555"/>-->

给本 sip profile 设置别名。

    <!--all inbound reg will look in this domain for the users -->
    <param name="force-register-domain" value="$${domain}"/>
    <!--force the domain in subscriptions to this value -->
    <param name="force-subscription-domain" value="$${domain}"/>
    <!--all inbound reg will stored in the db using this domain -->
    <param name="force-register-db-domain" value="$${domain}"/>
    <!--force suscription expires to a lower value than requested-->
    <!--<param name="force-subscription-expires" value="60"/>-->

以上选项默认是起作用的,这有助于默认的例子更好的工作。它们会在注册及订阅时在数据库中写入同样的域信息。如果你在使用一个 FreeSWITCH 支持多个域时,不要选这些选项。

    <!--<param name="enable-3pcc" value="true"/>-->                               

该选项有两个值,true 或 poxy。 true 则直接接受 3pcc 来电;如果选 proxy,则会一直等待电话应答后才回送接受。

    <!-- use at your own risk or if you know what this does.-->
    <!--<param name="NDLB-force-rport" value="true"/>-->

在 NAT 时强制 rport。除非你很了解该参数,否则后果自负。

    <param name="challenge-realm" value="auto_from"/>

设置 SIP Challenge 是使用的 realm 字段是从哪个域获取,auto_from 和 auto_to 分别是从 from 和 to 中获取,除了这两者,也可以是任意的值,如 freeswitch.org.cn。

    <!--<param name="disable-rtp-auto-adjust" value="true"/>-->

大多数情况下,为了更好的穿越 NAT,FreeSWITCH 会自动调整 RTP 包的 IP 地址,但在某些情况下(尤其是在 mod_dingaling 中会有多个候选 IP),FreeSWITCH 可能会改变本来正确的 IP 地址。该参数禁用此功能。

    <!--<param name="inbound-use-callid-as-uuid" value="true"/>-->

在 FreeSWITCH 是,每一个 Channel 都有一个 UUID, 该 UUID 是由系统生成的全局唯一的。对于来话,你可以使用 SIP 中的 callid 字段来做 UUID. 在某些情况下对于信令的跟踪分析比较有用。

    <!--<param name="outbound-use-uuid-as-callid" value="true"/>-->

与上一个参数差不多,只是在去话时可以使用 UUID 作为 callid。

    <!--<param name="rtp-autofix-timing" value="false"/>-->

RTP 自动定时。如果语音质量有问题,可以尝试将该值设成 false。

    <!--<param name="pass-callee-id" value="false"/>-->

默认情况下 FreeSWITCH 会设置额外的 X- SIP 消息头,在 SIP 标准中,所有 X- 打头的消息头都是应该忽略的。但并不是所有的实现都符合标准,所以在对方的网关不支持这种 SIP 头时,该选项允许你关掉它。

    <!-- clear clears them all or supply the name to add or the name prefixed with ~ to remove
     valid values:

     clear
     CISCO_SKIP_MARK_BIT_2833
     SONUS_SEND_INVALID_TIMESTAMP_2833

    -->
    <!--<param name="auto-rtp-bugs" data="clear"/>-->

某些运营商的设备不符合标准。为了最大限度的支持这些设备,FreeSWITCH 在这方面进行了妥协。使用该参数时要小心。

     <!-- the following can be used as workaround with bogus SRV/NAPTR records -->
     <!--<param name="disable-srv" value="false" />-->
     <!--<param name="disable-naptr" value="false" />-->

这两个参数可以规避 DNS 中某些错误的 SRV 或 NAPTR 记录。

最后的这几个参数允许根据需要调整 sofia 库中底层的时钟,一般情况下不需要改动。

    <!-- The following can be used to fine-tune timers within sofia's transport layer 
         Those settings are for advanced users and can safely be left as-is -->

    <!-- Initial retransmission interval (in milliseconds).
        Set the T1 retransmission interval used by the SIP transaction engine. 
        The T1 is the initial duration used by request retransmission timers A and E (UDP) as well as response retransmission timer G.   -->
    <!-- <param name="timer-T1" value="500" /> -->

    <!--  Transaction timeout (defaults to T1 * 64).
        Set the T1x64 timeout value used by the SIP transaction engine.
        The T1x64 is duration used for timers B, F, H, and J (UDP) by the SIP transaction engine. 
        The timeout value T1x64 can be adjusted separately from the initial retransmission interval T1. -->
    <!-- <param name="timer-T1X64" value="32000" /> -->

    <!-- Maximum retransmission interval (in milliseconds).
        Set the maximum retransmission interval used by the SIP transaction engine. 
        The T2 is the maximum duration used for the timers E (UDP) and G by the SIP transaction engine. 
        Note that the timer A is not capped by T2. Retransmission interval of INVITE requests grows exponentially 
        until the timer B fires.  -->
    <!-- <param name="timer-T2" value="4000" /> -->

    <!--
        Transaction lifetime (in milliseconds).
        Set the lifetime for completed transactions used by the SIP transaction engine. 
        A completed transaction is kept around for the duration of T4 in order to catch late responses. 
        The T4 is the maximum duration for the messages to stay in the network and the duration of SIP timer K. -->
    <!-- <param name="timer-T4" value="4000" /> -->

  </settings>
</profile>

freeswitch 拨号计划应用APP Dialplan Applications

07.24.2013, freeswitch 拨号计划应用APP Dialplan Applications已关闭评论, freeswitch, by .

来源:https://wiki.freeswitch.org/wiki/Mod_dptools

简单GG翻译下,仅用于自己学习用。

Mod_dptools模块,提供了大量的拨号计划应用APP

应用APP Applications

A

  • answer – 接听一个信道电话Answer the call for a channel.
  • att_xfer – 出席转移Attended Transfer.

B

  • bind_digit_action – 绑定按键顺序或正则表达式的动作 Bind a key sequence or regex to an action.
  • bind_meta_app – 响应指定呼叫腿( S)在一定的DTMF序列的桥梁和执行另一个拨号方案中的应用 Respond to certain DTMF sequences on specified call leg(s) during a bridge and execute another dialplan application.
  • block_dtmf – 在信道上阻止DTMF的发送或接收 Block DTMFs from being sent or received on the channel.
  • break – 取消信道上当前正在运行的应用APP Cancel an application currently running on the channel.
  • bridge – 桥接现有的一条新信道 Bridge a new channel to the existing one.
  • bridge_export – 跟export一样,but exports across当一个信道桥接另一个Like export but exports across when one channel bridges another

C

  • capture – 捕捉数据到信道变量内 Capture data into a channel variable.
  • check_acl – 检查IP是否在ACL列表内 Check an ip against an ACL list.
  • clear_digit_action – 清除所有数字绑定 Clear all digit bindings
  • clear_speech_cache – 清除讲话手柄缓存Clear speech handle cache.
  • cluechoo – Console-only “ConCon” choo-choo traing
  • cng_plc – To perform plc on any lost packets and execute on originate. It is like execute on answer etc but only for outbound calls during originate.
  • conference – 建立一个多方会议 Establish a multi-party conference.
  • conference_set_auto_outcall – Dial string to have the conference call when started, can be used multiple times before the conference action to call multiple parties.

D

  • db – 插入信息到数据库 insert information into the database.
  • deflect – 发送呼叫转移/refer Send a call deflect/refer.
  • delay_echo – 指定的回声延迟 Echo audio at a specified delay.
  • detect_speech – 检测在一个通道上的讲话 Detect speech on a channel.
  • digit_action_set_realm – 更改绑定的realm Change binding realm.
  • displace_session – 在信道内置换音频 Displace audio on a channel.

E

  • early_hangup – 在信道上启用早期挂断 Enable early hangup on a channel.
  • eavesdrop – 侦听信道 Spy on a channel.
  • echo – 给发起通话方一个音频和视频回声 Echo audio and video back to the originator.
  • enable_heartbeat – 启用媒体心跳 Enable Media Heartbeat.
  • endless_playback – 连续播放文件来电 Continuously play file to caller.
  • enum – 执行E.164查找 Perform E.164 lookup.
  • erlang – 使用Erlang处理呼叫 Handle a call using Erlang.
  • eval – 计算一个字符串 Evaluates a string.
  • event – 触发一个事件 Fire an event.
  • execute_extension – 执行一个分机 Executes an extension.
  • export – Export a channel variable across a bridge <varname>=<value>

F

  • fax_detect – 检测到传真CNG – 可能被弃用 Detect FAX CNG – may be deprecated.
  • fifo – 将来电发送到一个FIFO队列 Send caller to a FIFO queue.
  • fifo_track_call – Count a call as a FIFO call in the manual_calls queue.
  • flush_dtmf – Flush 任何排队的DTMF Flush any queued DTMF.

G

  • gentones – 生成TGML音 Generate TGML tones.
  • group – 插入或删除群组中的成员 Insert or delete members in a group.

H

  • hangup – 挂断当前信道 Hang up the current channel.
  • hash – 向数据库添加一个hash Add a hash to the db.
  • hold – 发送”保持”的消息Send a hold message.
  • httapi – 用HTTAPI结构向WEB服务端发送呼叫控制 Send call control to a Web server with the HTTAPI infrastructure

I

  • info – 显示呼叫信息 Display Call Info.
  • intercept –  Lets you pickup a call and take it over if you know the uuid.
  • ivr – 运行IVR菜单 Run an IVR menu.

J

  • javascript – 从拨号计划中运行JavaScript脚本Run a JavaScript script from the dialplan
  • jitterbuffer – 发送抖动缓冲消息给session会话 Send a jitter buffer message to a session

L

  • limit – 限制呼入/呼出的呼叫数 Set a limit on number of calls to/from a resource
  • limit_execute – 设置特定应用APP的限制 Set the limit on a specific application
  • limit_hash – Set a limit on number of calls to/from a resource
  • limit_hash_execute – Set the limit on a specific application
  • log – 记录调用应用APP信道的信道变量 Logs a channel variable for the channel calling the application.
  • lua – 从拨号计划运行Lua脚本 Run a Lua script from the dialplan

M

  • media_reset – 重置所有旁路bypass/代理proxy 媒体标志 Reset all bypass/proxy media flags.
  • mkdir – 创建一个目录 Create a directory.
  • multiset – 设置多个通道变量与一个单一的行动 Set multiple channel variables with a single action.
  • mutex – 阻塞通话流量,只允许一次一个 Block on a call flow, allowing only one at a time

P

  • page – 当一个页面来发送文件 Send a file as a page.
  • park – 停放一个呼叫 Park a call.
  • park_state – 停放载 Park State.
  • phrase – 说一个短语 Say a Phrase.
  • pickup – 获得呼叫 Pickup a call.
  • play_and_detect_speech – Play while doing 语音识别 Play while doing speech recognition.
  • play_and_get_digits – 播放并获得位数 Play and get Digits.
  • play_fsv – 播放一个FSV文件。 FSV – ( FS视频文件格式)需要额外的说明 Play an FSV file. FSV – (FS Video File Format) additional description needed
  • playback – 向发起呼叫拨打一个声音文件 Play a sound file to the originator.
  • pre_answer – 在早期媒体模式接通一个信道 Answer a channel in early media mode.
  • preprocess – description needed
  • presence – Send Presence
  • privacy – 设置来电通话隐私 Set caller privacy on calls.

Q

  • queue_dtmf – 成功桥接后,发送一个DTMF数字 Send DTMF digits after a successful bridge.

R

  • read – 读取数字 Read Digits.
  • record – 从信道输入中录音 Record a file from the channels input.
  • record_fsv – 录制FSV文件。 FSV – ( FS视频文件格式)需要额外的说明 Record a FSV file. FSV – (FS Video File Format) additional description needed
  • record_session – 会话session录音 Record Session.
  • recovery_refresh – 发送一个恢复刷新 Send a recovery refresh.
  • redirect – 发送重定向消息给session会话 Send a redirect message to a session.
  • regex – 执行一个正则表达式 Perform a regex.
  • remove_bugs – 删除媒体的错误 Remove media bugs.
  • rename – 重命名文件 Rename file.
  • respond – 发送一个响应消息给session会话 Send a respond message to a session.
  • ring_ready – 在信道上注明Ring_Ready Indicate Ring_Ready on a channel.
  • rxfax – 接收传真 并存为tif文件格式 Receive a fax as a tif file.

S

  • say – 说时间/日期/ ip地址/数字/等。 Say time/date/ip_address/digits/etc. With pre-recorded prompts.
  • sched_broadcast – 启用预定播出 Enable Scheduled Broadcast.
  • sched_hangup – 启用计划挂断 Enable Scheduled Hangup.
  • sched_heartbeat – 启用计划心跳 Enable Scheduled Heartbeat.
  • sched_transfer – 启用预定的传输 Enable Scheduled Transfer.
  • send_display – 发送一个信息包与sipfrag Sends an info packet with a sipfrag.
  • send_dtmf – 发送带内DTMF , 2833 ,SIP信息数字给session会话 Send inband DTMF, 2833, or SIP Info digits from a session.
  • send_info – 将信息发送到endpoint Send info to the endpoint.
  • session_loglevel – 此信道覆盖系统的日志级别 Override the system’s loglevel for this channel.
  • set – 在调用该应用APP的信道内,设置信道变量, Set a channel variable for the channel calling the application.
  • set_audio_level – Adjust the read or write audio levels for a channel.
  • set_global – 设置一个全局变量 Set a global variable.
  • set_name – 命名信道 Name the channel.
  • set_profile_var – Set a caller profile variable.
  • set_user – 设置用户 Set a user.
  • set_zombie_exec – Sets the zombie execution flag on the current channel.
  • sleep – 暂停信道 Pause a channel.
  • socket – 建立出境socket连接 Establish an outbound socket connection.
  • sound_test – 分析音频 Analyze Audio.
  • speak – 说一个字符串或通道定义TTS引擎的文本文件 Speaks a string or file of text to the channel using the defined TTS engine.
  • soft_hold – 将一个桥接的信道设为hold保持 Put a bridged channel on hold.
  • start_dtmf – 开始带内DTMF检测 Start inband DTMF detection.
  • stop_dtmf – 停止带内DTMF检测 Stop inband DTMF detection.
  • start_dtmf_generate – 启动带内DTMF生成 Start inband DTMF generation.
  • stop_displace_session – Stop displacement audio on a channel.
  • stop_dtmf_generate – 停止带内DTMF生成 Stop inband DTMF generation.
  • stop_record_session – 停止记录session会话 Stop Record Session.
  • stop_tone_detect – 停止检测音 Stop detecting tones.
  • strftime – 返回格式化的日期和时间 Returns formatted date and time.
  • system – 执行系统命令 Execute a system command.

T

  • three_way – 通过uuid进行三方通话 Three way call with a UUID.
  • tone_detect – 如果发现检测一个音的存在,并执行命令 Detect the presence of a tone and execute a command if found.
  • transfer – 立即调用通道转移到一个新的分机 Immediately transfer the calling channel to a new extension.
  • translate – 号码翻译 Number translation.

U

  • unbind_meta_app – Unbind a key from an application.
  • unset – 取消设置变量 Unset a variable.
  • unhold – 发送一个未保持消息 Send a un-hold message.

V

W

  • wait_for_silence – 暂停处理,等待通道上的沉默 Pause processing while waiting for silence on the channel.
  • wait_for_answer – 暂停处理,等待呼叫被应答时 Pause processing while waiting for the call to be answered.

API

  • chat – 发送短信的IM客户端 Send a text message to a IM client.
  • presence – 发送出席 Send Presence.
  • strepoch –  Returns the date/time as a UNIX epoch (seconds elapsed since midnight UTC, January 1, 1970).
  • strftime – 返回格式化的日期和时间 Returns formatted date and time.
  • strftime_tz – 返回格式化的日期和时间,在指定的时区 Returns formatted date and time in the timezone specified.

电话备注功能

07.23.2013, 电话备注功能已关闭评论, 杂七杂八, by .

拨号

重拨

电话转移

挂断

转接传真

录音

来电查询

强插

强拆

停止

监听

置忙

置闲

发送消息

发送短信

点呼

群呼