<?xml version="1.0" encoding="UTF-8"?>
<templates>
<template name="@string/speed_dial_title" prio="30" icon="@drawable/invite">
<keyConfiguration>
<function>
<invocations>
<invocation>
<invite doPickup="true" autoAnswer="false">
<uri/>
<line>
<id/>
</line>
</invite>
</invocation>
</invocations>
<reactions>
<reaction>
<presence enabled="true" withCalllog="true">
<subscribe type="dialog">
<uri/>
<line>
<id/>
</line>
</subscribe>
</presence>
</reaction>
</reactions>
</function>
</keyConfiguration>
<parameters>
<parameter name="@string/uri" type="text">
<path>//subscribe/uri</path>
<path>//invite/uri</path>
</parameter>
<parameter optional="true" name="@string/identity" type="identity">
<path>//subscribe/line/id</path>
<path>//invite/line/id</path>
</parameter>
<parameter optional="true" name="@string/subscription_enabled" type="boolean">
<path>//presence/@enabled</path>
</parameter>
<parameter optional="true" name="@string/do_pickup" type="boolean">
<path>//invite/@doPickup</path>
</parameter>
<parameter optional="true" name="@string/auto_answer" type="boolean">
<path>//invite/@autoAnswer</path>
</parameter>
<parameter optional="true" name="@string/with_calllog" type="boolean">
<path>//presence/@withCalllog</path>
</parameter>
</parameters>
</template>
<template prio="10" name="@string/call_waiting_title" icon="@drawable/call_waiting">
<keyConfiguration>
<function>
<invocations>
<invocation>
<setting path="/telephony/callWaiting/active">
<values>
<value>true</value>
<led ledColor="green"/>
</values>
<values>
<value>false</value>
<led ledColor="off"/>
</values>
</setting>
</invocation>
</invocations>
</function>
</keyConfiguration>
</template>
<template name="@string/do_not_disturb_title" prio="10" icon="@drawable/dnd">
<keyConfiguration>
<function>
<invocations>
<invocation>
<setting path="/telephony/doNotDisturb/active">
<values>
<value>true</value>
<led ledColor="red"/>
</values>
<values>
<value>false</value>
<led ledColor="off"/>
</values>
</setting>
</invocation>
</invocations>
</function>
</keyConfiguration>
</template>
<template prio="10" name="@string/clir_title" icon="@drawable/clir">
<keyConfiguration>
<function>
<invocations>
<invocation>
<setting path="/telephony/clir/active">
<values>
<value>true</value>
<led ledColor="green"/>
</values>
<values>
<value>false</value>
<led ledColor="off"/>
</values>
</setting>
</invocation>
</invocations>
</function>
</keyConfiguration>
</template>
<template prio="10" name="@string/call_forwarding_unconditional_title" icon="@drawable/call_forwarding">
<keyConfiguration>
<lua>
<code>pathPrefix = "/telephony/callForwarding/unconditional/"
require "callforward"</code>
</lua>
</keyConfiguration>
</template>
<template prio="10" name="@string/call_forwarding_busy_title" icon="@drawable/call_forwarding">
<keyConfiguration>
<lua>
<code>pathPrefix = "/telephony/callForwarding/busy/"
require "callforward"</code>
</lua>
</keyConfiguration>
</template>
<template prio="10" name="@string/call_forwarding_no_response_title" icon="@drawable/call_forwarding">
<keyConfiguration>
<lua>
<code>pathPrefix = "/telephony/callForwarding/noResponse/"
require "callforward"</code>
</lua>
</keyConfiguration>
</template>
<template prio="20" name="@string/line_title" icon="@drawable/line">
<keyConfiguration>
<line>
<id/>
</line>
</keyConfiguration>
<parameters>
<parameter name="@string/identity" type="identity">
<path>//line/id</path>
</parameter>
</parameters>
</template>
<template prio="10" name="@string/http_request_title" icon="@drawable/http_request">
<keyConfiguration>
<function>
<invocations>
<invocation>
<http>
<request httpMethod="get">
<uri/>
</request>
<httpReactions>
<responseCode ledColor="off">
<responseCode>200</responseCode>
</responseCode>
</httpReactions>
</http>
</invocation>
</invocations>
</function>
</keyConfiguration>
<parameters>
<parameter name="@string/uri" type="text">
<path>//uri</path>
</parameter>
</parameters>
</template>
<template prio="10" name="@string/vpn" icon="@drawable/setting">
<keyConfiguration>
<lua>
<code><![CDATA[local settingPath = "network/vpn/active"
local active = config.get( settingPath )
local vpnGoodViaNotification = false
local vpnGoodViaNetwork = false
local function updateLed()
if active == "true" then
if vpnGoodViaNotification or vpnGoodViaNetwork then
key:setLed( "green" )
else
key:setLed( "orange", true )
end
else
key:setLed( "off" )
end
end
local function configListener( path )
active = config.get( settingPath )
updateLed()
end
function onKeyUp()
if active == "false" then
config.set( settingPath, "true" )
elseif active == "true" then
config.set( settingPath, "false" )
end
end
local function onNotiConnected()
vpnGoodViaNotification = true;
updateLed()
end
local function onNotiConnectedStopped()
vpnGoodViaNotification = false;
updateLed()
end
local function onVpnEstablished()
vpnGoodViaNetwork = true;
updateLed()
end
local function onVpnLost()
vpnGoodViaNetwork = false;
updateLed()
end
system.notifications.monitor{onCreated=onNotiConnected, onDeleted=onNotiConnectedStopped, pkg=system.notifications.constants.vpnPkg, id=system.notifications.constants.vpnIdSuccess}
system.network.monitor{onAvailable=onVpnEstablished, onLost=onVpnLost, transports="vpn"}
config.register( settingPath, configListener )
updateLed()--]]></code>
</lua>
</keyConfiguration>
</template>
<template prio="10" name="@string/browser" icon="@drawable/http_request">
<keyConfiguration>
<function>
<invocations>
<invocation>
<intent>
<action>android.intent.action.VIEW</action>
<data/>
<component>org.mozilla.klar/org.mozilla.focus.activity.IntentReceiverActivity</component>
</intent>
</invocation>
</invocations>
</function>
</keyConfiguration>
<parameters>
<parameter name="@string/uri" type="text">
<path>//data</path>
</parameter>
</parameters>
</template>
<template name="@string/dtmf_relay_title" prio="10" icon="@drawable/relay">
<keyConfiguration>
<lua>
<code>
function onKeyUp()
sip.calls.dtmf{dtmf = dtmf_sequence}
end
</code>
<params>
<param name="dtmf_sequence"/>
</params>
</lua>
</keyConfiguration>
<parameters>
<parameter name="@string/dtmf_sequence" type="phone">
<path>//param[@name="dtmf_sequence"]/value</path>
</parameter>
</parameters>
</template>
<template prio="10" name="@string/bluetooth" icon="@drawable/bluetooth">
<keyConfiguration>
<lua>
<code><![CDATA[
local adapter_state = 0
local function onStateChanged(state, name)
adapter_state = state
local color = "off"
local blink = false
if (state == -2) then
color = "orange"
blink = false
elseif (state == -1) then
color = "orange"
blink = false
elseif (state == 0) then
-- color off
elseif (state == 2) then
-- on
color = "green"
blink = false
else
-- turning on/off...
color = "green"
blink = true
end
key:setLed(color, blink)
end
function onKeyUp()
-- enable when state is STATE OFF otherwise disable
bluetooth.enable( adapter_state == 0 )
end
bluetooth.registerStateListener(onStateChanged) --]]></code>
</lua>
</keyConfiguration>
</template>
</templates>