FreeSWITCH channel variables(信道变量)

Built-In Variables(内置变量)

以下这些变量称为“呼叫配置域”(caller profile fields), 可以被条件语句直接访问。

  • context:正文,上下文
  • rdnis :被呼叫转移的号码, 即上次呼叫中设置的directory中的号码
  • destination_number:被叫号码 (在一个给定的context中)
  • dialplan:dialplan模块的名字,每个dialplan中的模块如XML都需要配置名字
  • caller_id_name:主叫的名字(由用户代理提供)
  • caller_id_number:主叫号码(可以被隐藏,即不显示来电号码)
  • ani:(自动号码识别)Automatic Number Identification,不可被隐藏
  • aniii:主叫类型 ANI2
  • uuid:当前呼叫的唯一识别码(Unique identifier)
  • source:呼叫源,即来自FreeSWITCH中的哪个模块(例如PortAudio)
  • chan_name:当前频道的名称(如: PortAudio/1234)
  • network_addr:VoIP电话的IP地址
  • year:年份取值范围为0-9999
  • yday:一年中的第几天,取值范围为1-366
  • mon 月份,取值范围1-12 (一月份=1)
  • mday:月份中第几天,取值范围为1-31
  • week:年份中中的第几周,取值范围为1-53
  • mweek:月份中的第几周,取值范围为1-6
  • wday:一周中的第几天,取值范围为 1-7 (星期日为1, 星期一为2),也可以直接用"sun", "mon", "tue"表示
  • hour:小时:取值范围0-23
  • minute:一小时中的第几分钟, 取值范围为0-59
  • minute-of-day:一天中的第几分钟, 取值范围为(1-1440) (午夜为 1, 一点为60, 中午为 720)
  • time-of-day:一天中的时间范围,格式为hh:mm[:ss]-hh:mm[:ss] (秒数为可选项) 示例: "08:00-17:00"
  • date-time:日期/时间范围,格式为: YYYY-MM-DD hh:mm[:ss]~YYYY-MM-DD hh:mm[:ss] (秒数为可选项,注意中间的波浪号“~”)示例: 2010-10-01 00:00:01~2010-10-15 23:59:59

信道变量(Channel Variables)

简介:信道变量是一种局部变量,作用范围为整个会话期(session)。根据局部变量的定义,可以在一个应用(APP)执行期间设置信道变量。该信道(channel)中的其他应用也可以使用这些变量。

不同符号在拨号串中的信道变量中的含义:

{foo=bar}

仅用在拨号串的开始位置有效,它将会在所有信道中设置相同名字的变量,但是在bridge/originate中无效

<foo=bar>

仅用在拨号串的开始位置有效,它将会在所有信道中设置相同名字的变量,包括bridge/originate

[foo=bar]

在拨号串之前即有效,但仅在当前信道中有效

以下设置中,chan=1仅对blah有效,chan=2仅对blah2有效,foo-bar对两者都有效

{foo=bar}[chan=1]sofia/default/[email protected],[chan=2]sofia/default/[email protected]

多个变量的设置可以用逗号隔开

[var1=abc,var2=def,var3=ghi]sofia/default/[email protected]

如果想要用[]覆盖{}中的某个变量,可以在{}中设置“local_var_clobber=true”即可

{local_var_clobber=true,rtp_secure_media=true}sofia/default/[email protected]|sofia/default/[email protected]|[rtp_secure_media=false]sofia/default/[email protected]

当你想覆盖拨号计划中的由其他地方导入b-legs的变量时,你就必须设置{local_var_clobber=true}

在上述例子中,[email protected]和johndeo@example的legs将提供SRTP(RTP/SAVP)服务,但是[email protected]不会收到接收到SRTP(但是会接收到RTP/AVP)

多个变量中的逗号——延伸阅读

因为在{}和[]中,默认的分割符为逗号,但是如果参数中带逗号应该如何处理呢?当然FreeSwitch可以设置不同的变量间隔符。

语法前面添加一个前缀”^^”,就可以将分隔符“,”替换成冒号“:”。这样参数中的逗号将不再被解释成分隔符了。

当然也可以用其他分割符,但是开头必须要有“^^”。,例如

absolute_codec_string=^^:PCMA@8000h@20i@64000b:PCMU@8000h@20i@64000b:G729@8000h@20i@8000b,leg_time_out=10,process_cdr=b_only}

当设置开头带有sip_h,sip_rh_,sip_ph的变量时以上方法将不再适用。如果想在文本中传递一个逗号,可以通过转义的形式来设置,例如

{sip_h_X-My-Header=one\,two\,three,leg_time_out=10,process_cdr=b_only}

在桥接(bridge)操作中导出信道变量:

可以用过”export_vars”将变量从a-legs导到b-leg,多个变量要用逗号“,”隔开,例如:

<action application="set" data="export_vars=myvar,myvar2,foo,bar"/>

当然,也可以在a-leg上通过”export”一步导出:

<action application="export" data="myvar=true"/>

普通的信道变量:

可通过“set”来设置信道变量。当然也可以记录到呼叫详情单(CDR)中。可以在XML-RFC中设信道变量,当然可以可以通过事件套接字来设置,例如:
 

originate {ignore_early_media=true}sofia/mydomain.com/[email protected] 15555551212

如果值中有空格,可以用引号来标注起来:

originate {fax_ident=1231231234,fax_header='Fax Test'}sofia/gateway/outbound.fax/1004 &txfax(/tmp/fax.tiff)

以下是一些变量设置的示例

<extension name="test" continue="false">    

       <condition field="destination_number" expression="^test([0-9]+)$">

             <action application="set" data="fruit=tomato" />

             <!—在当前信道中设置变量 -->

            <action application="export" data="veggie=tomato" />

            <!—在当前信道中设置变量,并导出到桥接对象的信道中(b-leg)-->

            <action application="bridge" data="{meat=tomato},sofia/gateway/testaccount/1234" />

            <!—仅在给定的信道中设置新变量-->

     </condition>

 </extension>

在其他环境中访问信道变量

C环境下:

  switch_channel_set_variable(channel,”name”,”value”);
  char* result = switch_channel_get_variable(channel,”name”); 
  char* result = switch_channel_get_variable_partner(channel,”name”);

命令行环境下:

uid_getvar <uuid> <name>
uuid_setvar <uuid> <name> [<value>]
uuid_setvar_multi <uuid> <name>=<value>[;<name>=<value>[;...]]

当然,也可以使用uuid_dump获得信道中的所有变量。也可以使用eval命令,通过添加variable_前缀获得特定的变量,使用方法如下:

uuid_dump <uuid>  eval uuid:<uuid> ${variable_<name>}

在事件套接字中,需要在所有命令前面添加api前缀:

api uuid_getvar <uuid> <name>

在LUA脚本中,有多种方式跟这些变量交互。通过freeswitch.Session()创建一个Session对象,变量将存储在方括号中:

s = freeswitch.Session("[myname=myvars]sofia/localhost/1003");

有个Session对象后,可以通过以下方法存取变量:

result = session:getVariable(“name”);  session:setVariable(“name”,”value”);

这些变量实际上是属于session中的信道对象(channel object),但是由于存在一对一的绑定,LUA脚本把session和channel当成一个整体。

INFO应用中的变量名

一些info的变量,可能带有类似variable_的前缀。例如,你传递一个叫”type”的变量给代理服务器,在FreeSWITCH中就变成了“variable_sip_h_type”。以下为变量对应表:

Info 变量名

信道变量名

描述

Channel-State

state

当前呼叫状态

Channel-State-Number

state_number

整型

Channel-Name

channel_name

信道名

Unique-ID

uuid

当前信道leg的uuid

Call-Direction

direction

Inbound模式或者Outbound模式

Answer-State

state

应答状态

Channel-Read-Codec-Name

read_codec

读取编码名

Channel-Read-Codec-Rate

read_rate

读取编码采样率

Channel-Write-Codec-Name

write_codec

目标编码名称

Channel-Write-Codec-Rate

write_rate

目标编码采样率

Caller-Username

username

主叫用户名

Caller-Dialplan

dialplan

使用的dialplan,如xml, lua, enum, lcr

Caller-Caller-ID-Name

caller_id_name

.

Caller-Caller-ID-Number

caller_id_number

.

Caller-ANI

ani

主叫的ANI, 通常于呼叫ID号一致

Caller-ANI-II

aniii

主叫ANI II

Caller-Network-Addr

network_addr

主叫的IP地址

Caller-Destination-Number

destination_number

被叫号码

Caller-Unique-ID

uuid

当前信道的uuid

Caller-Source

source

源模块,如mod_sofia, mod_openzap等等

Caller-Context

context

Dialplan内容

Caller-RDNIS

rdnis

Redirected DNIS info. See transfer application

Caller-Channel-Name

channel_name

.

Caller-Profile-Index

profile_index

.

Caller-Channel-Created-Time

created_time

.

Caller-Channel-Answered-Time

answered_time

.

Caller-Channel-Hangup-Time

hangup_time

.

Caller-Channel-Transfer-Time

transfer_time

.

Caller-Screen-Bit

screen_bit

.

Caller-Privacy-Hide-Name

privacy_hide_name

.

Caller-Privacy-Hide-Number

privacy_hide_number

inbound模式下呼叫是否请求CLIR(主叫线路识别限制) (或是匿名anonymous模式, Privacy:id模式)

initial_callee_id_name

Sets the callee id name during the 183. This allows the phone to see a name of who they are calling prior to the phone being answered. An example of setting this to the caller id name of the number being dialled:

<action application="set" data="initial_callee_id_name='${user_data(${dialed_extension}@${domain_name} var effective_caller_id_name)}'"/>

variable_sip_received_ip

sip_received_ip

.

variable_sip_received_port

sip_received_port

.

variable_sip_authorized

sip_authorized

.

variable_sip_mailbox

sip_mailbox

.

variable_sip_auth_username

sip_auth_username

.

variable_sip_auth_realm

sip_auth_realm

.

variable_mailbox

mailbox

.

variable_user_name

user_name

.

variable_domain_name

domain_name

.

variable_record_stereo

record_stereo

.

variable_accountcode

accountcode

本次呼叫的呼叫代号。这是一个任意值,可以在directory的用户变量中定义,或者在dialplan中被设置或者修改。呼叫代号可能被用于CDR CSV的模板中

variable_user_context

user_context

.

variable_effective_caller_id_name

effective_caller_id_name

.

variable_effective_caller_id_number

effective_caller_id_number

.

variable_caller_domain

caller_domain

.

variable_sip_from_user

sip_from_user

.

variable_sip_from_uri

sip_from_uri

.

variable_sip_from_host

sip_from_host

.

variable_sip_from_user_stripped

sip_from_user_stripped

.

variable_sip_from_tag

sip_from_tag

.

variable_sofia_profile_name

sofia_profile_name

.

variable_sofia_profile_domain_name

sofia_profile_domain_name

.

variable_sip_full_route

sip_full_route

Route: header的全部内容

variable_sip_full_via

sip_full_via

Via: header的全部内容

variable_sip_full_from

sip_full_from

From: header的全部内容

variable_sip_full_to

sip_full_to

To: header的全部内容

variable_sip_req_params

sip_req_params

.

variable_sip_req_user

sip_req_user

.

variable_sip_req_uri

sip_req_uri

.

variable_sip_req_host

sip_req_host

.

variable_sip_to_params

sip_to_params

.

variable_sip_to_tag

sip_to_tag

.

variable_sip_to_user

sip_to_user

.

variable_sip_to_uri

sip_to_uri

.

variable_sip_to_host

sip_to_host

.

variable_sip_contact_params

sip_contact_params

.

variable_sip_contact_user

sip_contact_user

.

variable_sip_contact_port

sip_contact_port

.

variable_sip_contact_uri

sip_contact_uri

.

variable_sip_contact_host

sip_contact_host

.

variable_sip_invite_domain

sip_invite_domain

.

variable_channel_name

channel_name

.

variable_sip_call_id

sip_call_id

.

variable_sip_user_agent

sip_user_agent

.

variable_sip_via_host

sip_via_host

.

variable_sip_via_port

sip_via_port

.

variable_sip_via_rport

sip_via_rport

.

variable_presence_id

presence_id

.

variable_sip_h_P-Key-Flags

sip_h_p-key-flags

包含可选项P-Key-Flags header(s),可能从呼叫终端中接收

variable_switch_r_sdp

switch_r_sdp

从呼叫终端接收到的完整的SDP

variable_remote_media_ip

remote_media_ip

.

variable_remote_media_port

remote_media_port

.

variable_write_codec

write_codec

.

variable_write_rate

write_rate

.

variable_endpoint_disposition

endpoint_disposition

.

variable_dialed_ext

dialed_ext

.

variable_transfer_ringback

transfer_ringback

.

variable_call_timeout

call_timeout

.

variable_hangup_after_bridge

hangup_after_bridge

.

variable_continue_on_fail

continue_on_fail

.

variable_dialed_user

dialed_user

.

variable_dialed_domain

dialed_domain

.

variable_sip_redirect_contact_user_0

sip_redirect_contact_user_0

.

variable_sip_redirect_contact_host_0

sip_redirect_contact_host_0

.

variable_sip_h_Referred-By

sip_h_referred-by

.

variable_sip_refer_to

sip_refer_to

从 SIP Refer-To: response接收到的SIP URI

variable_max_forwards

max_forwards

.

variable_originate_disposition

originate_disposition

.

variable_read_codec

read_codec

.

variable_read_rate

read_rate

.

variable_open

open

.

variable_use_profile

use_profile

.

variable_current_application

current_application

.

variable_ep_codec_string

ep_codec_string

该变量仅在配置文件激活晚协商(late negotiation)的情况下有效。该变量可以被呼叫终端读取,包含了所有的可用编码。dialplan也能很好的解析它

variable_rtp_disable_hold

rtp_disable_hold

该变量被设置后,将禁止接(hold)电话功能

variable_sip_acl_authed_by

sip_acl_authed_by

显示 ACL允许的呼叫规则

variable_curl_response_data

curl_response_data

保存最后一次curl操作的输出

variable_drop_dtmf

drop_dtmf

关闭信道的DTMF事件

variable_drop_dtmf_masking_file

drop_dtmf_masking_file

如果DTMF被关闭了(值为true),当收到每个音键将播放一个特定的音乐

variable_drop_dtmf_masking_digits

drop_dtmf_masking_digits

If drop_dtmf is true play specified tone for every tone received.

sip_codec_negotiation

sip_codec_negotiation

sip_codec_negotiation is basically a channel variable equivalent of inbound-codec-negotiation.
sip_codec_negotiation accepts "scrooge" & "greedy" as values.
This means you can change codec negotiation on a per call basis.

Caller-Callee-ID-Name

-

-

Caller-Callee-ID-Number

-

-

Caller-Channel-Progress-Media-Time

-

-

Caller-Channel-Progress-Time

-

-

Caller-Direction

-

-

Caller-Profile-Created-Time

profile_created

-

Caller-Transfer-Source

-

-

Channel-Call-State

-

-

Channel-Call-UUID

-

-

Channel-HIT-Dialplan

-

-

Channel-Read-Codec-Bit-Rate

-

-

Channel-Write-Codec-Bit-Rate

-

-

Core-UUID

-

-

Event-Calling-File

-

-

Event-Calling-Function

-

-

Event-Calling-Line-Number

-

-

Event-Date-GMT

-

-

Event-Date-Local

-

-

Event-Date-Timestamp

-

-

Event-Name

-

-

Event-Sequence

-

-

FreeSWITCH-Hostname

-

-

FreeSWITCH-IPv4

-

-

FreeSWITCH-IPv6

-

-

FreeSWITCH-Switchname

-

-

Hunt-ANI

-

-

Hunt-Callee-ID-Name

-

-

Hunt-Callee-ID-Number

-

-

Hunt-Caller-ID-Name

-

-

Hunt-Caller-ID-Number

-

-

Hunt-Channel-Answered-Time

-

-

Hunt-Channel-Created-Time

-

-

Hunt-Channel-Hangup-Time

-

-

Hunt-Channel-Name

-

-

Hunt-Channel-Progress-Media-Time

-

-

Hunt-Channel-Progress-Time

-

-

Hunt-Channel-Transfer-Time

-

-

Hunt-Context

-

-

Hunt-Destination-Number

-

-

Hunt-Dialplan

-

-

Hunt-Direction

-

-

Hunt-Network-Addr

-

-

Hunt-Privacy-Hide-Name

-

-

Hunt-Privacy-Hide-Number

-

-

Hunt-Profile-Created-Time

profile_created

-

Hunt-Profile-Index

-

-

Hunt-RDNIS

-

-

Hunt-Screen-Bit

-

-

Hunt-Source

-

-

Hunt-Transfer-Source

-

-

Hunt-Unique-ID

-

-

Hunt-Username

-

-

Presence-Call-Direction

-

-

variable_DIALSTATUS

-

-

variable_absolute_codec_string

-

-

variable_advertised_media_ip

-

-

variable_bridge_channel

-

-

variable_bridge_hangup_cause

-

-

variable_bridge_uuid

-

-

variable_call_uuid

-

-

variable_current_application_response

-

-

variable_direction

-

-

variable_inherit_codec

-

-

variable_is_outbound

-

-

variable_last_bridge_to

-

-

variable_last_sent_callee_id_name

-

-

variable_last_sent_callee_id_number

-

-

variable_local_media_ip

-

-

variable_local_media_port

-

-

variable_number_alias

-

-

variable_originate_early_media

-

-

variable_originating_leg_uuid

-

-

variable_originator

-

-

variable_originator_codec

-

-

variable_outbound_caller_id_number

-

-

variable_recovery_profile_name

-

-

variable_rtp_use_ssrc

-

-

variable_session_id

-

-

variable_sip_2833_recv_payload

-

-

variable_sip_2833_send_payload

-

-

variable_sip_P-Asserted-Identity

-

-

variable_sip_Privacy

-

-

variable_sip_audio_recv_pt

-

-

variable_sip_cid_type

-

-

variable_sip_cseq

-

-

variable_sip_destination_url

-

-

variable_sip_from_display

sip_from_display

'User' element of SIP From: line

variable_sip_from_port

-

-

variable_sip_gateway

-

-

variable_sip_gateway_name

-

-

variable_sip_h_P-Charging-Vector

-

-

variable_sip_local_network_addr

-

-

variable_sip_local_sdp_str

-

-

variable_sip_network_ip

-

-

variable_sip_network_port

-

-

variable_sip_number_alias

-

-

variable_sip_outgoing_contact_uri

-

-

variable_sip_ph_P-Charging-Vector

-

-

variable_sip_profile_name

-

-

variable_sip_recover_contact

-

-

variable_sip_recover_via

-

-

variable_sip_reply_host

-

-

variable_sip_reply_port

-

-

variable_sip_req_port

-

-

variable_sip_to_port

-

-

variable_sip_use_codec_name

-

-

variable_sip_use_codec_ptime

-

-

variable_sip_use_codec_rate

-

-

variable_sip_use_pt

-

-

variable_sip_via_protocol

-

-

variable_switch_m_sdp

-

-

variable_transfer_history

-

-

variable_transfer_source

-

-

variable_uuid

-

-

${variable}和 $${variable}的区别

${variables}:设置在dialplan、application、directory中的信道变量。

$${variables}:当freeswitch.xml被编译后值将被绑定。这个绑定操作发生在启动阶段,或者是调用了reloadxml命令。

$${variables}预处理后将绑定到对应的值上,不可改变。而${variables}会在每次被执行的时候更新它的值

CDR相关的变量

process_cdr

用法:

<action application="set" data="process_cdr=a_only"/>

作用:说明如何执行CDR记录,这些变量为无条件导出

取值:false,true,a_only,b-only

accountcode

用法:

<action application="set" data="accountcode=custom"/>

作用:值为任意值,可以在任意leg上分配其值。它的一个重要特性为其值必须匹配于cdr_csv.conf.xml中定义的CDR CSV模板(template)。当生成CSV CDR时CDR模板将被用到。

skip_cdr_causes

作用:列表中的挂断原因将不会触发CDR程序

hold_event

用法:

作用:显示每个通话的起止时间

示例:

variable_hold_events: [{{1347487292379229,1347487293856872},{1347487288539686,1347487290757780}}]

transfer_to

用法:

作用:

挂断原因相关的变量:

bridge_hangup_cause

用法:

<action application="log" data="1 B-leg hangup cause: ${bridge_hangup_cause}"/>

作用:设置最后一个桥接的B-leg的挂断原因。如果设置了continue_on_fail=true和hangup_after_bridge=false,可检查该变量的值检验看该呼叫到底发生了什么。也可以在执行桥接命令(bridge)后添加一个条件检查${bridge_hangup_cause}看看是否包含了MEDIA_TIMEOUT然后触发重播功能。

disable_q850_reason

用法:

<action application="set" data="disable_q850_reason=true"/>

作用:设置为true后,将不会发送原因包含Q.850原因码、应答、BYE的头域。

hangup_cause

用法:

<action application="log" data="1 A-leg hangup cause: ${hangup_cause}"/>

作用:设置A-leg挂断的原因(要注意的是未挂断通话前不起作用)。其值通常是B-leg上的挂断原因。

hangup_cause_q850

用法:

<action application="log" data="1 A-leg hangup Q850 cause: ${hangup_cause_q850}"/>

作用:设置A-leg的挂断原因的Q850数字码(注意在通话结束前不起作用)。其值通常是B-leg上的挂断原因。

sip_hangup_disposition

用法:可以在CDR中看它的值,仅在呼叫结束后有效。

作用:该变量包含了SIP BYE发送者的信息。以下为一些XML CDRs:

<sip_hangup_disposition>send_bye</sip_hangup_disposition><sip_hangup_disposition>recv_bye</sip_hangup_disposition><sip_hangup_disposition>send_refuse</sip_hangup_disposition><sip_hangup_disposition>send_cancel</sip_hangup_disposition>

proto_specific_hangup_cause

用法:

<extension name="nothing_left" continue="true">  <condition break="always">    <action application="set" data="proto_specific_hangup_cause=sip:503"/>    <action application="hangup"/>  </condition></extension>

作用:当挂断电话后,该变量将强制让FreeSwitch的SIP应答绑定到一个特定的设置上。

示例:SIP的应答映射

   <extension name="from_gw_to_internal">

     <condition field="destination_number" expression="^(.*)$">

       <action application="set" data="hangup_after_bridge=true"/>

       <action application="set" data="continue_on_fail=19"/>

       <action application="bridge" data="{sip_cid_type=none}sofia/gateway/gw/$1"/>

       <action application="transfer" data="480to503"/>

     </condition>

   </extension>

   <extension name="480to503">

     <condition field="${proto_specific_hangup_cause}" expression="<a href="sip:480">sip:480">

       <action application="set" data="sip_ignore_remote_cause=true"/>

       <action application="respond" data="503"/>

       <action application="hangup" data="NORMAL_CIRCUIT_CONGESTION"/>

     </condition>

   </extension>

last_bridge_hangup_cause

用法:

作用:B-leg桥接成功后的挂断原因

last_bridge_proto_specific_hangup_cause

用法:

作用:显示最后一次桥接挂断后的SIP应答码,例如”sip:404”

DTMF相关的变量:

pass_rfc2833

用法:

<action application="set" data="pass_rfc2833=true"/>

作用:如果设置了该值,它将传递RFC 2833的DTMF键给桥接的另一端。

注意:如果设置了bypass_media或者proxy_media,该变量将不起作用

dtmf_type

用法:

<action application="set" data="dtmf_type=info"/>

<action application="set" data="dtmf_type=rfc2833"/>

<action application="set" data="dtmf_type=none"/>

作用:用于带内DTMF,使用前必须要在Dialplan中使用start_dtmf

drop_dtmf

用法:

<action application="set" data="drop_dtmf=true"/>

<action application="answer"/>

<action application="export" data="nolocal:drop_dtmf=true"/>

<action application="bridge" data="sofia/internal/[email protected]"/>

                  

<action application="bridge" data="{drop_dtmf=true}sofia/internal/[email protected]"/>

作用:在answer,bridge,originate前设置该变量,可防止将DTMF事件发送到channel上。仅在RFC2833上通过测试。

drop_dtmf_masking_digits

用法(每个a-leg的输入将被丢弃,然后发送d给b-leg):

<action application="set" data="drop_dtmf=true"/>

<action application="set" data="drop_dtmf_masking_digits=d"/>

用法(在b-leg上替代dtmf):

<action application="export" data="nolocal:drop_dtmf=true"/>

<action application="export" data="nolocal:drop_dtmf_masking_digits=/etc/freeswitch/Sounds/dtmf_masking_tone" />

作用:如果drop_dtmf的值为true,那将为每个接收到的音调指定特定的音调

drop_dtmf_masking_file

用法:

<action application="export" data="nolocal:drop_dtmf=true"/><action application="export" data="nolocal:drop_dtmf_masking_file=/etc/freeswitch/Sounds/dtmf_masking_tone" />

作用:如果drop_dtmf的值为true,那么每次接收到按键时播放指定的文件

媒体处理相关的变量

monitor_early_media_fail

用法:

<action application="bridge" data="{ignore_early_media=true,monitor_early_media_fail=user_busy:2:480+620!destination_out_of_order:2:1776.7}sofia/dial/string"/>

作用:检测早期媒体的失败条件,例如一个忙时信号。在忽略早期媒体的情况下,可以更快的处理失败的呼叫。

参数格式:

condition_name:number_of_hits:tone_detect_frequencies

参数详解:

condition_name

用户定义的错误条件名称

number_of_hits

失败阈值,达到该阈值后即视为错误

tone_detect_frequencies

监听的频率 (分隔符为+). 具体内容可见 tone_detect

注意:该变量只有在ingore_early_media为true时才有效

monitor_early_media_ring

用法:

<action application="bridge" data="{monitor_early_media_ring_total=3,monitor_early_media_ring=usring:1:440.0+480.0!ukring:2:400+450}sofia/gateway/yourgateway/[email protected]"/>

作用:为用户指明的铃声监听早期媒体。每次铃声响起时,交换器将增加对应LEG上的计数。一旦计数达到了变量值monitor_early_media_ring_total(或者这个变量未设置),早期媒体将被发送。

参数格式:

condition_name:number_of_hits:tone_detect_frequencies

参数说明:

condition_name

可选项,用户定义的错误条件名称

number_of_hits

铃声阈值。 1:400.0+480.0 表示当400hz或者480Hz被监听到时增加铃声计数。2:400.0+480.0表示当400Hz和480Hz被监测到时增加铃声计数

tone_detect_frequencies

监听频率分隔符为”+“例如 400.0+480.0 [美国铃声]

 具体信息可见 tone_detect

注意:该本来仅当igonore_early_media还未出现时有效

超时相关的变量

call_timeout

用法:

<action application="set" data="call_timeout=20"/>

作用:当应用bridge生效时控制呼叫中B-LEG的响铃时长(单位:秒)。该变量设置在A-LEG上,应用于任何该信道桥接出去的信道。

如果要在一个没有A-LEG的呼叫中设置超时,可使用变量originate_timeout(默认60)

如果要在内核bridge/originate中设置超时,可使用变量originate_timeout

如果要在一条腿的基础上(区别于目标LEG),使用leg_timeout参数

默认值为60秒

leg_timeout

用法:

<action application="bridge" data="[leg_timeout=15]user/hastoanswerquickly/some.domain.com,[leg_timeout=60]user/[email protected]"/>

作用:在拨号字符串中为每条腿设置超时时间。可以用于单条腿上[],但不能以{}设置全局。如果要设置全局可使用originate_timeout。

        也可以使用leg_progree_timeout来指明等待媒体(早期媒体、铃声或者应答)前的最大等待时间,避免专线的语音信箱

        如果使用了组确认可使用信道变量group_confirm_cancel_timeout来取消超时。如果已经使用了delay_start,leg_timeout将在extension被桥接后开始计时。

originate_continue_on_timeout

用法:

<action application="set" data="originate_continue_on_timeout=true"/>

作用:控制超时后是否要继续桥接。默认值为false,该变量设置后将在每次超时后重置时间

park_timeout

用法:

<action application="set" data="park_timeout=30"/><action application="park"/>

作用:park的超时时间,单位为秒。如果未设置park将无限等待直到被uuid_transfer移除。

可以设置hangup_cause,设置如下:

<action application="set" data="park_timeout=30:MEDIA_TIMEOUT"/>

保持音乐相关的

hold_music

用法:

<action application="set" data="hold_music=/sounds/holdmusic.wav" />

可以将值设置为indicate_hold,那么它将会传递持有请求而不是SDP,也可以设置为:

<action application="set" data="hold_music=silence" />

对于多租户环境,为了有不同的保持音乐,可以如下设置

<action application="bridge_export" data="hold_music=$${sounds_dir}/music/company-a.mp3"/>

作用:每个信道上的保持音乐。支持任何音频格式或者音频流。该变量也可以在vars.xml中设置全局变量。

temp_hold_music

用法:

<action application="set" data="temp_hold_music=local_stream://alternate_moh"/>

作用:该变量在transfer后,该变量将会被应用。

语言相关的:

default_language

用法:

<action application="set" data="default_language=fr"/>

作用:设置默认Say引擎

timezone

用法:

<action application="set" data="timezone=GMT0"/>

或者

<action application="set" data="timezone=America/New_York"/>

作用:设置时区。时区格式例如America/New_York,具体可以见/usr/share/zoneinfo/zone.tab。

可以在/conf/vars.xml添加,即设置全局性

<X-PRE-PROCESS cmd="set" data="timezone=America/Toronto"/>

或者在dialplan中设置

<action application="set" data="timezone=America/Toronto"/>

最后就可以在/conf/directory/default/'extension'.xml中的extension设置了

tod_tz_offset

用法:

<action application="set" data="tod_tz_offset=5"/>

作用:设置GMT偏移。

可在conf/vars.xml中设置全局变量

<X-PRE-PROCESS cmd="set" data="tod_tz_offset=5"/>

或者在dialplan中设置

<action application="set" data="tod_tz_offset=5"/>

桥接相关的:

api_after_bridge

用法:

<action application="set" data="api_after_bridge=luarun post-chime.lua"/><action application="bridge" data="portaudio/auto_answer"/>

作用:在桥接后执行API命令

auto_hunt

用法:

<X-PRE-PROCESS cmd="set" data="auto_hunt=true"/>

作用:将其值设置为true将会改变dialplan中所有extension的正常处理队列。该变量将让dialplan跳到指定名称的extension,而不是处理其他extension,因此destination_number必须和extension的中的一样。条件必须匹配,但是extension的名称才是最关键的元素。

在下述例子中,如果没有auto_hunt参数,是无法到达extension 333中的。

<extension name="do_xfer">

  <condition field="destination_number" expression="^.*$">

    <action application="set" data="auto_hunt=true"/>

    <action application="transfer" data="333"/>

  </condition>

</extension>

<extension name="333">

  <condition field="destination_number" expression="^333$">

    <action application="info"/>

  </condition>

</extension>

bridge_early_media

作用:默认值为false。设置为true后,bridge将使用b-leg的现场原声作为反馈给a-leg的铃声。因此设置该值后早期媒体将被缓存。设置该值后将带来更高的资源消耗,但是也将得到更高质量的早期媒体

注意:要在bridge前设置该变量,或在bridge的拨号串中设置

bridge_filter_dtmf

用法:

<action application="set" data="bridge_filter_dtmf=true" />

拨号串中:

{bridge_filter_dtmf=true}sofia/default/[email protected]

作用:将该值设置成true将防止当桥接至其他信道还接收到之前的DTMF按键。

bridge_terminate_key

用法:可以在任意LEG上设置该参数。

作用:如果DTMF按键匹配按下该键后终止bridge。

continue_on_fail

用法:

<action application="set" data="continue_on_fail=true"/>

或者Q.850原因码

<action application="set" data="continue_on_fail=3,17,18,27"/>

作用:当呼叫无法接通(忙时或在离线状态)时决定将发生什么。如果设置为true将继续执行dialplan。如果设置为false将直接终止,可以在continue_on_fail中设置返回消息。

<action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,NO_ROUTE_DESTINATION"/>

transfer_on_fail

作用:当呼叫由于指定的原因(例如unallocated_number)不可达时,stransfer呼叫流。

用法:

<action application="set" data="failure_causes=UNALLOCATED_NUMBER"/>

<action application="set" data="transfer_on_fail=UNALLOCATED_NUMBER"/>

在上述例子中,如果桥接的结果为”UNALLOCATED_NUMBER”,dialplan将transfer到当前dialplan中名称叫”UNALLOCATED_NUMBER”的extension中

用法2:

<action application="set" data="transfer_on_fail=<hangupcauses> <destination> <dialplan> <context>"/>

用法3:

<action application="set" data="transfer_on_fail=1"/>

enable_file_write_buffering

用法:

<action application="set" data="enable_file_write_buffering=false"/>

<action application="set" data="enable_file_write_buffering=true"/>

<action application="set" data="enable_file_write_buffering=65535"/>

作用:当记录文件时激活缓冲功能。默认为true。缓冲区大小默认为SWITCH_DEFAULT_FILE_BUFFER_LEN,但是这个值可以被覆盖,即true的值改成想要的数值大小。

failure_causes

用法:

<action application="set" data="failure_causes=USER_BUSY,NO_ANSWER"/>

Q.850错误代码:

<action application="set" data="failure_causes=487"/>

作用:桥接失败后的失败原因。除非continue_on_fail的值为true,否则该值将会被改变(This will change the valuesfor which continue_on_fail willfail by default unless continue_on_fail isset to true.)

force_transfer_context

用法:

<action application="bridge" data="{force_transfer_context=some_context}sofia/gateway/gw_name/12345"/>

作用:当处理transfer/REFER时FreeSWITCH正常情况下将从原始信道中继承context。设置该值后将强制使用设置的context

force_transfer_diaplan

用法:

作用:当处理transfer/REFER时FreeSWITCH正常情况下将从原始信道中继承dialplan。设置该值后将强制使用设置的dialplan

hangup_after_bridge

用法:

<action application="set" data="hangup_after_bridge=true"/>

作用:当在桥接状态下,B-LEG挂断后控制A-LEG将发生的操作。如果设置为“true”,当B-LEG挂断后A-LEG也会结束,不会执行其他任何dialplan。如果设置为”false”(默认值),当B-LEG挂断后dialplan将继续执行后续操作。

hold_hangup_xfer_exten

用法:

<action application="set" data="hold_hangup_xfer_exten=1000:XML:default"/>

作用:在桥接状态下,当B-LEG处于hold状态时控制对A-LEG的操作。如果未在B-LEG上设置(默认),A-leg将挂断。如果在B-LEG上设置,A-leg将被transfer到指定的extension中。

last_bridge_to

用法:

作用:

loopback_bowout_on_execute

用法:

<action application="set" data="loopback_bowout_on_execute=true"/>

作用:设置为true将在呼叫中有一条腿的回路信道“bow out”(移除loopback leg)

备注:该参数仅在单腿呼叫中有效,你永远不需要去设置它,因为loopback_bowout默认值为true,它会尝试使用uuid_bridge来移除loopback

如果loopback_bowout=false,一个桥接后的回路呼叫将会有四条腿(a-leg, loopback-a, loopback-b, b-leg)

如果loopback_bowout=true,一个桥接后的回路呼叫只有两条腿。

即使设置了loopback_bowout_true也会产生四条腿,但是当a-leg和b-leg成功连接后loopback-a和loopback-b会自动被移除掉。

loopback_export

用法:

作用:将一个信道变量列表从loopback-a传到Loopback-b

outbound_redirect_fatal

用法:

<action application="bridge" data="{outbound_redirect_fatal=true}${group_call(sales@$${domain})}"/>

作用:当同时呼叫多个端点时,一个302 重定向可以导致所有终端停止响铃并且重定向。当该信道变量设置后,它将会向一个终端发送一个302重定向,然后该终端将被移除呼叫列表,其他终端将继续响铃。

originate_timeout

用法:

<action application="bridge" data="{originate_timeout=10}[leg_timeout=5]sofia/default/foo1@bar1|[leg_timeout=5]sofia/default/foo2@bar2"/>

示例:

<action application="bridge" data="{originate_timeout=24}${group_call(sales@$${domain})}"/>

作用:决定bridge或者originate应用在”originate”状态持续多长时间。实际上,这是一种向多终端发起呼叫时控制超时时间的一种方式。默认值为60秒

park_after_bridge

用法:

<action application="set" data="park_after_bridge=true"/><action application="bridge" data="sofia/gateway/myprovider/5551231234"/>

作用:当bridge返回时park呼叫,默认为false。该应用会先于transfer_after_bridge和hangup_after_bridge被选中。

signal_bond

用法:

作用:当前信道要桥接对象的信道的UUID。在单腿呼叫中不起作用。

no_throttle_limits

用法:

{no_throttle_limits=true}

作用:将它设置为true后将不在外呼(外联呼叫)中的SPS计数

rtp_jitter_buffer_during_bridge

用法:

<action application="set" data="rtp_jitter_buffer_during_bridge=true"/>

作用:激活/取消激活桥接期间的抖动缓冲(jitter buffer)

uuid_bridge_continue_on_cancel

用法:

作用:如果命中一个差的b-leg系统将其移动到diaplan中。默认值为false,因为该操作不推荐使用。你可能在Dialplan_FollowMe发现该变量的用途

会议相关的变量:

conference_auto_outcall_announce

用法:

<action application="set" data="conference_auto_outcall_announce=sounds/soundfile.wav"/>

作用:当有成员加入会议时播放的音频消息文件,由应用conference_set_auto_outcall调用。

conference_auto_outcall_caller_id_name

用法:

<action application="set" data="conference_auto_outcall_caller_id_number=${effective_caller_id_number}"/>

作用:当拨打终端加入会议时显示的呼叫名称,由应用conference_set_auto_outcall调用

conference_auto_outcall_caller_id_number

用法:

<action application="set" data="conference_auto_outcall_caller_id_number=${effective_caller_id_number}"/>

作用:当拨打终端加入会议时显示的呼叫号码,由应用conference_set_auto_outcall调用

conference_auto_outcall_flags

用法:

<action application="set" data="conference_auto_outcall_flags=mute"/>

作用:用户加入时的会议标记,由应用conference_set_auto_outcall调用

conference_auto_outcall_prefix

用法:

<extension name="mad_boss_intercom">

    <condition field="destination_number" expression="^0911$">

      <action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss1"/>

      <action application="set" data="conference_auto_outcall_caller_id_number=0911"/>

      <action application="set" data="conference_auto_outcall_timeout=60"/>

      <action application="set" data="conference_auto_outcall_flags=mute"/>

      <action application="set" data="conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer='bind_meta_app 2 a s1 transfer::intercept:${uuid} inline'}"/>

      <action application="set" data="sip_exclude_contact=${network_addr}"/>

      <action application="conference_set_auto_outcall" data="${group_call(sales)}"/>

      <action application="conference" data="madboss_intercom1@default+flags{endconf|deaf}"/>

    </condition>

  </extension>

作用:应用conference_set_auto_outcall的前缀,可能不止一个。

conference_auto_outcall_timeout

用法:

<action application="set" data="conference_auto_outcall_timeout=60"/>

作用:邀请一个成员加入会议呼叫超时时间,由conference_set_auto_outcall调用。

conference_auto_outcall_maxwait

用法:

<action application="set" data="conference_auto_outcall_maxwait=10"/>

作用:信道发起conference_set_auto_outcall后等待成员加入会议的最大等待时间(单位:秒),超时后自动关闭?

conference_controls

用法:

<action application="set" data="conference_controls=moderator"/>

作用:指定将呼叫者tansfer到conference中的会议控制方式。例如,可以设置会议支持人或者其他对常规会员成员的控制方式。设置成主持人(moderator)可以有权利对成员静音、提出等操作。

注意:必须创建想要的会议控制方式,如果未设置默认情况下任何成员都有会议控制的权利。

conference_enter_sound

用法:

<action application="set" data="conference_enter_sound=silence_stream://10"/>

作用:如果设置了该变量,会议的配置文件(profile)中的enter_sound参数将被修改。该参数的作用为呼叫leg转移到会议后的进入音乐。

conference_last_matching_digits

用法:             

<action application="log" data="INFO Last digits sent by this user: ${conference_last_matching_digits}"/>

作用:该信道上的用户最后一次发送给会议的匹配数字

last_transferred_conference

用法:

<action application="log" data="INFO Last conference this person visited was [${last_transferred_conference}]"/>

作用:当前信道最后一个连接的会议名称

conference_member_id

作用:当前信道可能连接到的任意会议的会议成员ID

conference_uuid

用法:

作用:会议的UUID。该变量在信道进入会议时创建,并将在XML CDRs和uuid_dump calls中显示,就像其他显示信道变量的事件一样。

hangup_after_conference

用法:

<action application="set" data="hangup_after_conference=false"/>

作用:当会议结束后是否结束。默认为true,如果设置为false,程序将在会议结束后执行后续的conference的dialplan。

代码执行相关的变量:

api_hangup_hook

用法:

action application="set" data="api_hangup_hook=jsrun cleanup.js ${uuid}"/>

作用:挂断后执行的API命令

可参考:session_in_hangup_hook

bridge_pre_execure_aleg_app

用法:

作用:在A-LEG桥接两个信道前执行的命令或者API

注意:该应用执行于桥接前呼叫建立后!

bridge_pre_execute_aleg_data

用法:

作用:bridge_pre_execute_aleg_app的参数

bridge_pre_execute_bleg_app

用法:

<action application="set" data="bridge_pre_execute_bleg_app=bind_meta_app"/>

<action application="set" data="bridge_pre_execute_bleg_data=1 a s att_xfer::sofia/profile/destination"/>

作用:在桥接两个信道前B-LEG执行的命令或者API。当从事件套接字、CLI、XML-RPC发起呼叫时十分有用。

        当在脚本中HTTP GET或者mod_http时,唤醒一个IP电话呼叫时可以做增大铃声的操作。

        也可以用在B-LEG的绑定DTMF按键的APP上,这样它仍然可以转移

       

bridge_pre_execute_bleg_data

用法:

<action application="set" data="bridge_pre_execute_bleg_app=bind_meta_app"/>

<action application="set" data="bridge_pre_execute_bleg_data=1 a s att_xfer::sofia/profile/destination"/>

作用:bridge_pre_execute_bleg_app的参数

exec_after_bridge_app

用法:

<action application="set" data="exec_after_bridge_app=transfer"/>

<action application="set" data="exec_after_bridge_arg=2102"/>

作用:当桥接结束后执行一个APP。与exec_after_bridge_arg配合使用。类似的,可以用execute_on_answer来实现当桥接成立时执行的APP。

exec_after_bridge_arg

用法:

作用:exec_after_bridge_app的参数

origination_nested_vars

用法:

作用:

execute_on家族

用法:

<action application="set" data="execute_on_answer_1=app1 arg"/>

<action application="set" data="execute_on_answer_2=app2 arg"/>

<action application="set" data="execute_on_answer_3=app3 arg"/>

作用:变量execute_on_xx会根据不同的条件执行dialplan应用。比如April 1,2011这些变量支持一个新语法即支持一个条件下执行多个应用。

注意:注意不要乱用这个特性!这些cases可能导致会话线程的阻塞或者其他不好的事情发生。

execute_on_answer

作用:当被叫方应答时执行一个APP应用(不是API)。如果要执行API可参见api_on_answer。execute_on_answer允许你在处理没有应答条件时有更多的控制选择,但是此时不能忽略早期媒体。

        该命令仅在信道未被应答时执行。使用export或者带nolocal:prefix的export确保它在b-leg应答前执行。

        第二种使用方法如下,发起一个外部呼叫和本地extension,当手工忽略媒体时等待30秒,这种情况下将使用set而不是用export应用

用法(第一种):

<action application="export" data="nolocal:execute_on_answer=lua incrInUse.lua ${uuid}"/>

用法(第二种):

originate {ignore_early_media=true}sofia/gateway/my_gateway/5551212 885551212

<extension name="exe_on_ans">

  <condition field="destination_number" expression="^88(\d+)$">

    <action application="set" data="execute_on_answer=transfer ANSWEREDCALL XML default"/>

    <action application="log" data="INFO Waiting 30 seconds for $1 to answer..."/>

    <action application="sleep" data="30000"/>

    <action application="log" data="INFO Call to $1 was not answered, taking alternative action..."/>

    <action application="transfer" data="UNANSWEREDCALL XML default"/>

  </condition>

</extension>

execute_on_media

作用:当远端发送媒体过来时执行一个APP。例如铃声或者183/SDP

        该应用仅在信道未被应答时执行。使用export或者带nolocal:prefix的export确保它在b-leg应答前执行。

        第二种使用方法如下,发起一个外部呼叫和本地extension,当手工忽略媒体时等待30秒,这种情况下将使用set而不是用export应用

用法(第一种):

<action application="export" data="nolocal:execute_on_media=lua incrInUse.lua ${uuid}"/>

用法(第二种):

originate sofia/gateway/my_gateway/5551212 885551212

<extension name="exe_on_ans">

  <condition field="destination_number" expression="^88(\d+)$">

    <action application="set" data="execute_on_media=transfer ANSWEREDCALL XML default"/>

    <action application="log" data="INFO Waiting 30 seconds for $1 to answer..."/>

    <action application="sleep" data="30000"/>

    <action application="log" data="INFO Call to $1 was not answered, taking alternative action..."/>

    <action application="transfer" data="UNANSWEREDCALL XML default"/>

  </condition>

</extension>

execute_on_media_timeout

用法:

<action application="export" data="nolocal:execute_on_media_timeout=lua oops_timeout.lua ${uuid}"/>

<action application="set" data="execute_on_media_timeout=transfer HANDLE_MEDIA_TIMEOUT XML default"/>

作用:当远端暂停发送媒体且超时时执行一个APP应用。

execute_on_pre_answer

作用:当被叫处于预应答(preanswers)状态时(某个形式的早期媒体到来或者远端发送一个180铃声)执行一个应用(APP)

        该应用仅在信道未被应答时执行。使用export或者带nolocal:prefix的export确保它在b-leg应答前执行。

        第二种使用方法如下,发起一个外部呼叫和本地extension,当手工忽略媒体时等待30秒,这种情况下将使用set而不是用export应用

用法(第一种):

用法(第一种):

<action application="export" data="nolocal:execute_on_pre_answer=lua incrInUse.lua ${uuid}"/>

用法(第二种):

originate sofia/gateway/my_gw/5551212 885551212

<extension name="exe_on_preans">

  <condition field="destination_number" expression="^88(\d+)$">

    <action application="set" data="execute_on_pre_answer=transfer ANSWEREDCALL XML default"/>

    <action application="log" data="INFO Waiting 30 seconds for $1 to answer..."/>

    <action application="sleep" data="30000"/>

    <action application="log" data="INFO Call to $1 was not answered, taking alternative action..."/>

    <action application="transfer" data="UNANSWEREDCALL XML default"/>

  </condition>

</extension>

execute_on_ring

用法:

<action application="set" data="nolocal:execute_on_ring=lua markring ${uuid}"/>

作用:当被叫方相应时执行一个命令

execute_on_sip_reinvite

用法:

作用:当SIP重新邀请时(reinvite)执行一个命令

api_on族的相关变量:

api_on_answer

用法:

<action application="export" data="nolocal:api_on_answer=uuid_broadcast ${uuid} beep.wav both"/>

<action application="bridge" data="{api_on_answer='uuid_broadcast ${uuid} beep.wav both'}sofia/gateway/provider/5551231234"/>

作用:当被叫应答时执行的一个API(不是一个应用),可使用execute_on_answer设置执行应用

api_on_media

用法:

作用:当远端发送媒体例如铃声或者183/SDP时执行的API

api_on_originate

用法:

作用:

api_on_post_originate

用法:

作用:

api_on_pre_originate

用法:

作用:

api_on_ring

用法:

作用:

api_on_sip_extra_headers

用法:

作用:

api_on_tone_detect

用法:

作用:

failed_xml_cdr_prefix

用法:

<action application="set" data="failed_xml_cdr_prefix=failinggw" />    

作用:

If you set that on the A leg and any andall failed B originates generate a full XML CDR report and set it as avariable, this includes during a forked dial.

So say you try to callsofia/profile/a@xxxxxxx,sofia/profile/b@xxxxxxx

And it fails completely, before you makethe call you set failed_xml_cdr_prefix to "bad_call"

Then you end up with ${bad_call_1} and${bad_call_2} which are each a full XML report including all the vars etc.

failed_on_single_reject

用法:

<action application="set" data="fail_on_single_reject=true"/><action application="bridge" data="sofia/$${profile}/$${kitchen}%$${domain},sofia/$${profile}/$${dining}%$${domain}"/><action application="javascript" data="answermachine.js"/>
 

或者

<action application="set" data="fail_on_single_reject=USER_BUSY"/>

或者

<action application="set" data="fail_on_single_reject=!NORMAL_CIRCUIT_CONGESTION"/>

或者用一个列表

<action application="set" data="fail_on_single_reject=^^:CALL_REJECTED:NORMAL_CLEARING:USER_BUSY"/>

或者一个拒绝列表

<action application="set" data="fail_on_single_reject=!^^:ALLOTTED_TIMEOUT:NETWORK_OUT_OF_ORDER"/>

作用:!!!!!!!!!!!!!!!!!!!!!!!

intercept_unbridged_only

用法:

<action application="set" data="intercept_unbridged_only=true"/><action application="intercept" data="myUUID"/>

作用:设置为true后,信道仅在没有桥接的情况下才能被intercepted。默认为false

intercept_unanswered_only

用法:

<action application="set" data="intercept_unanswered_only=true"/><action application="intercept" data="myUUID"/>

作用:设置为true后仅在信道没有被应答的情况下被intercepted。默认值为false

session_in_hangup_hook

用法:

<action application="set" data="session_in_hangup_hook=true"/>

作用:允许信道变量在api_hangup_hook中被访问

主叫ID相关的变量:

caller_id_name

用法:

作用:由呼入呼叫设置的呼叫方名称,不是一个真正的变量。实际上它是只读的

caller_id_number

用法:

作用:由呼入呼叫设置的呼叫方号码,不是一个真正的变量,只读不可写。

effective_caller_id_name

用法:

作用:

effective_caller_id_numer

用法:

<action application="set" data="effective_caller_id_name=Bob Smith"/>

作用:设置实际的呼叫方名称,该变量自动导出到B-LEG。但是在拨号串中不起作用。换而言之,在桥接前使用该变量,或者用变量origination_caller_id_name

effective_caller_id_number

用法:

<action application="set" data="effective_caller_id_number=9185551212"/>

作用:设置实际的呼叫方号码,该变量自动导出到B-LEG。但是在拨号串中不起作用。换而言之,在桥接前使用该变量,或者用变量origination_caller_id_number

sip_cip_type

用法(不带额外的呼叫方ID信息):

{sip_cid_type=none}sofia/default/[email protected]

用法(发送Remote-Party-ID,默认):

{sip_cid_type=rpid}sofia/default/[email protected]

用法3:

{sip_cid_type=rpid,origination_caller_id_name=test,origination_caller_id_number=1234,origination_privacy=screen+hide_name+hide_number}sofia/default/[email protected]

用法4:

{sip_cid_type=rpid,origination_caller_id_name=test,origination_caller_id_number=1234}sofia/default/[email protected]

作用:修改在呼出LEG的SIP头部中如何显示呼叫ID

注意:在网关中(或者是配置文件中的SIP呼叫),这将不起作用。可以用caller_id_in_from=true在网关中设置。

effective_sip_cip_in_1xx

用法:

<action application="set" data="sip_cid_in_1xx=false"/>

作用:防止FreeSwitch在给A-LEG发送183之前从B-LEG上接收到183后自动插入RPID

被叫ID相关的变量:

initial_callee_id_name

用法:

<action application="set" data="initial_callee_id_name='${user_data(${dialed_extension}@${domain_name} var effective_caller_id_name)}'"/>

作用:在183期间设置被叫方姓名。该变量允许被叫方应答前看到被叫方的名字。

origination_callee_id_name

用法:

<action application="bridge" data="{origination_callee_id_name=Reginald}sofia/gateway/provider/<Reginald's cellphone number>" />

作用:在呼入中设置在呼叫方话机的显示屏上显示的呼叫方号码。可以查看 ignore_diplay_updates了解那些进程影响了这些变量。

注意:如果发现该变量无法使用,请使用export代替。

origination_callee_id_number

用法:

<action application="bridge" data="{origination_callee_id_name=Reginald,origination_callee_id_number=2332}sofia/gateway/provider/<Reginald's cellphone number>" />

作用:在呼入中设置在呼叫方话机的显示屏上显示的呼叫方名称。可以查看 ignore_diplay_updates了解那些进程影响了这些变量。

呼叫记录相关的变量

Audio File Metadata

RECORD_TITLE

RECORD_COPYRIGHT

RECORD_SOFTWARE

RECORD_ARTIST

RECORD_COMMENT

RECORD_DATE

RECORD_STEREO

详情可见Misc._Dialplan_Tools_record_session

record_fill_cng

用法:

<action application="set" data="record_fill_cng=1200"/>

作用:

RECORD_HANGUP_ON_ERROR

用法:

<action application="set" data="RECORD_HANGUP_ON_ERROR=true"/>

作用:设置为true后,如果尝试记录呼叫时发生错误,将会挂断呼叫。这个是不被推荐的特性,但是在商业场景中这个应用十分有必要!因为商业场景中要根据CDR来计费。

RECORD_DISCARDED

用法:

作用:如果记录被停止或者被丢弃,该变量将被设置成true。在诊断的时候该变量特别有用。

record_post_process_exec_api

用法:

作用:

record_post_process_exec_app

用法1:

<action application="set" data="record_post_process_exec_api=some_api_app:api_app args" />

用法2:

<action application="set" data="record_post_process_exec_api=api_here:api_arg1 api_arg2 api_arg3" />

作用:该变量允许记录音频后进行后续操作。这个变量存在的理由是如果在一个呼叫中先挂断的是A-LEG,dialplan将停止运行,这样就无法执行记录的操作。

record_restart_limit_on_dtmf

用法:

作用:

record_sample_rate

用法:

<action application="set" data="record_sample_rate=8000"/>

作用:指定记录文件的采样率

record_waste_resources

用法:

<action application="set" data="record_waste_resources=true"/>

作用:默认情况下记录不发送RTP包。该变量允许该操作,但是长时间录音或者依赖网关上的RTP计时器,信道可能会因为MEDIA_TIMEOUT的原因挂断。设置该变量将在录音期间“浪费”带宽来发送RTP事件。其值可以为true/false/<希望的默音因子>,如果设置了值设置了true,默认的默音因子为1400

recording_follow_transfer

用法:

<action application="set" data="recording_follow_transfer=true"/>

作用:如果tranfser要继续记录,就要将该值设置为true

编码相关的变量:

absolute_codec_string

用法:

<action application="set" data="absolute_codec_string=PCMU,GSM"/>

<action application="bridge" data="sofia/gateway/myprovider/5551231234"/>

作用:设置绝对的codecs字符串(不会添加额外的字符)

codec_string

用法:

<action application="set" data="codec_string=PCMU,GSM"/>

作用:设置基本的codecs

inherit_codec

用法:

<action application="set" data="inherit_codec=true"/>

作用:如果晚期协商(late negotiation)设置为on,并且在A-LEG上设置了inherit_codec=true,B-LEG上的codecs将被强制设置成跟A-LEG一样的值

media_mix_inbound_outbound_codecs

用法:

<action application="set" data="media_mix_inbound_outbound_codecs=true"/>

作用:设置B-LEG上使用什么编码器列表。默认情况下B-LEG的codecs跟A-LEG一样。但是过长的codecs列表可能会超出UDP的MTU(最大传输单元),那将引起呼叫建立失败。

read_codec

用法:

作用:只读。呼入LEG的协商codec

write_codec

用法:

作用:只读,呼出LEG的协商codec

passthru_ptime_mismatch

用法(如果在桥接前使用export可能不起作用):

<action application="bridge" data="{passthru_ptime_mismatch=true}sofia/gateway/trunk/$1"/>

作用:如果A-LEG的ptime和B-LEG的不一致且调用了mod_com_g729,呼叫将使用该codec来重新打包RTP流。

        如果使用了该参数,mod_com_g729将重新打包,而没有在外部编解码,因为mod_com_g729内部会自动编解码。

注意:该变量也可在vars.xml中设置为全局变量

sip_renegotiate_codec_on_reinvite

用法:

<action application="bridge" data="{sip_renegotiate_codec_on_reinvite=true}sofia/gateway/trunk/$1"/>

作用:允许SDP编码在re-INVITE时改变。

注意:该变量也可在vars.xml中设置为全局变量或者设置在sip配置文件中(<param name="renegotiate-codec-on-reinvite"value="true"/>)

conference_enforce_security

用法(呼入):

<action application="set" data="conference_enforce_security=false"/><action application="conference" data="3000"/>

用法(呼出):

originate {conference_enforce_security=true}sofia/internal/1001 &conference(3000)

作用:允许重写会议安全模式。该变量可应用在两种场景,呼入和呼出。默认情况下会议安全仅应用在呼入呼叫中而总是在呼出呼叫中略过,该信道变量允许这种情况被修改。

suppress_cng

用法:

<action application="set" data="suppress_cng=true"/>

作用:当发起呼出时在SDP中设置a=silenceSupp:off将取消静音抑制

IVR(交互式语音应答系统)相关的变量

ivr_menu_terminator

用法:

<action application="set" data="ivr_menu_terminator=#"/>

作用:可以不设置或者设置一个DTMF字符终止一个输入

detect_speech_result

用法:

作用:play_and_detect_speech的结果,该变量只读

SIP相关的变量

rtp_disable_hold

用法:

<action application="set" data="rtp_disable_hold=true"/>

作用:设置为true时用户可能不能将呼叫至于hold状态

sip_acl_authed_by

用法:

作用:包含允许该呼叫的ACL结点名称

sip_acl_token

用法:

作用:包含对当前呼叫的ACL auth 标记

sip_copy_multipart

用法(使用bridge时默认开启该功能):

action application="set" data="sip_copy_multipart=true"/>

作用:FreeSWITCH仅支持INVITE的multipart bodies。而不支持应答消息例如183或者200带有multipart bodies。也就是说一般情况下SIP的bodies仅支持一个使用MINE类型的应用或者SDP的MINE,设置该参数后就不再有这个限制,但是该变量可能会改变FreeSwitch的行为,bridge默认使用该功能。

注意:FreeSwitch会自动做它认为正确的事情并且附加一个应用或者SDP到B-LEG上。其他的non-SDP MINE部分将会被自动过滤。

sip_invite_params

用法:

作用:设置domain

sip_invite_domain

用法:

<action application="bridge" data="{sip_invite_domain=${sip_from_host}}sofia/gateway/gw1/[email protected]"/>

作用:在B-LEG设置源domain

sip_from_display

用法:

<action application="bridge" data="{sip_from_display=_undef_}user/1001"/>

作用:设置发送给B-LEG的用户部分的SIP消息

sip_invite_from_params

用法:

{sip_invite_from_params=otg=mytrunk}sofia/gateway/sonus/$1

结果:

From: <sip:5552345678@sonus:5060;otg=mytrunk>;tag=blah

作用:设置B-LEG中的源参数。

sip_invite_to_params

用法:

作用:

sip_invite_contact_params

用法:

作用:

sip_invite_tel_params

用法:

<action application="bridge" data="{sip_invite_tel_params=npdi=yes;rn=555000001,sip_invite_params=user=phone}sofia/gateway/test_gw/555000002"/>

结果:

INVITE sip:555000002;npdi=yes;[email protected];user=phone SIP/2.0

作用:在呼出呼叫中的SIP URI设置URI参数(npdi,rn)

sip_network_destination

用法:

<action application="bridge" data="{sip_network_destination=sip:[email protected]:10005}sofia/external/[email protected]:5060"/>

作用:Itis intended for use with devices registering behind a NAT where the Request-URIshould contain the contact that was bound to the AOR during the registrationrequest while the request itself should be sent to the public IP and portnumber of the NAT "pinhole". It does not add a Route header field tothe request like the ;fs_path= or the sip_route_uri options do.

sip_auth_username

用法:

originate {sip_auth_username=<your_user_name>,sip_auth_password=<your_password>}sofia/external/[email protected] &echo

作用:不用定义一个完整的网关,由mod_sofia完成授权。通常与sip_auth_password一起使用。指明了一个SIP用户名设备成功注册到FreeSWITCH上

sip_auth_password

用法:

作用:详见sip_auth_username

sip_auth_simplify

用法:

<action application="set" data="sip_auto_simplify=true"/>

作用:设置后,在安全的情况下FreeSWITCH将从SIP信号通路移除自身。

sip_force_audio_fmtp

用法:

作用:设置音频FMTP

sip_invite_req_uri

用法:

<action application="bridge" data="{sip_invite_req_uri=sip:[email protected]}sofia/external/33334444%192.168.4.6"/>

结果:

INVITE sip:[email protected] SIP/2.0

 From: "" <sip:[email protected]>;tag=N6K579y4g6j0D

 To: <sip:[email protected]>

作用:当呼叫桥接或者发起的时候设置头部请求行INVITE中的URI

sip_invite_record_toute

用法:

作用:

sip_invite_route_uri

用法:

originate {sip_invite_route_uri=<sip:[email protected]:5080;lr;orig>,origination_caller_id_number=399999000}sofia/internal/[email protected] &echo

结果:

INVITE sip:[email protected] SIP/2.0

 Via: SIP/2.0/UDP 10.0.0.51;rport;branch=z9hG4bKpmFv4aXv4tKcK

 Route: <sip:[email protected]:5080;lr;orig>

作用:当呼叫桥接或者发起呼叫的时候设置头部route的URI

sip_invite_full_from

用法:

作用:

sip_invite_full_to

用法:

作用:

sip_handle_full_from

用法:

作用:

sip_handle_full_to

用法:

作用:

sip_force_full_from

用法:

作用:

sip_force_full_to

用法:

作用:

sip_recover_contact

用法:

作用:

sip_recover_via

用法:

作用:

sip_invite_from_uri

用法:

作用:

sip_invite_to_uri

用法:

originate {sip_invite_to_uri=<sip:[email protected]>}sofia/internal/[email protected] &park

结果:

INVITE sip:[email protected] SIP/2.0

 From: "" <sip:[email protected]>;tag=N6K579y4g6j0D

 To: <sip:[email protected]>

用法2(只需设置用户名):

originate sofia/internal/[email protected]^11112222 &park

结果:

INVITE sip:[email protected] SIP/2.0

 From: "" <sip:[email protected]>;tag=Qr6pB00BBrZ5m

 To: <sip:11112222@@192.168.4.6>

作用:当呼叫桥接或者发起呼叫时设置头部To的URI

sip_ignore_reinvites

用法:

<action application="set" data="sip_ignore_reinvites=true"/>

注:一旦桥接后禁止re-INVITEs

作用:告诉FreeSWITCH接受或者拒绝远端的re-INVITEs操作

sip_has_crypto

用法:

作用:

rtp_sdes_suites

rtp_secure_media

rtp_secure_media_inbound

rtp_secure_media_outbound

用法:

rtp_secure_media=<permission>[:<list of encryption suites>]
rtp_secure_media_inbound=<permission>[:<list of encryption suites>]
rtp_secure_media_outbound=<permission>[:<list of encryption suites>]

参数值:

·      mandatory –只接受或者提供 SAVP协商

·      optional –接受/提供SAVP优先的SAVP/AVP

·      forbidden –拒绝SAVP协商的呼入

·      false –等效于forbidden,已废弃

·      true –等效于mandatory,已废弃

·      default –如果提供则接受SAVP呼入

encryption suites可选项:

·      AEAD_AES_256_GCM_8

·      AEAD_AES_128_GCM_8

·      AES_CM_256_HMAC_SHA1_80

·      AES_CM_192_HMAC_SHA1_80

·      AES_CM_128_HMAC_SHA1_80

·      AES_CM_256_HMAC_SHA1_32

·      AES_CM_192_HMAC_SHA1_32

·      AES_CM_128_HMAC_SHA1_32

·      AES_CM_128_NULL_AUTH

示例:

rtp_secure_media=mandatory:AES_CM_256_HMAC_SHA1_80,AES_CM_256_HMAC_SHA1_32			
rtp_secure_media=true:AES_CM_256_HMAC_SHA1_80,AES_CM_256_HMAC_SHA1_32 
rtp_secure_media=optional:AES_CM_256_HMAC_SHA1_80 
rtp_secure_media=true:AES_CM_256_HMAC_SHA1_80  

示例(指明是呼入还是呼出):

rtp_secure_media_inbound=true:AEAD_AES_256_GCM_8,AES_CM_256_HMAC_SHA1_80,AES_CM_256_HMAC_SHA1_32			
rtp_secure_media_inbound=mandatory:AEAD_AES_256_GCM_8 
rtp_secure_media_outbound=true:AEAD_AES_128_GCM_8 
rtp_secure_media_outbound=optional:AEAD_AES_128_GCM_8 

注:可通过vars.xml查看

sip_wait_for_aleg_ack

用法:

<action application="bridge" data="{sip_wait_for_aleg_ack=true}sofia/internal/[email protected]"/>		

作用:在呼出的b-leg中设置该变量后,只有a-leg收到一个ACK后,b-leg才会发送ACK

timer_name

用法:

<action application="set" data="timer_name=soft"/>

作用:Ifset will make playback and speak use a timer to clock the audio instead of theread.

deny_refer_requests

用法:

作用:如果该变量在任意一条桥接后的SIP呼叫的LEG上设置为true,其他终端发送REFER请求,都会被FreeSWITCH拒绝。

SDP操作相关的变量

sdp_m_per_ptime

用法:

<action application="set" data="sdp_m_per_ptime=true"/>

作用:为每个在codec列表中不同的ptime添加“m=”行

When this variable is not set:

·      When mixing codecs with various ptime in a codec list,they will now be allowed to co-exist in the sdp but it will send no ptime attr.This means the ptime preferences on the offer will be ignored when mixingcodecs with various ptimes. When receiving a codec list with no ptime attr, theptime will be chosen from local preference instead of assuming 20ms. This meansif offer contains PCMU with no ptime and FS has PCMU@40i

·      Dynamic payloads will now start at 98 and increment peradditional dynamic codec per call. So now you can add CELT@32000h,CELT@48000hand each one will be auto-assigned a dynamic payload type.

Is now implied to be true, if you don'tlike this set it to false but its going to be undefined behaviour. Thisbasically means if you call in with ptime 30 then you have a bunch of ptime 20codecs in your outbound list that there will be one m= line with 30 and theoriginal inbound codec and more m= lines for each discinct ptime in your list.This is, of course, will depend on disable_trancoding or absolute_codec_stringas well

switch_r_sdp

用法:

<action application="set"><![CDATA[switch_r_sdp=(sdp here)]]></action>

注:不要在”set”>后添加一个回车符,否则将写入一个不同名称的变量名

作用:只读,该变量的值为当前LEG/信道的远程SDP

switch_m_sdp

用法:用来存储用于呼叫中的其他

作用:Used to store the remote SDP used by the other leg/channel of acall. (In the A-leg that will be the remote SDP of the B-leg.)

sip_append_audio_sdp

用法:

<action application="export" data="sip_append_audio_sdp=a=fmtp:18 annexb=no"/>		

作用:用于添加发送给B-LEG的SDP中的音频参数

sip_ignore_183nosdp

用法:

<action application="set" data="sip_ignore_183nosdp=true"/>	

作用:忽略183 w/o SDP。改选项不适用于正常的基础呼叫流

verbose_sdp

用法:

作用:RFCs需要一个rtpmap作为IANA动态负载类型。一个带codec名称和负载类型的rtpmap不需要常见的静态负载类型(PCMU,PCMA,G729等)

sip_local_sdp_str

用法:

作用:

sip_recovery_break_rfc

用法:

作用:为了防止在USA Re-INVITEs反转from和to,这将会中断RFC

注:该变量可设置为全局变量

sip_mirror_remote_audio_codec_payload

用法:

作用:To tell sip to break the rfc and expect the codec payload the otherside replies with rather than the one it offered which is the correct behavior.

sip_enable_soa

用法:

<action application="set" data="bypass_media=true"/>

<action application="export" data="sip_enable_soa=false"/>

作用:设置为false可以禁用SIP SOA。

sdp_secure_savp_only

用法:

<action application="export" data="sdp_secure_savp_only=true"/>

作用:设置为true时FreeSWITCH将在SDP提供AVP和SAVP。同时将rtp_secure_media和sdp_secure_savp_only设置为true,FreeSWITCH仅在SDP中提供SAVP

FIFO相关的变量:

fifo_bridged

用法:

作用:

fifo_caller_consumer_import

用法:

<action application="set" data="fifo_caller_consumer_import=var1,var2"/>		

作用:从呼叫方向consumer导入变量列表

fifo_consumer_caller_import

用法:

<action application="set" data="fifo_consumer_caller_import=var1,var2"/>		

作用:从consumer向呼叫方导入变量列表

fifo_manual_bridged

用法:

作用:

fifo_position

用法:

作用:

fifo_role

用法:

作用:作为报告目的,例如CDRs,根据呼叫LEG包含consumer或者caller变量

transfer_after_bridge

用法:

<action application="set" data="transfer_after_bridge=1000"/>		

<action application="set" data="transfer_after_bridge=1000:XML:default"/>		

作用:通话挂断后进行transfer,就像是设置了一个代理。该变量作用在hangup_after_bridge前,park_after_bridge后。

播放(playback)相关的变量:

playback_terminators

用法:

<action application="set" data="playback_terminators=#*"/>		

作用:在播放(playback)一个文件或者在play_and_detect_speech期间,按下某个键即终止播放。默认的终结符为“*”。值为”none”则取消终结操作。

sound_prefix

用法:

作用:音乐文件的目录

playback_terminator_used

用法:

作用:呼叫方用来终止播放(playback)的DTMF键。默认为undef即未定义

playback_ms

用法:

作用:包含刚刚播放的音频文件的毫秒数。而play_seconds保存的秒数。

playback_samples

用法:

作用:刚刚播放的音频文件的采样率

playback_last_offset_pos

用法:

作用:包含刚刚播放的文件的偏移量。可用于暂停后的恢复。

playback_sleep_val

用法:

<action application="set" data="playback_sleep_val=0"/>	

作用:文件播放后的暂停毫秒数,默认为250毫秒

playback_delimiter

用法:

<action application="set" data="playback_delimiter=&"/>			
<action application="playback" data="foo.wav&bar.wav"/> 

作用:播放多个音频文件时的分隔符。

sleep_eat_digits

用法:

<action application="set" data="sleep_eat_digits=true"/>		

作用:防止意外退出IVR。默认情况下不会吃掉任何DTMF按键。

注意:请确保在sleep_eat_digits设置为true保存好了之前的操作。

playback_timeout_sec

用法:

<action application="set" data="playback_timeout_sec=10"/>		

作用:播放的超时数。

呼叫(Originate)相关的变量

execute_on_originate

用法:

originate {ignore_early_media=true,execute_on_originate='cng_plc'}sofia/gateway/foo/123456789 9664			
originate {ignore_early_media=true,execute_on_originate='my_app::my_arg'}sofia/gateway/foo/123456789 9664 

作用:在成功发起呼叫时执行的代码。在originate线程中执行格式为<app><arg>,异步执行格式为'<app>::<arg>

leg_delay_start

用法:

<action application="bridge" data="sofia/profile/dest1,[leg_delay_start=10]sofia/profile/dest2,[leg_delay_start=15]sofia/profile/dest3"/>		

作用:在LEG被呼叫前的等待秒数。可以用[],但不能用全局{}

originate_disposition

用法:

作用:由B-LEG返回的挂断原因。如果桥接未成功,该变量将在每次桥接请求后更新其值。

originate_retries

用法:

作用:发起呼叫的重试次数,默认为0

originate_retry_sleep_ms

用法:

<action application="set" data="originate_retry_sleep_ms=500"/>		

作用:重试发起呼叫次数之前的间隔毫秒数。

originate_timeout

用法:

<action application="set" data="originate_timeout=2"/>		

作用:当向网关发送invite请求后等待的秒数。该变量在多方呼叫中十分有效。例如

<action application="bridge" data="sofia/default/[email protected]|sofia/default/[email protected]"/>		

originating_leg_uuid

用法:

In A-leg CDR:

<uuid>cb5f5b90-75a0-11e0-873b-d1cba9e0f1b8</uuid>			
<call_uuid>cb5f5b90-75a0-11e0-873b-d1cba9e0f1b8</call_uuid> 

In B-leg CDR:

<uuid>cb8633aa-75a0-11e0-873d-d1cba9e0f1b8</uuid>			
<call_uuid>cb5f5b90-75a0-11e0-873b-d1cba9e0f1b8</call_uuid> 
<originating_leg_uuid>cb5f5b90-75a0-11e0-873b-d1cba9e0f1b8</originating_leg_uuid> 

作用:在呼出信道中显示呼叫发起方的uuid

origination_channel_name

用法:

originate {origination_channel_name='this_is_my_channel_name'}loopback/9664 9195		

作用:在发起呼叫时用{}创建信道名称

origination_caller_id_name

用法:

<action application="set" data="origination_caller_id_name=Uncle Sam"/>		

作用:设置呼叫方名称(A-LEG),命令行下可在拨号串前加入{}设置

originarion_call_id_number

用法:

<action application="set" data="origination_caller_id_number=9185551212"/>	

作用:设置呼叫方号码(A-LEG),命令行下可在拨号串前加入{}设置

注意:当一个经由FXO网关的PSTN呼叫呼入时,该变量将无效

origination_cancel_key

用法:

<action application="set" data="origination_cancel_key=#"/>		

作用:取消发起呼叫(通话未建立前)

origination_privacy

用法:

<action application="set" data="origination_privacy=hide_name"/>		

作用:呼叫方的策略配置信息。选项有 "screen", "hide_name","hide_number".

origination_uuid

用法:

originate [origination_uuid=....]sofia/<profile>/<extension>		

作用:可以指定一个呼叫的uuid。

originator

用法:

作用:保存呼叫发起方信道的UUID。通常由FreeSWITCH设置,用户通常不会去设置它。

originator_codec

用法:

<action application="set" data="originator_codec=PCMU"/>		

作用:设置呼叫方(A-LEG))的codec

RTP/媒体相关的变量

bypass_media

用法:

<action application="set" data="bypass_media=true"/>		

作用:设置后,媒体(RTP)将直接从呼叫方发送至被叫方。信令(SIP)有经过FreeSWITCH,但是媒体视频是点对点的

bypass_media_after_bridge

用法:

作用:跟bypass_media一样,但是会处理呼叫被应答前的媒体。Atthis point FreeSWITCH will use a ReInvite to take itself out of the media path.This helps reduce audio latency and take some load off FreeSWITCH. Especiallyuseful for UACs behind Coned NAT as it gives RTP Auto-Adjust enough time todetermine the correct ports to avoid one-way audio.

bypass_keep_codec

用法:

作用:用export bypass_keep_codec来强制使用先前的codec来re-invite

proxy_media

用法:

action application="set" data="proxy_media=true"/>		

作用:proxy media模式可让FreeSWITCH中的RTP流处于透明代理模式。RTP流仍然经过freeswitch(不像bypass媒体模式),但是它在CPU处理上属于轻量级的,因为FreeSWITCH不处理它的包和程序,仅仅是转发而已。

注意:晚期协商(<paramname="inbound-late-negotiation" value="true"/>)必须在SIP配置文件中激活,这样dialplan才能使用它

rtp_autoflush

用法:

作用:当设置为true后(默认未设置),当套接字有数据在读取时将忽略计时器等待。设置为false时,它总是会休眠一个时间间隔。When set tofalse, it will always sleep one timer interval. When a packet is too late withthis setting, it would be saved for next time in the udp stack and we wouldplace a filler packet into the core to keep it moving that is flagged as CNG soyou know there is no audio in it. If you have it set to false, you end up withdelay if the other side is sending the audio at a different speed (can be tinydifference but it would build up).

It is worth itto set to true if you have crappy network conditions where you are hearinghiccups it's related to jitter. Sometimes you have the other side sending audiotoo fast, then this option set to false will smooth it out but if you have itset to false in jitter conditions it tricks it into moving too fast.

rtp_autoflush_during_bridge

用法:

作用:跟rtp_autoflush类似,但是是在桥接期间设置的

disable_rtp_auto_adjust

用法:

Add {disable_rtp_auto_adjust=true} in your dial string.		

作用:关闭RTP的自动调整。它将停止从源到目的RTP的重写转换。

        当RTP自动调整打开时,FreeSWITCH将改变RTP的目的地址来匹配源接收包,如果另一端想发送或者接收一个不同的地址该操作将不起作用。

progress_timeout

用法:

<action application="set" data="progress_timeout=20"/>		

作用:得到媒体前的最大等待时间。一般的,稳定条件下(PDD)低于3秒,移动环境下低于8秒

bridge_answer_timeout

用法:

<action application="set" data="bridge_answer_timeout=20">		

作用:桥接状态中,处于早起媒体状态且无应答最大可容忍的等待秒数。

ingnore_early_media

用法:

<action application="set" data="ignore_early_media=true"/>		

用法2:

<action application="bridge" data="{ignore_early_media=true}sofia/test-int/1001@somebox,sofia/test-int/1000@somehost"/>		

作用:忽略早期媒体,默认为false。将值设置为ring_ready与设置成true有一样的效果,但是会在接受到SIP 183时向呼入LEG发送SIP 180

ringback

用法:

<action application="set" data="ringback=[data]"/>

用法2:

<action application="set" data="ringback=%(2000,4000,440.0,480.0)"/>

用法3:

def handler(uuid):

    session = PySession(uuid)

    session.answer()

    session.speak("Hello, connecting your call to the first available agent")

    session.execute("set","call_timeout=30")

    session.execute("set","continue_on_fail=true")

    session.execute("set","hangup_after_bridge=true")

    session.execute("set","ringback=%(2000,4000,440.0,480.0)")

    session.execute("bridge","sofia/foo/[email protected],sofia/foo/[email protected]:5070")

    session.speak("doh!")

作用:呼叫的等待时间播放音乐

instant_ringback

用法:

<action application="set" data="instant_ringback=true"/>

作用:在发送回铃声给主叫方时ringback将不会根据指示停止下来

transfer_ringback

用法:

<action application="set" data="transfer_ringback=[data]"/>

作用:当一个呼叫已经被应答时该声音文件将被播放,然后transfer到另一个终端

rtp_disable_hold

用法:

<action application="set" data="rtp_disable_hold=true"/>		

作用:用于禁止hold状态

rtp_negotiate_near_match

用法:

<action application="set" data="rtp_negotiate_near_match=true"/>		

作用:Settingthis to true will cause FreeSWITCH to consider codec PTIME on inbound codecnegotiation as well. If you receive a call with PCMU@30i and only have PCMU@20ion the list, it will prefer anything else that matches codec and ptime bydefault. This changes behavior and matches PCMU@30i despite the PTIME mismatch.This is only valid if you have other matching codecs on the endpoints lists, ofcourse.

RTCP相关的变量

rtcp_packet_count

用法:

作用:包含呼叫期间收集的RTCP包数量

rtcp_octet_count

用法:

作用:包含呼叫期间收集的RTCP字节数

呼叫保留(Camp-on)相关的变量

该功能应用于桥接一个呼叫的过程中。在尝试桥接呼叫的过程中将对信道置于park(aka camp)状态,并播放保持音乐。

campon

用法:

<action application="set" data="campon=true"/>

<action application="bridge" data="sofia/gateway/myprovider/5551231234"/>

作用:控制是否保留(camping)一个呼叫,默认为false

campon_retries

用法:

<action application="set" data="campon=true"/>			
<action application="set" data="campon_retries=13"/> 
<action application="bridge" data="sofia/gateway/myprovider/5551231234"/> 

作用:当在camping状态下桥接重试的次数,默认为100

campon_timeout

用法:

<action application="set" data="campon=true"/>			
<action application="set" data="campon_timeout=20"/> 
<action application="bridge" data="sofia/gateway/myprovider/5551231234"/> 

作用:每次桥接的超时数,默认为10

camp_sleep

用法:

<action application="set" data="campon=true"/>			
<action application="set" data="campon_sleep=30"/> 
<action application="bridge" data="sofia/gateway/myprovider/5551231234"/> 

作用:重试前的等待时间,默认为10

campon_fallback_exten

用法:

作用:

campon_fallback_dialplan

用法:

作用:

campon_fallback_context

用法:

作用:

campon_hold_music

用法:

<action application="set" data="campon=true"/>			
<action application="set" data="campon_hold_music=/data/campmusic/RelaxingCampSounds.wav"/> 
<action application="bridge" data="sofia/gateway/myprovider/5551231234"/> 

作用:如果未设置hold_music变量,在camping期间将使用该变量的等待音乐

campon_stop_key

用法:

<action application="set" data="campon=true"/>			
<action application="set" data="campon_stop_key=1"/> 
<action application="set" data="campon_announce_sound=press_one_to_stop.wav"/> 
<action application="set" data="campon_fallback_exten=1000"/> 
<action application="bridge" data="sofia/gateway/myprovider/5551231234"/> 

作用:终止campon循环及直接跳过fallback extension的DTMF按键

campon_announce_sound

用法:

<action application="set" data="campon=true"/>			
<action application="set" data="campon_stop_key=1"/> 
<action application="set" data="campon_announce_sound=press_one_to_stop.wav"/> 
<action application="bridge" data="sofia/gateway/myprovider/5551231234"/> 

作用:第一次桥接失败播放的音乐

应答确认相关的变量

group_confirm_file

用法:

<action application="set" data="group_confirm_file=/usr/local/freeswitch/sounds/take_call_question.wav" />

<action application="set" data="group_confirm_key=1" />

作用:该变量与group_confirm_key配合使用。在group_confirm_file中,需指明当被叫方接起电话后播放的wav文件。在group_confirm_key变量中,可以设置一个DTMF按键,当呼叫方按下该键后将桥接呼叫。如果一个错误的DTMF按键或者没有DTMF按键输入,被叫方不会被桥接,wav文件将重复播放。

注:该功能更灵活的应该可参考Freeswitch_IVR_Originate#Answer_confirmation.

group_confirm_key

用法:

作用:参考group_confirm_file

group_confirm_cancel_timeout

用法:

作用:设置后将在呼叫被应答时取消leg_timeout,但是originate_timeout仍然有效。

当使用群确认时,一个呼叫包含3个阶段:

1.       呼叫在响铃

2.       呼叫被应答,等待被确认

3.       呼叫被确认,桥接成功

正常情况下,LEG上的超时将应用于第一阶段和第二结点

如果使用了以下命令

<action application="set" data="group_confirm_cancel_timeout=1"/>

那么coast将仅在第一阶段有效。因此,一旦阶段一结束,leg_timeout将停止计数。

语音信箱相关变量

voicemail_alternate_greet_id

用法:

作用:

voicemail_greeting_number

用法:

作用:

vm_message_ext

用法:

作用:

vm_cc

用法:

作用:

skip_greeting

用法:

作用:

skip_instructions

用法:

作用:

voicemail_authorized

用法:

作用:

事件相关的变量

fire_asr_events

用法:

作用:设置后,当检测到语音后将产生(fire)一个事件

系统相关的变量

base_dir

用法:

<action application="system" data="$${base_dir}/scripts/my_script.sh"/>

作用:保存了FreeSwitch的安装目录

OpenZap相关的变量

openzap_span_number

用法:

作用:openzap跨度数

openzap_chan_number

用法:

作用:openzap频道数

翻译出处:https://freeswitch.org/confluence/display/FREESWITCH/Channel+Variables

猜你喜欢

转载自blog.csdn.net/irizhao/article/details/88638995