пятница, 27 марта 2015 г.

Allow removal of User-Agent header

В версии 1.4.18 теперь можно удалять user-agent

I propose accomplishing this by removing the header when the sofia profile parameter user-agent-string is set to "_undef_".
https://freeswitch.org/jira/browse/FS-7309

понедельник, 23 марта 2015 г.

Отладка freeswitch

1)
сd /usr/src/freeswitch

gdb /usr/bin/freeswitch core.*

2)
service freeswitch stop
gdb
set logging file /tmp/freeswitch-gdb.log
set logging on

handle SIG33 nostop noprint noignore pass
run -u freeswitch -g daemon -nonat -c

set pagination off
info threads
bt
bt full
thread apply all bt
thread apply all bt full

Итог в jira.freeswitch.org, вывод или просто аттачем, или через pastebin.freeswitch.org

Перед этим ставим freeswitch-debuginfo, если ставилось пакетом.

Также полезные опции
sofia global siptrace on
sofia loglevel all 9
sofia tracelevel alert
console loglevel debug
fsctl debug_level 10

https://freeswitch.org/confluence/display/FREESWITCH/Debugging

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

Многодоменность

Необходимо УБРАТЬ в настройках

  • force-register-domain
  • force-register-db-domain
  • force-subscription-domain


После этого в экстеншенах будет что-то вроде
         <action application="set" data="domain_name=company-b.com"/>
         <action application="set" data="domain=company-b.com"/>
         <action application="transfer" data="1000 XML default"/>
Также может иметь смысл выставлять sip_invite_domain

Также, если регистрации обрабатываются не на камаилио, а на самом фрисвиче, надо внимательно заполнять directory по юзерам, например
  <user id="1000">
    <params>
      <param name="password" value="$${default_password}"/>
      <param name="vm-password" value="1000"/>
    </params>
    <variables>
      <variable name="toll_allow" value="domestic,international,local"/>
      <variable name="accountcode" value="1000"/>
      <!--<variable name="user_context" value="default"/>-->
      <variable name="effective_caller_id_name" value="Extension 1000"/>
      <variable name="effective_caller_id_number" value="1000"/>
      <variable name="outbound_caller_id_name" value="$${outbound_caller_name}"/>
      <variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/>
      <variable name="callgroup" value="techsupport"/>
    </variables>
  </user>

Линки
https://wiki.freeswitch.org/wiki/Multi-tenant
https://wiki.freeswitch.org/wiki/Multiple_Companies


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

просто переменные выставляются так:
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

Как отключить транскодинг

<configuration name="sofia.conf" description="sofia Endpoint">
   <profiles>
     <profile name="sip">
       <settings>
         <param name="disable-transcoding" value="true"/>
         <param name="inbound-late-negotiation" value="false"/>

https://freeswitch.org/confluence/display/FREESWITCH/Sofia+SIP+Stack