XML User Directory Guide

From FreeSWITCH Wiki

Jump to: navigation, search

Contents

Overview

The directory section is used to add accounts for all users that should be able to register in the pbx by using User Agents (SIP Phones). This configuration is done in the directory section (directory.xml).

Note: This is not the same syntax which is used in the Dialplan

Basic User

The basic configuration is quite simple, you just need to add user names and passwords.

<domain name="$${sip_profile}">
  <user id="mike">
    <params>
      <param name="password" value="micke"/>
    </params>
  </user>
</domain>

The domain tag tells us which domain this user is for. Note that all users should be in the same domain tag, unless you are using multiple domains. The user name is the part left of @ in the sip address (in this case "mike" in "mike@sub.mydomain.com"). $${sip_profile} will be replaced with the domain that is specified in freeswitch.xml.

You can also specify a a1-hash if you do not want to specify the password in plain text. A a1-hash is a md5 generated string with the following format: "username:domain:password", without the quotes. (I'm not 100% sure of the format.)

<domain name="$${sip_profile}">
  <user id="mike">
    <params>
      <param name="a1-hash" value="c6440e5de50b403206989679159de89a"/>
    </params>
  </user>
</domain>

VCards

You can also add support for vcards if you are using mod_dingaling. Then you add information in the following format:

<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>

More Complex Examples

Each <user> can also have it's own variables and gateways with their own [semi-]complex configurations.

User-Specific Gateways

<user id="user1">
  <params>
    <param name="password" value="1"/>
  </params>
  <variables>
    <variable name="register-gateway" value="user1out"/>
  </variables>
  <gateways>
    <gateway name="user1out">
      <param name="username" value="4347382173"/>
      <param name="password" value="1"/>
      <param name="proxy" value="sip.example.com"/>
      <param name="register" value="false"/>
    </gateway>
  </gateways>
</user>

The <register-gateway> variable can be set to the name of a specific gateway, a comma delimited list of multiple gateways, or "all". Setting it to one or more gateways will register the named gateway(s) when the <user> registers with FreeSwitch.(whether they're in the <user>'s <gateways> or some other <user>'s <gateways> or anywhere). Setting the variable to "all" will register all of the particular <user>'s gateways.

Forcing a particular user to a particular extension

In a PABX environment, an authenticated user can specify that they are at an arbitrary extension. This behaviour can be restricted in two ways.

To force a user to use a specified extension, add

  <variable name="sip-force-user" value="<extension>">

to that user's directory entry.

Alternatively, to check that users authenticate with the same username as that in their contact field for an entire profile, add

  <variable name="inbound-reg-force-matching-username" value="true">

to that profile's definition.

Personal tools