<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Per-phone Configuration File -->
<!--  $Revision: 1.67 $  $Date: 2005/03/11 17:05:46 $ -->
<phone1>
  <reg 
#foreach ($line in ${lines})
  #set ($i = $velocityCount)
  #set ($reg = $line.getSetting('reg'))  
  #foreach ($setting in $cfg.getRecursiveSettings($reg))
      reg.${i}.${setting.ProfileName}="$!{setting.Value}"
  #end
	reg.${i}.acd-login-logout="0" 
	reg.${i}.acd-agent-available="0" 
#end	
/>
	<call>
#set ($dndPerReg = $cfg.EndpointSettings.getSetting('call/donotdisturb.perReg'))
              <donotdisturb call.donotdisturb.perReg="$!{dndPerReg.Value}"/> 
		<autoOffHook 
#foreach ($line in $lines)
  #set ($i = $velocityCount)
  #set ($group = $line.getSetting('call').getSetting('autoOffHook'))  
  #foreach ($setting in $cfg.getSettings($group))
        call.autoOffHook.${i}.${setting.ProfileName}="$!{setting.Value}"
  #end
#end	
/>
		<serverMissedCall 
#foreach ($line in $lines)
  #set ($i = $velocityCount)
  #set ($group = $line.getSetting('call').getSetting('serverMissedCall'))  
  #foreach ($setting in $cfg.getSettings($group))
        call.serverMissedCall.${i}.${setting.ProfileName}="$!{setting.Value}"
  #end
#end	
/>
	</call>
	
	<divert 
#foreach ($line in $lines)
  #set ($i = $velocityCount)
  #set ($group = $line.getSetting('divert'))  
  #foreach ($setting in $cfg.getSettings($group))
        divert.${i}.${setting.ProfileName}="$!{setting.Value}"
  #end
#end	
     >
		<fwd 
#foreach ($line in $lines)
  #set ($i = $velocityCount)
  #set ($group = $line.getSetting('divert').getSetting('fwd'))  
  #foreach ($setting in $cfg.getSettings($group))
        divert.fwd.${i}.${setting.ProfileName}="$!{setting.Value}"
  #end
#end	
		/>
		<busy 
#foreach ($line in $lines)
  #set ($i = $velocityCount)
  #set ($group = $line.getSetting('divert').getSetting('busy'))  
  #foreach ($setting in $cfg.getSettings($group))
        divert.busy.${i}.${setting.ProfileName}="$!{setting.Value}"
  #end
#end	
         />
		<noanswer 
#foreach ($line in $lines)
  #set ($i = $velocityCount)
  #set ($group = $line.getSetting('divert').getSetting('noanswer'))  
  #foreach ($setting in $cfg.getSettings($group))
        divert.noanswer.${i}.${setting.ProfileName}="$!{setting.Value}"
  #end
#end	
        />
		<dnd 
#foreach ($line in $lines)
  #set ($i = $velocityCount)
  #set ($group = $line.getSetting('divert').getSetting('dnd'))  
  #foreach ($setting in $cfg.getSettings($group))
        divert.dnd.${i}.${setting.ProfileName}="$!{setting.Value}"
  #end
#end	
        />
	</divert>
	
## SIMILIAR DIALPLAN SECTION EXISTS IN sip.cfg.vm 
## to control dialplans for all lines

	<dialplan 
#foreach ($line in $lines)
  #set ($i = $velocityCount)
  #set ($group = $line.getSetting('line-dialplan'))  
  #foreach ($setting in $cfg.getSettings($group))
        dialplan.${i}.${setting.ProfileName}="$!{setting.Value}"
  #end
#end	
	>
		<digitmap 
#foreach ($line in $lines)
  #set ($i = $velocityCount)
  #set ($group = $line.getSetting('line-dialplan').getSetting('digitmap'))  
  #foreach ($setting in $cfg.getSettings($group))
        dialplan.${i}.${setting.ProfileName}="$!{setting.Value}"
  #end
#end	
        />
		<routing>
			<server 
#foreach ($line in $lines)
  #set ($i = $velocityCount)
  #set ($group = $line.getSetting('line-dialplan').getSetting('digitmap').getSetting("routing.1"))  
     dialplan.${i}.routing.server.1.address="$!{group.getSetting('address').Value}"
     dialplan.${i}.routing.server.1.port="$!{group.getSetting('port').Value}"
#end	
/>
			<emergency 
#foreach ($line in $lines)
  #set ($i = $velocityCount)
  #set ($group = $line.getSetting('line-dialplan').getSetting('digitmap').getSetting("routing.1"))  
     dialplan.${i}.routing.emergency.1.value="$!{group.getSetting('emergency.1.value').Value}"
     dialplan.${i}.routing.emergency.1.server.1="1"
#end
            />
		</routing>
	</dialplan>
	<msg 
  #set ($group = $cfg.EndpointSettings.getSetting('msg')) 
  #foreach ($setting in $cfg.getSettings($group))
        msg.${setting.ProfileName}="$!{setting.Value}"
  #end
	>
		<mwi 
#foreach ($line in $lines)
  #set ($i = $velocityCount)
  #set ($group = $line.getSetting('msg.mwi'))  
  #foreach ($setting in $cfg.getSettings($group))
        msg.mwi.${i}.${setting.ProfileName}="$!{setting.Value}"
  #end
#end	
        />
	</msg>
	<nat 
  #set ($group = $cfg.EndpointSettings.getSetting('nat')) 
  #foreach ($setting in $cfg.getSettings($group))
        nat.${setting.ProfileName}="$!{setting.Value}"
  #end
        />
#if($phone.DeviceVersion.VersionId != '1.6')
    
   <attendant
#set ($group = $cfg.EndpointSettings.getSetting('attendant')) 
#foreach ($setting in $cfg.getSettings($group))
        attendant.${setting.ProfileName}="$!{setting.Value}"
#end
   />
     
   <roaming_buddies 
#set ($group = $cfg.EndpointSettings.getSetting('roaming_buddies')) 
#foreach ($setting in $cfg.getSettings($group))
        roaming_buddies.${setting.ProfileName}="$!{setting.Value}"
#end
   />
   <roaming_privacy 
#set ($group = $cfg.EndpointSettings.getSetting('roaming_privacy')) 
#foreach ($setting in $cfg.getSettings($group))
        roaming_privacy.${setting.ProfileName}="$!{setting.Value}"
#end
   />
   
#end   
   
</phone1>
