<?xml version="1.0" encoding="utf-8"?>
<templates version="1.3.5">
<!-- triggers a relay in the PBX -->
<template prio="10" name="@string/relay_title" icon="@drawable/relay">
<keyConfiguration>
<lua>
<code><![CDATA[
local valid = false
local active = false
local on = "##8*26"
local function updateLed()
if valid then
if active then
key:setLed( "green", true )
time.sleep("2")
key:setLed( "off")
end
else
key:setLed( "red", true )
end
end
local function check_valid()
if identity == "" or relid == "" then
valid = false
else
valid = true
end
end
function onKeyUp()
if valid then
sip.invite(on..relid.."#",false,identity,true)
active = true
updateLed()
end
end
check_valid()
updateLed()
--]]></code>
<params>
<!-- These parameters are available by name within the lua-script (code-section).
Their value is passed from the parameters-section (see below) -->
<param name="identity"/>
<param name="relid"/>
</params>
</lua>
</keyConfiguration>
<parameters>
<!-- entered by user in phone-UI or on website when configuring this key-function.
Will then be passed as value to the lua-scripts params-section. -->
<parameter name="@string/identity">
<path>//param[@name="identity"]/value</path>
</parameter>
<parameter name="Relay Id">
<path>//param[@name="relid"]/value</path>
</parameter>
</parameters>
</template>
</templates>