<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PHONE>
	<REGISTRATION
	{foreach $lines as $row}reg.{$row.line_number}.displayName="{$row.display_name}"
		reg.{$row.line_number}.address="{$row.user_id}@{$row.server_address}"
		reg.{$row.line_number}.label="{$row.label}"
		reg.{$row.line_number}.serverFeatureControl.cf="{$polycom_feature_key_sync}"
		reg.{$row.line_number}.serverFeatureControl.dnd="{$polycom_feature_key_sync}"
		{if isset($row.shared_line)}reg.{$row.line_number}.type="{$row.shared_line}"{else}reg.{$row.line_number}.type="private"{/if}

		reg.{$row.line_number}.thirdPartyName=""
		reg.{$row.line_number}.auth.userId="{$row.user_id}"
		reg.{$row.line_number}.auth.password="{$row.password}"
		{if isset($row.line_keys)}reg.{$row.line_number}.lineKeys="{$row.line_keys}"{else}reg.{$row.line_number}.lineKeys="1"{/if}

		{if isset($row.outbound_proxy)}reg.{$row.line_number}.outboundProxy.address = "{$row.outbound_proxy}"{/if}

		{if isset($row.sip_port)}reg.{$row.line_number}.outboundProxy.port="{$row.sip_port}"{else}reg.{$row.line_number}.outboundProxy.port="5060"{/if}

		{if $row.sip_transport == ''}reg.{$row.line_number}.outboundProxy.transport="TCPOnly"{/if}
		{if $row.sip_transport == 'tcp'}reg.{$row.line_number}.outboundProxy.transport="TCPOnly"{/if}
		{if $row.sip_transport == 'udp'}reg.{$row.line_number}.outboundProxy.transport="UDPOnly"{/if}
		{if $row.sip_transport == 'tls'}reg.{$row.line_number}.outboundProxy.transport="TLS" {/if}
		{if $row.sip_transport == 'dns srv'}reg.{$row.line_number}.outboundProxy.transport="DNSnaptr"{/if}

		{if isset($row.server_address_primary)}reg.{$row.line_number}.server.1.address="{$row.server_address_primary}"{else}reg.{$row.line_number}.server.1.address="{$row.server_address}"{/if}

		{if isset($row.sip_port)}reg.{$row.line_number}.server.1.port="{$row.sip_port}"{else}reg.{$row.line_number}.server.1.port="5060"{/if}

		{if $row.sip_transport == ''}reg.{$row.line_number}.server.1.transport="TCPOnly"{/if}
		{if $row.sip_transport == 'tcp'}reg.{$row.line_number}.server.1.transport="TCPOnly"{/if}
		{if $row.sip_transport == 'udp'}reg.{$row.line_number}.server.1.transport="UDPOnly"{/if}
		{if $row.sip_transport == 'tls'}reg.{$row.line_number}.server.1.transport="TLS" {/if}
		{if $row.sip_transport == 'dns srv'}reg.{$row.line_number}.server.1.transport="DNSnaptr"{/if}

		{if isset($row.register_expires)}reg.{$row.line_number}.server.1.expires="{$row.register_expires}"{else}reg.{$row.line_number}.server.1.expires="{$row.register_expires}"{/if}

		reg.{$row.line_number}.server.2.address="{$row.server_address_secondary}"
		{if isset($row.sip_port)}reg.{$row.line_number}.server.2.port="{$row.sip_port}"{else}reg.{$row.line_number}.server.1.port="5060"{/if}

		{if $row.sip_transport == ''}reg.{$row.line_number}.server.2.transport="TCPOnly"{/if}
		{if $row.sip_transport == 'tcp'}reg.{$row.line_number}.server.2.transport="TCPOnly"{/if}
		{if $row.sip_transport == 'udp'}reg.{$row.line_number}.server.2.transport="UDPOnly"{/if}
		{if $row.sip_transport == 'tls'}reg.{$row.line_number}.server.2.transport="TLS" {/if}
		{if $row.sip_transport == 'dns srv'}reg.{$row.line_number}.server.2.transport="DNSnaptr"{/if}

		{if isset($row.register_expires)}reg.{$row.line_number}.server.2.expires="{$row.register_expires}"{else}reg.{$row.line_number}.server.2.expires="{$row.register_expires}"{/if}
		
		{if isset($polycom_ring_type)}reg.{$row.line_number}.ringType="{$polycom_ring_type}"{/if}

		{if isset($polycom_ring_type_private)}reg.{$row.line_number}.ringType.privateLine="{$polycom_ring_type_private}"{/if}

	{/foreach}
	/>
	<SECURITY
		sec.srtp.enable="{$polycom_srtp_enable}"
		sec.srtp.offer="{$polycom_srtp_offer}"
		sec.srtp.require="{$polycom_srtp_require}"
		{if isset($polycom_root_cert)}sec.TLS.customCaCert.5="{$polycom_root_cert}"{/if}
		{if isset($polycom_cert_validation)}sec.TLS.SIP.strictCertCommonNameValidation="{$polycom_cert_validation}"{/if}
		{if isset($polycom_provision_cert_validate)} 
		device.sec.TLS.prov.strictCertCommonNameValidation.set ="1" 
		device.sec.TLS.prov.strictCertCommonNameValidation="{$polycom_provision_cert_validate}"
		{/if}
		{if isset($polycom_platform_profile_cipher_suite)} 
		device.sec.TLS.profile.cipherSuiteDefault1.set="1"
		device.sec.TLS.profile.cipherSuiteDefault1="0"
		device.sec.TLS.profile.cipherSuite1.set="1"
		device.sec.TLS.profile.cipherSuite1="{$polycom_platform_profile_cipher_suite}"
		{/if}		
	/>
	<DEVICE_SETTINGS
		device.set="1"
		device.baseProfile.set="1"
		device.baseProfile="Generic"
		device.sntp.serverName="{$ntp_server_primary}"
		device.sntp.gmtOffset="{$polycom_gmt_offset}"
		device.prov.upgradeServer.set="1"
		device.prov.upgradeServer="{$polycom_firmware_url}"
		{if isset($admin_password)}
		device.auth.localUserPassword.set="1" 
		device.auth.localUserPassword="{$admin_password}"
		{/if}
		{if isset($admin_password)}
		device.auth.localAdminPassword.set="1"
		device.auth.localAdminPassword="{$admin_password}"
		{/if}
		{if isset($dns_server_primary)}device.dns.serverAddress="{$dns_server_primary}"{/if}
		{if isset($dns_server_secondary)}device.dns.altSrvAddress="{$dns_server_secondary}"{/if}
		{if isset($polycom_provision_url)}
		device.prov.serverName.set="1"
		device.prov.serverName="{$polycom_provision_url}"
		{else}
		device.prov.serverName.set="1"
		device.prov.serverName="{$domain_name}/app/provision/"
		{/if}
		device.prov.serverType.set="1"
		device.prov.serverType="{$polycom_server_type}"
		device.prov.user.set="1"
		device.prov.user="{$http_auth_username}"
		device.prov.password.set="1"
		device.prov.password="{$http_auth_password}"
		device.prov.tagSerialNo.set="1"
		device.prov.tagSerialNo="1"
		device.prov.redunAttemptLimit.set="1"
		device.prov.redunAttemptLimit="10"
		device.prov.redunInterAttemptDelay.set="1"
		device.prov.redunInterAttemptDelay="150"
		device.prov.abortSWUpgradeAfterFailures.set="1"
		device.prov.abortSWUpgradeAfterFailures="3"
		{if isset($polycom_syslog_server)}
		device.syslog.serverName.set="1"
		device.syslog.serverName="{$polycom_syslog_server}"
		device.syslog.transport.set="1"
		device.syslog.transport="{$polycom_syslog_transport}"
		device.syslog.facility.set="1"
		device.syslog.facility="{$polycom_syslog_facility}"
		device.syslog.renderLevel.set="1"
		device.syslog.renderLevel="{$polycom_syslog_renderlevel}"
		device.syslog.prependMac.set="1"
		device.syslog.prependMac="{$polycom_syslog_prependmac}"
		{/if}
	/>
	<SNTP
		tcpIpApp.sntp.resyncPeriod="86400"
		tcpIpApp.sntp.address="{$ntp_server_primary}"
		tcpIpApp.sntp.gmtOffset.overrideDHCP="1"
		tcpIpApp.sntp.gmtOffset="{$polycom_gmt_offset}"
		{if $daylight_savings_enabled}
		tcpIpApp.sntp.daylightSavings.enable="1"
		{else}
		tcpIpApp.sntp.daylightSavings.enable="0"
		{/if}
		tcpIpApp.sntp.daylightSavings.fixedDayEnable="0"
		tcpIpApp.sntp.daylightSavings.start.month="{$daylight_savings_start_month}"
		tcpIpApp.sntp.daylightSavings.start.date="{$daylight_savings_start_day}"
		tcpIpApp.sntp.daylightSavings.start.time="{$daylight_savings_start_time}"
		tcpIpApp.sntp.daylightSavings.start.dayOfWeek="1"
		tcpIpApp.sntp.daylightSavings.start.dayOfWeek.lastInMonth="0"
		tcpIpApp.sntp.daylightSavings.stop.month="{$daylight_savings_stop_month}"
		tcpIpApp.sntp.daylightSavings.stop.date="{$daylight_savings_stop_day}"
		tcpIpApp.sntp.daylightSavings.stop.time="{$daylight_savings_stop_time}"
		tcpIpApp.sntp.daylightSavings.stop.dayOfWeek="1"
		tcpIpApp.sntp.daylightSavings.stop.dayOfWeek.lastInMonth="0"
	/>
	<DIALPLAN
		{if $polycom_emergency_customized}
			dialplan.routing.server.1.address="{$polycom_emergency_server}"
			dialplan.routing.server.1.port="{$polycom_emergency_port}"
				{foreach $polycom_emergency_number as $number name=emergencynumbers}
					dialplan.routing.emergency.{$smarty.foreach.emergencynumbers.iteration}.value="{$number}"
					dialplan.routing.emergency.{$smarty.foreach.emergencynumbers.iteration}.server.1="1"
				{/foreach}
		{/if}
		{if isset($polycom_digitmap)}dialplan.digitmap="{$polycom_digitmap}"{else}dialplan.digitmap=""{/if}
		{if isset($polycom_digitmap_timeout)}dialplan.digitmap.timeOut="{$polycom_digitmap_timeout}"{else}dialplan.digitmap.timeOut=""{/if}
	/>
	<DEVICE_KEYS
		attendant.uri=""
		{if isset($polycom_remotecallerid_automata)}
			attendant.behaviors.display.remoteCallerID.automata="{$polycom_remotecallerid_automata}"
		{else}
			attendant.behaviors.display.remoteCallerID.automata="0"
		{/if}
		{if isset($polycom_remotecallerid_normal)}
			attendant.behaviors.display.remoteCallerID.normal="{$polycom_remotecallerid_normal}"
		{else}
			attendant.behaviors.display.remoteCallerID.normal="0"
		{/if}
		{if isset($polycom_spontaneouscallappearances_automata)}
			attendant.behaviors.display.spontaneousCallAppearances.automata="{$polycom_spontaneouscallappearances_automata}"
		{else}
			attendant.behaviors.display.spontaneousCallAppearances.automata="0"
		{/if}
		{if isset($polycom_spontaneouscallappearances_normal)}
			attendant.behaviors.display.spontaneousCallAppearances.normal="{$polycom_spontaneouscallappearances_normal}"
		{else}
			attendant.behaviors.display.spontaneousCallAppearances.normal="0"
		{/if}
		feature.enhancedFeatureKeys.enabled="1"
		{foreach $keys["line"] as $row}
			{if $row.device_key_type == "automata" || $row.device_key_type == "normal"}
				attendant.resourceList.{$row.device_key_id}.address="{$row.device_key_value}"
				attendant.resourceList.{$row.device_key_id}.callAddress=""
				attendant.resourceList.{$row.device_key_id}.label="{$row.device_key_label}"
				attendant.resourceList.{$row.device_key_id}.proceedingIsRecipient="0"
				attendant.resourceList.{$row.device_key_id}.type="{$row.device_key_type}"
			{else}
				{if $row.device_key_type != "line"}
					{if $row.device_key_type == "URL"}
						key.{$row.device_key_id}.function.prim="{$row.device_key_value}"
					{else}
						key.{$row.device_key_id}.function.prim="{$row.device_key_type}"
						key.{$row.device_key_id}.subPoint.prim="{$row.device_key_value}"
					{/if}
				{/if}
			{/if}
		{/foreach}
	/>
	<MULTICAST_PAGING
		ptt.pageMode.enable="{$polycom_page_enable}"
		ptt.pageMode.group.1.label="Page All"
	/>
	<REMOTE_PACKET_CAPTURE
		diags.pcap.enabled="0"
		diags.pcap.remote.enabled="0"
	/>
	<GENERAL
		{if isset($polycom_nat_ip)}
		nat.ip="{$polycom_nat_ip}"
		{/if}
		{if isset($polycom_keep_alive)}nat.keepalive.interval="{$polycom_keep_alive}"
		{else}nat.keepalive.interval="30"{/if}
		voIpProt.SIP.specialEvent.checkSync.alwaysReboot="1"
		voIpProt.SIP.requestValidation.1.method="{$polycom_request_validation_method}"
		voIpProt.SIP.requestValidation.1.request="{$polycom_request_validation_request}"
		voIpProt.SIP.alertInfo.2.class="autoAnswer"
		voIpProt.SIP.alertInfo.2.value="answer"
		voIpProt.server.1.failOver.reRegisterOn="1"
		voIpProt.server.1.failOver.failRegistrationOn="1"
		voIpProt.server.1.failOver.onlySignalWithRegistered="1" 
		voIpProt.server.1.failOver.failBack.mode="duration"
		voIpProt.server.1.failOver.failBack.timeout="120"
		voIpProt.server.2.failOver.reRegisterOn="1"
		voIpProt.server.2.failOver.failRegistrationOn="1"
		voIpProt.server.2.failOver.onlySignalWithRegistered="1" 
		voIpProt.server.2.failOver.failBack.mode="duration"
		voIpProt.server.2.failOver.failBack.timeout="120"
		{if isset($polycom_bluetooth_radio_on)}feature.bluetooth.radioOn="{$polycom_bluetooth_radio_on}"{/if}
		feature.broadsoftUcOne.enabled="0"
		voice.volume.persist.handset="1"
		voice.volume.persist.handsfree="1"
		voice.volume.persist.headset="1"
		voice.volume.persist.usbHeadset="1"
		voice.volume.persist.bluetooth.headset="1"
		voice.volume.persist.usb.handsfree="1"
		feature.nonVolatileRingerVolume.enabled="1"
		up.headsetMode="{$polycom_headset_mode}"
		{if isset($polycom_analog_headset_option)}up.analogHeadsetOption="{$polycom_analog_headset_option}"{/if}
		up.oneTouchVoiceMail="{$polycom_one_touch_voicemail}"
		exchange.server.url="0.0.0.0"
		up.warningLevel="2"
		call.defaultTransferType="{$polycom_default_transfer_method}"
		call.callWaiting.enable="{$polycom_call_waiting}"
		call.callWaiting.ring="beep"
		call.callsPerLineKey="{$polycom_calls_per_line_key}"
		up.OffHookLineView.enabled="{$polycom_offhook_line_view_enabled}"
		prov.polling.enabled="{$polycom_provision_polling_enabled}"
		prov.polling.mode="{$polycom_provision_polling_mode}"
		prov.polling.period="{$polycom_provision_polling_period}"
		prov.polling.time="{$polycom_provision_polling_time}"
		prov.polling.timeRandomEnd="{$polycom_provision_polling_timerandomend}"
		feature.urlDialing.enabled="0"
		feature.logUpload.enabled="{$polycom_log_upload_enabled}"
		powerSaving.enable="{$polycom_power_saving_enable}"
		voice.aec.hf.enable="1"
		voice.aec.hs.enable="1"
		dir.local.readonly="{$polycom_contact_list_readonly}"
		{if isset($polycom_video_enable)}video.enable="{$polycom_video_enable}"{/if}
		{if isset($polycom_video_audio_call_mode)}video.callMode.default="{$polycom_video_audio_call_mode}"	{/if}
		{if isset($polycom_video_audio_toggle)}feature.audioVideoToggle.enabled="{$polycom_video_audio_toggle}"	{/if}
		{foreach $lines as $row}
			msg.mwi.{$row.line_number}.callBackMode="contact"
			msg.mwi.{$row.line_number}.callBack="{$voicemail_number}"
		{/foreach}
		{if isset($polycom_diversion_header)}voIpProt.SIP.header.diversion.enable="{$polycom_diversion_header}"{/if}
		reg.1.server.1.subscribe.expires="{$polycom_subscribe_expires}"
		{if isset($polycom_contacts_directory)}contacts_directory="{$polycom_contacts_directory}/{$domain_name}/"{/if}
		{if isset($polycom_pagination_enabled)}up.Pagination.enabled="{$polycom_pagination_enabled}"{/if}
	/>
	<SOFT_KEYS
		softkey.1.label="VMTransfer"
		softkey.1.action="^*99$P1N4$$Trefer$"
		softkey.1.enable="1"
		softkey.1.use.active="1"
		{if isset($polycom_softkey_1_precede)}
		softkey.1.precede="{$polycom_softkey_1_precede}"
		{else}softkey.1.precede="0"
		{/if}
		efk.efkprompt.1.label="Voice Mail ID to transfer to:"
		efk.efkprompt.1.status="1"
		efk.efkprompt.1.type="numeric"
		{if isset($polycom_intercom_enable)}
		softkey.2.label="Intercom"
		softkey.2.action="^*8$P2N4$$Tinvite$"
		softkey.2.enable="1"
		softkey.2.use.idle="1"
		efk.efkprompt.2.label="Enter destination"
		efk.efkprompt.2.status="1"
		efk.efkprompt.2.type="numeric"
		efk.efkprompt.2.userfeedback="visible"
		efk.efkprompt.2.digitmatching="none"
		{/if}
		{if isset($polycom_pickup_enable)}
		softkey.3.label="Pick up"
		softkey.3.action="^**$P3N4$$Tinvite$"
		softkey.3.enable="1"
		softkey.3.use.idle="1"
		efk.efkprompt.3.label="Enter ext to intercept"
		efk.efkprompt.3.status="1"
		efk.efkprompt.3.type="numeric"
		efk.efkprompt.3.userfeedback="visible"
		efk.efkprompt.3.digitmatching="none"
		{/if}
		{if isset($polycom_softkey_do_not_disturb)}softkey.feature.doNotDisturb="{$polycom_softkey_do_not_disturb}"{/if}
		{if isset($polycom_softkey_forward)}softkey.feature.forward="{$polycom_softkey_forward}"{/if}
		{if isset($polycom_softkey_newcall)}softkey.feature.newcall="{$polycom_softkey_newcall}"{/if}
		{if isset($polycom_softkey_directories)}softkey.feature.directories="{$polycom_softkey_directories}"{/if}
		{if isset($polycom_basic_call_management_redundant)}
		softkey.feature.basicCallManagement.redundant="{$polycom_basic_call_management_redundant}"
		efk.softkey.alignleft="1"
		{/if}
	/>
	<HOME_SCREEN
		{if isset($polycom_homescreen_do_not_disturb)}homeScreen.doNotDisturb.enable="{$polycom_homescreen_do_not_disturb}"{/if}
		{if isset($polycom_homescreen_forward)}homeScreen.forward.enable="{$polycom_homescreen_forward}"{/if}
		{if isset($polycom_homescreen_directories)}homeScreen.directories.enable="{$polycom_homescreen_directories}"{/if}
		homeScreen.intercom.enable="0"
	/>
	<USB 
		feature.callRecording.enabled="0"
	/>
	<LANGUAGE
		lcl.ml.lang="{$polycom_display_language}"
	/>
	
	<NETWORK_SETTINGS
		{if isset($polycom_dns_server)} 
		device.dns.serverAddress.set="1"
		device.dns.serverAddress="{$polycom_dns_server}"
		{/if}
		{if isset($polycom_dns_alt_server)} 
		device.dns.altSrvAddress.set="1"
		device.dns.altSrvAddress="{$polycom_dns_alt_server}"
		{/if}
		{if isset($polycom_boot_server_option)}
		device.dhcp.bootSrvUseOpt.set="1"
		device.dhcp.bootSrvUseOpt="{$polycom_boot_server_option}"
		{/if}
		{if isset($polycom_lldp_enabled)}
		device.net.lldpEnabled.set="1"
		device.net.lldpEnabled="{$polycom_lldp_enabled}"
		{/if}
		{if isset($polycom_cdp_enabled)}
		device.net.cdpEnabled.set="1"
		device.net.cdpEnabled="{$polycom_cdp_enabled}"
		{/if}
		{if isset($polycom_dhcp_vlan_discovery)}
		device.dhcp.dhcpVlanDiscUseOpt.set="1"
		device.dhcp.dhcpVlanDiscUseOpt="{$polycom_dhcp_vlan_discovery}"
		{/if}
	/>
</PHONE>
