вторник, 17 марта 2015 г.

Установка своих переменных

просто переменные выставляются так:
set
export
export nolocal:
и 3 варианта прямо для bridge - скобки {}, [], <>

The syntax of using { } versus < > versus [] is explained below.
{foo=bar} is only valid at the beginning of the dial string. It will set the same variables on every channel, but does not do so for enterprise bridging/originate.
<foo=bar> is only valid at the beginning of the dial string. It will set the same variables on every channel, including all those in an enterprise bridging/originate.
[foo=bar] goes before each individual dial string and will set the variable values specified for only this channel.


Свои заголовки (в SIP) можно выставить через set|export, выставляя специальные имена
sip_h_

Response header
sip_rh_
Provisional response header
sip_ph_
Bye response header
sip_bye_h_

Помним, что по стандарту свои переменные должны иметь префикс X-
While not required, you should prefix your headers with "X-" to avoid issues with interoperability with other SIP stacks.
All inbound SIP calls will install any X- headers into local variables.
This means you can easily bridge any X- header from one FreeSWITCH instance to another.
To access the header above on a 2nd box, use the channel variable ${sip_h_X-Answer}
It is important to note that the syntax ${sip_h_customer-header} can't be used to retrieve any custom header not starting with X-.
It is because Sofia only reads and puts into variables custom headers starting with X-.

Пример
<action application="set" data="sip_rh_X-Reason=Destination Number Not in Footprint"/>

Иногда нужно выставить не-Х заголовок, это можно сделать так
<action application="set"><![CDATA[sip_h_P-Charge-Info=<sip:${caller_id_number}@${domain_name}>;npi=0;noa=3]]></action>

Убрать переменную например так:
<action application="unset" data="sip_h_X-voipnow-did"/>

Чтобы переменные перекидывались между ногами, можно указать список для перекидывания
<action application="set" data="export_vars=myvar,myvar2,foo,bar"/>
или вообще все
sip_copy_custom_headers=true

Отдельно стоит mod_callcenter, штатно он ничего не пропустит. Нужна примерно такая конструкция:
            <action application="set" data="sip_h_X-DestID=${destination_number}"/>
            <action application="set" data="cc_export_vars=sip_h_X-DestID"/>
 
Линки
http://wiki.freeswitch.org/wiki/Sofia-SIP / https://freeswitch.org/confluence/display/FREESWITCH/Sofia+SIP+Stack
http://wiki.sangoma.com/NSG-advanced-parameters-new

Комментариев нет:

Отправить комментарий