Contact Mapping
About
Map a "friendly" phone number to a unique directory user address.
Click here to expand Table of Contents
Usage
There are times when you would like to have a directory username which is very different from the contact information for reaching that user. For instance, maybe you want each device to register with mac-address_line-number (000e081c4f6a_1) but they will have a standard npa-nxx number which routes to them (509.123.4567).
There are a couple things that you will need. First the directory:
The key here is the variable sip-force-user
. Set this to the phone number to which you want to map the user:
sip-force-user Example
<!-- this is in conf/directory/default/ -->
<include>
<user id="000e081c4f6a_1" mailbox="5091234567">
<params>
<param name="password" value="1234"/>
</params>
<variables>
<variable name="user_context" value="default"/>
<variable name="sip-force-user" value="5091234567"/>
</variables>
</user>
</include>
Next, match a number and send the call to this user.
You must use sofia
or sofia_contact
in the bridge string here, user
will not work because of sip-force-user
. Here is an example:
Contact Mapping XML Example
<!-- this is an example extension in conf/dialplan/ -->
<extension name="Call_User">
<condition field="destination_number" expression="^(\d+)$">
<action application="set" data="call_timeout=20"/>
<action application="set" data="hangup_after_bridge=true"/>
<action application="set" data="continue_on_fail=true"/>
<action application="bridge" data="${sofia_contact($1@$${domain})}"/>
<action application="answer"/>
<action application="set" data="vm_exten=$1" />
<action application="sleep" data="1000"/>
<action application="voicemail" data="default ${domain_name} $1"/>
</condition>
</extension>
A word of caution: depending on how you route calls here, this will match all numbers and try to send them to sip-force-users
listed in your directory.
See Also
There is an alternative method to contact mapping described here: XML User Directory - Alphanumeric to numeric user mapping