Freeswitch-sofia.conf.xml

From 탱이의 잡동사니
Jump to navigation Jump to search

Overview

Freeswitch SIP module 설정파일 sofia.conf.xml 내용 정리

Structure

sofia.conf.xml 파일은 다음과 같은 구조로 되어있다. <source lang=xml> <configuration name="sofia.conf" description="sofia endpoint">

 <global_settings>
 ...
 </global_settings>
 <profiles>
   ...
 </profiles>

</configuration> </source>

global_settings

전역 설정을 하는 부분이다. <source lang=xml>

 <global_settings>
   <param name="log-level" value="0"/>
   <param name="auto-restart" value="false"/>
   <param name="debug-presence" value="0"/>
 </global_settings>

</source>

profiles

sofia 모듈에서 사용하는 각각의 프로필을 설정한다.

<source lang=xml>

 <profiles>
   <profile name="example">
     <gateways>
       <gateway name="example-gateway">
         ...
       </gateway>
       ...
     </gateways>
     <aliases>
       <alias name="default"/>
     </aliases>
     <domains>
       <domain name="all" alias="true" parse="false"/>
     </domains>
     <settings>
       ...
     </settings>
   </profile>
 </profiles>

</source>

profile

profile/gateways

gateway 는 속성값 name 을 가지며, 이를 통해 다른 곳에서 해당 gateway 를 참조할 수 있게된다. 각각의 gateway 는 서로 다른 UA로써 작동하게되며 어떻게 목적지까지 도달하는지를 정의하게 된다. 예를 들면, PSTN 연결 방식을 지정할 수도 있으며 혹은 Private SIP Network 가 정의되어 있을 수도 있다. Asterisk 의 Registry 와 비슷한 개념으로 볼 수 있다. <source lang=xml> <gateways>

 <gateway>
   elements...
 </gateway>
 <gateway>
   elements...
 </gateway>

</gateways> </source>

다음은 설정 예제이다. <source lang=xml> <gateway name="gateway012">

 <param name="realm" value="sip.voipcarrier.com" />
 <param name="username" value="WBrandes" />
 <param name="password" value="myvoiceismypassword" />
 <param name="register" value="true" />
 <param name="caller-id-in-from" value="true" />
 <param name="ping" value="5" />
 <param name="ping-max" value="3" />
 <param name="retry-seconds" value="5" />
 <param name="expire-seconds" value="60" />
 <variables>
   <variable name="verbose_sdp" value="true" />
   <variable name="absolute_codec_string" value="PCMU,PCMA" direction="outbound" />
   <variable name="customer_id" value="3532" direction="inbound"/>
 </variables>

</gateway> </source>

여기서 설정한 gateway 를 dialplan 에서 사용하는 방법은 다음과 같다.

sofia/gateway/<gateway_name>/<dialstring>

Parameters

realm

<source lang=xml> <param name="realm" value="sip.example.com[:port]"/> </source>

username

Profile setting 에서의 username 과 혼동하지 말것. <source lang=xml> <param name="username" value="foo"/> </source>

password

<source lang=xml> <param name="password" value="a password"/> </source>

from-user

<source lang=xml> <param name="from-user" value="fooman"/> </source>

from-domain

<source lang=xml> <param name="from-domain" value="asterlink.com"/> </source>

Use Freeswitch as a client

Freeswitch 는 다른 서버(freeswitch 등)로부터 이벤트를 받아오는 client 로서 작동할 수 있다. 이를 위해서는 gateway 설정에 아래와 같이 subscriptions 섹션을 추가하면 된다. <source lang=xml> <include>

 <gateway name="fs2">
   <param name="realm" value="192.168.7.2"/>
   <param name="username" value="1000"/>
   <param name="password" value="1234"/>
   <param name="register" value="false"/>
   <subscriptions name="x">
     <subscription event="dialog">
       <param name="retry-seconds" value="40"/>
       <param name="expire-seconds" value="60"/>
       <param name="content-type" value="application/dialog-info+xml"/>
       <param name="username-in-request" value="true"/>
     </subscription>
   </subscriptions>
 </gateway>

</include> </source>

profile/settings

Basic settings

debug

<source lang=xml> <param name="debug" value="0"/> </source>

sip-trace

SIP detail 로그를 기록한다. <source lang=xml> <param name="sip-trace" value="yes"/> </source>

sip-capture

<source lang=xml> <param name="sip-capture" value="no"/> </source>

watchdog-enabled

<source lang=xml> <param name="watchdog-enabled" value="no"/> </source>

watchdog-step-timeout

<source lang=xml> <param name="watchdog-step-timeout" value="30000"/> </source>

watchdog-event-timeout

<source lang=xml> <param name="watchdog-event-timeout" value="30000"/> </source>

context

해당 프로필로 인입된 콜에 적용될 context 를 지정한다. <source lang=xml> <param name="context" value="public"/> </source>

sip-port

port 번호를 지정한다. <source lang=xml> <param name="sip-port" value="$${internal_sip_port}"/> </source>

dialplan

dialplan parameter 는 특별히 중요하다. 가장 단순하게는 XML dialplan 을 사용할 수 있다. XML 설정 시, mod_xml_curl 모듈을 이용해서 freeswitch.xml dialplan 섹션에 설정된 파일 내용을 읽어오게 된다. dialplan 적용시, 설정된 dialplan 내용 중에서 가장 처음 적용가능한 dialplan 내용을 적용하게 된다. <source lang=xml> <param name="dialplan" value="XML"/> </source>

enum lookup 을 사용할 수도 있다(mod_enum 에서 dialplan 을 지원한다면). 이 경우 enum lookup 이 XML dialplan 설정을 덮어쓰게 된다. <source lang=xml> <param name="dialplan" value="enum,XML"/> </source>

순서를 반대로 적용할 경우, XML lookup 이 실패했을 경우에만 enum 설정을 적용하게 된다. <source lang=xml> <param name="dialplan" value="XML,enum"/> </source>

특정 enum root 를 적용할 수도 있다. <source lang=xml> <param name="dialplan" value="enum:foo.com,XML"/> </source>

특정 XML 을 지정할 수도 있다. <source lang=xml> <param name="dialplan" value="XML:/tmp/foo.xml,XML,enum"/> </source>

rtp-ip

RTP Listen IP 주소를 설정한다. 반드시 IP Address로 입력해야 한다. hostname 으로 입력하면 안된다. <source lang=xml> <param name="rtp-ip" value="$${local_ip_v4_or_v6}"/> </source>

sip-ip

SIP listen IP 주소를 설정한다. 반드시 IP Address로 입력해야 한다. hostname 으로 입력하면 안된다. <source lang=xml> <param name="sip-ip" value="$${local_ip_v4_or_v6}"/> </source>

Auth

log-auth-failures

인증실패시 해당 내역을 로그로 기록한다(Registration & invite). fail2ban 과 같은 유틸을 사용하고자할 때 유용하다. <source lang=xml> <param name="log-auth-failures" value="false"/> </source>

DTMF

rfc2833-pt

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

dtmf-duration

<source lang=xml> <param name="dtmf-duration" value="100"/> </source>

Codec related options

inbound-codec-prefs

inbound 시 적용할 codec 우선순위를 설정한다. <source lang=xml> <param name="inbound-codec-prefs" value="$${global_codec_prefs}"/> </source>

outbound-codec-prefs

outbound 시 적용할 codec 우선순위를 설정한다. <source lang=xml> <param name="outbound-codec-prefs" value="$${outbound_codec_prefs}"/> </source>

SIP Related options

enable-timer

RFC4028 SIP Session Timer 를 Enable/Disable 한다. <source lang=xml> <param name="enable-timer" value="false"/> </source>

minimum-session-expires

RFC4028 에서의 "Min-SE" 값(Sec)을 설정한다. 최소 90 이상이 설정되어야 한다. <source lang=xml> <param name="minimum-session-expires" value="120"/> </source>

session-timeout

세션 타임아웃을 정의한다. 세션 타임아웃 이후에는 re-invite 메시지를 보낸다. 단위는 Second(초)이며, 기본값은 30분 이다. RFC 4028 의 Session-Expires 항목을 정의한다.(The time at which an element will consider the session timed out, if no successful session refresh transaction occurs beforehand) <source lang=xml> <param name="session-timeout" value="1800"/> </source>

RTP Related options

rtp-timer-name

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

NATing

aggressive-nat-detection

적극적인 NAT dectection 을 적용한다. SIP Via: header 를 분석하여 SIP From: 내용과 맞지 않으면 NAT 모드를 enable 한다. <source lang=xml> <param name="aggressive-nat-detection" value="true"/> </source>

Presence

manage-presence

Presence 모드를 enable/disable 한다. 만약 presence 를 공유하고자 한다면(dbname 및 presence-hosts 항목 참조), 첫번째 프로필에서 이 항목을 "True" 로 설정하고 shared presence database 를 enable 한다. 그렇게 하면 이후에 따라오는 profile들의 manage-presence 값을 "passive" 로 설정하면 첫번째 profile 에서 설정한 presence database 설정을 공유하게 된다. <source lang=xml> <param name="manage-presence" value="true"/> </source>

presence-hosts

A list of domains that have a shared presence in the database specified in dbname. People who use multiple domains per profile can't use this feature anyway, so you'll want to set it to something like "_DISABLED_" in this case to avoid getting users from similar domains all mashed together. For multiple domains also known as multi-tenant calling 1001 would call all matching users in all domains. Don't use presence-hosts with multi-tenant. <source lang=xml> <param name="presence-hosts" value="$${domain},$${local_ip_v4}"/> </source>

ETC

forward-unsolicited-mwi-notify

<source lang=xml> <param name="forward-unsolicited-mwi-notify" value="false"/> </source>

hold-music

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

record-path

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

record-template

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

<source lang=xml> </source> <source lang=xml> </source> <source lang=xml> </source> <source lang=xml> </source> <source lang=xml> </source> <source lang=xml> </source> <source lang=xml> </source> <source lang=xml> </source> <source lang=xml> </source> <source lang=xml> </source>

Media related options

See also

References

<references />