<document type="freeswitch/xml">
  <section name="directory">
    <domain name="${r'$${domain}'}">
      <params>
        <param name="dial-string" value="${r'{^^:sip_invite_domain=${dialed_domain}:presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(*/${dialed_user}@${dialed_domain})},${verto_contact(${dialed_user}@${dialed_domain})}'}"/>
        <param name="jsonrpc-allowed-methods" value="verto"/>
      </params>
      <variables>
	      <variable name="record_stereo" value="true"/>
	      <variable name="default_gateway" value="${r'$${default_provider}'}"/>
	      <variable name="default_areacode" value="${r'$${default_areacode}'}"/>
	      <variable name="transfer_fallback_extension" value="operator"/>
	  </variables>
      <groups>
      	<group name="default">
			<users>
				<#if extensionList??>
				<#list extensionList as extension>
			  	<user id="${extension.extension!''}">
				    <params>
				      <param name="password" value="${extension.password!''}"/>
				      <param name="vm-password" value="${extension.extension!''}"/>
				    </params>
				    <variables>
				      <variable name="sip-force-contact" value="NDLB-connectile-dysfunction"/>
				      <variable name="toll_allow" value="domestic,international,local"/>
				      <variable name="accountcode" value="${extension.extension!''}"/>
				      <variable name="user_context" value="default"/>
				      <variable name="effective_caller_id_name" value="Extension ${extension.extension!''}"/>
				      <variable name="effective_caller_id_number" value="${extension.extension!''}"/>
				      <variable name="outbound_caller_id_name" value="${r'$${outbound_caller_name}'}"/>
				      <variable name="outbound_caller_id_number" value="${r'$${outbound_caller_id}'}"/>
				      <variable name="callgroup" value="techsupport"/>
				    </variables>
				</user>
				</#list>
				</#if>
			</users>
	    </group>
        <group name="sales">
         <users>
         	<#if extensionList??>
			<#list extensionList as extension>
          	<user id="${extension.extension!''}" type="pointer"/>
          	</#list>
			</#if>
         </users>
        </group>
      </groups>
    </domain>
  </section>
</document>