Content

Page tree




You can use the XML Definition functionality to configure a function key to toggle/change a setting value. The XML definition text is explained in detail  in the XML Definition tutorial, please read there the full explanation on how this works.


Here are the steps:

1. Open the web interface of the phone and click on Function keys. Choose a function key.

2. Under Type, choose "XML Definition"

3. Under Number, enter the XML definition text (see examples below)

4. Press Apply

5. Test your XML definition by pressing the chosen function key

Notes

-if the phone has a username/password set for the web interface, please replace 127.0.0.1 with user:password@127.0.0.1 in the examples below

-if the phone is being provisioned the chosen function key might get rewritten, so you might need to adjust the provisioning file


Below are some XLM Definition examples. Based on these examples you can replace the setting name in order to apply this on any other setting.



Toggle language between English and German

In this example we would like to set up a function key to change setting language to English or German.  Below you can see the XML Definition text that we would need:

<general type="LanguageToggle" />
<initialization>
    <state value="English"/>
</initialization>
<action>
    <url target="http://127.0.0.1/settings.htm?settings=save&language=English&store_settings=save" when="on press" states="Deutsch"/>
    <url target="http://127.0.0.1/settings.htm?settings=save&language=Deutsch&store_settings=save" when="on press" states="English"/>
    <assign when="on press" states="Deutsch">
        <source context="this entity" value="English"/>
        <destination context="this entity" id="state"/>
    </assign>
    <assign when="on press" states="English">
        <source context="this entity" value="Deutsch"/>
        <destination context="this entity" id="state"/>
    </assign>
</action>



Toggle DND on/off per identity

Here is an example for setting the DND on or off per identity (setting: dnd_modeX, where X is the current active identity). You can reach the same functionality by long pressing the DND button, but this example is useful for phones that don't have the hardware DND button.

<general type="Toggle" />
<initialization>
</initialization>
<action>
<assign type="update on change" when="after initialization">
<source context="setting" id="outgoing_identity"/>
<destination context="this entity" id="idx"/>
</assign>
<assign when="after initialization">
<source context="setting" id="dnd_mode[$(identity)]"/>
<destination context="this entity" id="state"/>
</assign>
<assign when="on press">
<source context="setting" id="dnd_mode[$(identity)]"/>
<destination context="this entity" id="state"/>
</assign>
<url target="http://127.0.0.1/dummy.htm?settings=save&dnd_mode$(idx)=on&store_settings=save" when="on release" state="off"/>
 <url target="http://127.0.0.1/dummy.htm?settings=save&dnd_mode$(idx)=off&store_settings=save" when="on release" state="on"/>
</action>



Toggle user_dtmf_info to "off" or "sip_info_only" per identity

For this example we want to change setting user_dtmf_infoX between off and sip_info_only. Here is the xml definition for this case:

<general type="Toggle" />
<initialization>
</initialization>
<action>
<assign type="update on change" when="after initialization">
<source context="setting" id="outgoing_identity"/>
<destination context="this entity" id="idx"/>
</assign>
<assign when="after initialization">
<source context="setting" id="user_dtmf_info[$(identity)]"/>
<destination context="this entity" id="state"/>
</assign>
<assign when="on press">
<source context="setting" id="user_dtmf_info[$(identity)]"/>
<destination context="this entity" id="state"/>
</assign>
<url target="http://127.0.0.1/dummy.htm?settings=save&user_dtmf_info$(idx)=sip_info_only&store_settings=save" when="on release" state="off"/>
<url target="http://127.0.0.1/dummy.htm?settings=save&user_dtmf_info$(idx)=off&store_settings=save" when="on release" state="sip_info_only"/>
</action>

Note

Before you configure the key, make sure the setting already has one of the toggled values (for our example, user_dtmf_info must be set to off or to sip_info_only for all active identities). Otherwise the XML definition cannot initialize correctly.