Freeswitch directory

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

Overview

Freeswitch directory 내용 정리

About

<freeswitch_conf_directory>/directory 디렉토리에는 Freeswitch 에서 사용되는 모든 user(i.e., SIP phone extensions) 정보들이 위치한다. 보통은 아래의 디렉토리에 위치한다.

$ pwd
/etc/freeswitch/directory
$ tree
.
├── default
│   ├── 1000.xml
│   ├── 1001.xml
│   ├── 1002.xml
│   ├── brian.xml
│   ├── default.xml
│   ├── example.com.xml
│   └── skinny-example.xml
└── default.xml

User settings

<include>
  <user id="1000" cidr="12.34.56.78/32,20.0.0.0/8"> <!--ID is the sip username. CIDR is optional -- if specified, these IPs with automatically auth to this user-->
    <params>
      <param name="password" value="correcthorsebatterystaple"/> <!--SIP password-->
      <param name="vm-password" value="8761"/>
    </params>
    <variables><!--these variable are accessible in the channel-->
      <variable name="accountcode" value="1000"/> <!--Use this in your dialplan for authorization and limits. Also, cdr_csv can use it for separate CDR files-->
      <variable name="user_context" value="default"/> <!--magic variable: specifies the context-->
      <variable name="effective_caller_id_name" value="Extension 1000"/><!--magic variable: used for outbound caller ID name-->
      <variable name="effective_caller_id_number" value="1000"/><!--magic variable: used for outbound caller ID name/number-->
    </variables>
  </user>
</include>

Basic User

기본적인 User 설정은 정말 간단하다. 간단히 name 과 password 만 설정하면 된다.

<domain name="$${sip_profile}">
  <user id="mike">
    <params>
      <param name="password" value="micke"/>
    </params>
  </user>
</domain>
  • domain
domain 태그는 해당 User 가 FS 의 어느 Domain 에 속하는지를 알려준다. 다중 도메인 기능을 사용하지 않는한, 모든 User 는 모두 같은 Domain 값을 가져야 한다.
  • user id
SIP address 에서 @ 왼쪽에 오는 부분을 가리킨다. 여기에서는 mike 가 된다(mike@sub.mydomain.com).
<include>
  <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>
</include>

VCards

만약 mod_dingaling 모듈을 사용한다면 Vcard 형식을 지원할 수도 있다.

<domain name="$${sip_profile}">
  <user id="peter">
    <params>
      <param name="password" value="thepassword"/>
    </params>
 
    <!-- This is only for mod_dingaling so it can deliver vcards in component mode-->
    <vcard xmlns='vcard-temp'>
      <FN>Peter Saint-Andre</FN>
      <N>
    <FAMILY>Saint-Andre</FAMILY>
    <GIVEN>Peter</GIVEN>
    <MIDDLE/>
      </N>
      <NICKNAME>stpeter</NICKNAME>
      <URL>http://www.jabber.org/people/stpeter.php</URL>
      <BDAY>1966-08-06</BDAY>
      <ORG>
    <ORGNAME>Jabber Software Foundation</ORGNAME>
    <ORGUNIT>Jabber Software Foundation</ORGUNIT>
      </ORG>
      <TITLE>Executive Director</TITLE>
      <ROLE>Patron Saint</ROLE>
      <TEL><WORK/><VOICE/><NUMBER>303-308-3282</NUMBER></TEL>
      <TEL><WORK/><FAX/><NUMBER/></TEL>
      <TEL><WORK/><MSG/><NUMBER/></TEL>
      <ADR>
    <WORK/>
    <EXTADD>Suite 600</EXTADD>
    <STREET>1899 Wynkoop Street</STREET>
    <LOCALITY>Denver</LOCALITY>
    <REGION>CO</REGION>
    <PCODE>80202</PCODE>
    <CTRY>USA</CTRY>
      </ADR>
      <TEL><HOME/><VOICE/><NUMBER>303-555-1212</NUMBER></TEL>
      <TEL><HOME/><FAX/><NUMBER/></TEL>
      <TEL><HOME/><MSG/><NUMBER/></TEL>
      <ADR>
    <HOME/>
    <EXTADD/>
    <STREET/>
    <LOCALITY>Denver</LOCALITY>
    <REGION>CO</REGION>
    <PCODE>80209</PCODE>
    <CTRY>USA</CTRY>
      </ADR>
      <EMAIL><INTERNET/><PREF/><USERID>stpeter@jabber.org</USERID></EMAIL>
      <JABBERID>stpeter@jabber.org</JABBERID>
      <DESC>
    More information about me is located on my
    personal website: http://www.saint-andre.com/
      </DESC>
    </vcard>
 
  </user>
</domain>

Group settings

<document type="freeswitch/xml">
 <section name="directory">
   <domain name="sip.example.com">
     <users>
       <user id="1000">
         <params>
           <param name="dial-string" value="{presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(${dialed_user}@${dialed_domain})}"/>
         </params>
         <variables>
           <variable name="user_context" value="default"/>
         </variables>
       </user>
       <user id="1001">
         <params>
           <param name="dial-string" value="{presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(${dialed_user}@${dialed_domain})}"/>
         </params>
         <variables>
           <variable name="user_context" value="default"/>
         </variables>
       </user>
     </users>
     <groups>
       <group name="200">
         <users>
           <user id="2014">
             <params>
               <param name="dial-string" value="loopback/2014/default/XML"/>
             </params>
             <variables>
               <variable name="user_context" value="default"/>
             </variables>
           </user>
           <user id="1000" type="pointer"/>
           <user id="1001" type="pointer"/>
         </users>
       </group>
     </groups>
   </domain>
 </section>
</document>

See also