Scheduled maintenance alert

Our website will undergo maintenance from Di, 19.11.2024, 20:00 CEST to Di, 19.11.2024, 22:00 CEST, which may cause occasional service disruptions. We apologize for any inconvenience and appreciate your understanding.

Content

Page tree

Index:



The Snom Minibrowser provides built-in templates which can be accessed through an internal URL. These templates can be used to achieve common tasks faster and avoid writing duplicate code. Currently (version 10.1.64.14) it is possible to use templates for quickly writing the following applications: user input, text display, selection menu and decision application. See below for details for each template.

This article provides documentation for the templates in firmware version 10.1.64.14. The content of the templates might change in future versions.

Using the templates

The templates can be used to create URLs. You can then use the URLs in different ways:


Writing your own templates

In addition to the existing templates, you can also add your own templates by replacing the templates.xml file with an extended version of your own. For instructions how to replace files on Snom deskphones, see Phone menu customization .



The templates.xml file

The file templates.xml is located at file:///xml/gui/templates.xml. You can find a copy of this file for a specific firmware version in the Firmware Update Center (click on the firmware version, scroll down to Customization Files, dowload the archive and look under xml/gui/ inside the archive).

Below is as a copy of this file for your reference, taken from firmware version 10.1.64.14 (click 'Expand source' to view it).

templates.xml
<IPPhoneBatch xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="../schemas/minibrowser.xsd">
  <IPPhoneInput track="no" dtmf="off" id="input_template" document_id="user_input_template">
    <Url input_required="$(var:input_required)">$(var:input_url)</Url>
    <InputItem>
      <DisplayName>$(var:input_displayname)</DisplayName>
      <InputToken>$(var:input_token)</InputToken>
      <InputFlags>$(var:input_flags)</InputFlags>
      <InputMask>$(var:input_mask)</InputMask>
      <DefaultValue>$(var:input_default)</DefaultValue>
      <Range>$(var:input_range)</Range>
      <ContactPoolInEdit>$(var:input_pool_key)</ContactPoolInEdit>
    </InputItem>
    <If condition="$(is_set:$(var:custom_f4))">
      <SoftKeyItem>
        <Name>F4</Name>
        <SoftKey>$(var:custom_f4)</SoftKey>
      </SoftKeyItem>
    </If>
  </IPPhoneInput>
  <IPPhoneMenu track="no" id="selection_template" document_id="user_selection_template">
    <Title>$(var:list_title)</Title>
    <If condition="!$(empty:$(repeat_values:$(var:list_values)))">
      <Repeat values="$(repeat_values:$(var:list_values))" token="|__NAME__|__ID__|__URL__|">
        <MenuItem name="__NAME__" id="__ID__">
          <Url>__URL__</Url>
        </MenuItem>
      </Repeat>
    </If>
    <Else>
      <MenuItem sel="true" name="$(lang:list_no_data)"></MenuItem>
    </Else>some
  </IPPhoneMenu>
  <IPPhoneText track="no" id="text_template" document_id="user_text_template">
    <Title>$(var:text_title)</Title>
    <If condition="$(is_set:$(var:text_image_url))">
      <Image>
        <LocationX>$(var:text_image_locationx)</LocationX>
        <LocationY>$(var:text_image_locationy)</LocationY>
        <Url>$(var:text_image_url)</Url>
      </Image>
    </If>
    <LocationX>$(var:text_locationx)</LocationX>
    <LocationY>$(var:text_locationy)</LocationY>
    <Text translate_callbacks="$(var:text_translate)">$(var:text_content)</Text>
    <If condition="$(is_set:$(var:text_softkeys))">
      <Repeat values="$(var:text_softkeys)" token="|__NAME__|__LABEL__|__URL__|__SOFTKEY__|">
        <SoftKeyItem>
          <Name>__NAME__</Name>
          <Label>__LABEL__</Label>
          <Url>__URL__</Url>
          <SoftKey>__SOFTKEY__</SoftKey>
        </SoftKeyItem>
      </Repeat>
    </If>
  </IPPhoneText>
</IPPhoneBatch>

User Input

Provides a SnomIPPhoneInput


Parameters:

You can find detailed definitions of the attributes and subtags under SnomIPPhoneInput.

  • $(var:input_required) - the input_required attribute
  • $(var:input_url) - the URL content
  • $(var:input_displayname) - the DisplayName subtag
  • $(var:input_token) - the InputToken subtag
  • $(var:input_flags) - the InputFlags subtag
  • $(var:input_mask) - the InputMask subtag
  • $(var:input_default) - the DefaultValue subtag
  • $(var:input_range) - the Range subtag
  • $(var:input_pool_key) - the ContactPoolInEdit subtag


Example:

Consider the following URL (the newlines were added for better readability):

file:///xml/gui/templates.xml
#sub=*[@id="input_template"]
&var:input_displayname=ChangePreNr
&var:input_token=__Y__
&var:input_flags=n
&var:input_url=snom://mb_exit#set:preselection_nr=__Y__
  • the first line means that the templates.xml file inside the phone will be called.
  • the sub function will be executed and due to the given xpath, the SnomIPPhoneInput with id input_template inside the XML file will be loaded.
  • assign value to variable input_displayname
  • assign value to variable input_token
  • assign value to variable input_flags
  • assign value to variable input_url. This contains a target URL which tells the Minibrowser where to go after the user confirms the input. In this case, the Minibrowser will set the preselection_nr to the entered number and then exit via the mb_exit path.


Here is a possible XML code for using this example:

<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneMenu>
	<MenuItem name="Change preselection number">
		<Url>file:///xml/gui/templates.xml#sub=*[@id="input_template"]&amp;var:input_displayname=ChangePreNr&amp;var:input_token=__Y__&amp;var:input_flags=n&amp;var:input_url=snom://mb_exit#set:preselection_nr=__Y__</Url>
	</MenuItem>
</SnomIPPhoneMenu>


Result (after setting preselection_nr to 123, when dialing 0 the dialed result will be 1230) :



Display text

Provides a SnomIPPhoneText


Parameters:

You can find detailed definitions of the attributes and subtags under SnomIPPhoneText

  • $(var:text_title) - the Title subtag
  • $(var:text_content) - the Text to display
  • $(var:text_image_url) - an Image URL
  • $(var:text_image_locationx) and $(var:text_image_locationy) - X and Y locations for the image
  • $(var:text_locationx) and $(var:text_locationy) - X and Y locations for the text
  • $(var:text_translate) - the translate_callbacks attribute
  • $(var:text_softkeys) - an array of softkeys to be shown, of format |Name|Label|URL|Softkey|. Example: var:text_softkeys=|F1|F_OK|phone://mb_exit#contact_tbook_sync=$(set:active_line)||F4|F_CANCEL|phone://mb_nop#go_back||


Example:

Consider the following URL (the newline added for better readability):

file:///xml/gui/templates.xml
#sub=*[@id="text_template"]
&var:text_title=Text
&var:text_content=Hello
&var:text_translate=no
  • load templates.xml from Snom phone
  • assign value to variable title
  • assign value to variable text
  • assign value to variable text_translate


Here is a possible XML code for using this example:

<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneMenu>
	<MenuItem name="Trigger template example">
		<Url>file:///xml/gui/templates.xml#sub=*[@id="text_template"]&amp;var:text_title=Text&amp;var:text_content=Hello&amp;var:text_translate=no</Url>
	</MenuItem>
</SnomIPPhoneMenu>

Result:



Selection menu

Provides a SnomIPPhoneMenu



Other templates

The phone provides two more templates which are not present in templates.xml but can also be quite useful.

The mini text template

This template can be used for displaying very simple text. It is hard-coded on the phone and cannot be changed, but it can be accessed via file:///xml/text.xml. It contains only the following:

<?xml version="1.0" encoding="UTF-8"?>
<IPPhoneText>
  <Title>$(var:title)</Title>
  <Text>$(var:text)</Text>
</IPPhoneText>


The parameters for this templates are self explanatory. Here is an example of using this template for displaying simple text:

<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneMenu>
	<MenuItem name="Trigger template example">
		<Url>file:///xml/text.xml#var:title=Text&var:text=Hello</Url>
	</MenuItem>
</SnomIPPhoneMenu>


The decision template

This template can be used for displaying a decision application . It can be accessed via file:///xml/gui/decision.xml and it can be customized in the same way as templates.xml. It contains the following (taken from version 10.1.64.14):

templates.xml
<?xml version="1.0" encoding="UTF-8"?>
<IPPhoneBatch>
  <IPPhoneText id="dsc_std" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../schemas/minibrowser.xsd">
    <Title>$(var:dsc_title)</Title>
    <Text>$(var:dsc_text)</Text>
    <If condition="$(var:dsc_yes)">
      <SoftKeyItem>
        <Name>ENTER</Name>
        <Url>phone://mb_exit#$(var:action)=yes,$(var:pass_params)</Url>
      </SoftKeyItem>
      <SoftKeyItem>
        <If condition="!$(empty:$(var:xml_yes_fkey))">
          <Name>$(var:xml_yes_fkey)</Name>
        </If>
        <Else>
          <Name>F1</Name>
        </Else>
        <Label>F_OK</Label>
        <Url>phone://mb_exit#$(var:action)=yes,$(var:pass_params)</Url>
      </SoftKeyItem>
    </If>
    <If condition="$(var:dsc_no)">
      <SoftKeyItem>
        <Name>CANCEL</Name>
        <Url>phone://mb_exit#$(var:action)=no,$(var:pass_params)</Url>
      </SoftKeyItem>
      <SoftKeyItem>
        <If condition="!$(empty:$(var:xml_no_fkey))">
          <Name>$(var:xml_no_fkey)</Name>
        </If>
        <Else>
          <Name>F2</Name>
        </Else>
        <Label>F_CANCEL</Label>
        <Url>phone://mb_exit#$(var:action)=no,$(var:pass_params)</Url>
      </SoftKeyItem>
    </If>
    <If condition="$(var:dsc_abort)">
      <SoftKeyItem>
        <Name>F_ABORT</Name>
        <Url>phone://mb_exit#$(var:action)=abort,$(var:pass_params)</Url>
      </SoftKeyItem>
      <SoftKeyItem>
        <If condition="!$(empty:$(var:xml_abort_fkey))">
          <Name>$(var:xml_abort_fkey)</Name>
        </If>
        <Else>
          <Name>F3</Name>
        </Else>
        <Label>F_ABORT</Label>
        <Url>phone://mb_exit#$(var:action)=abort,$(var:pass_params)</Url>
      </SoftKeyItem>
    </If>
  </IPPhoneText>
  <IPPhoneText track="no" id="dsc_url" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../schemas/minibrowser.xsd">
    <Title>$(var:dsc_title)</Title>
    <If condition="!$(empty:$(var:text_x))">
      <LocationX>$(var:text_x)</LocationX>
    </If>
    <If condition="!$(empty:$(var:text_y))">
      <LocationY>$(var:text_y)</LocationY>
    </If>
    <If condition="!$(empty:$(var:number))">
      <Text>$(var:number)<br/>$(var:dsc_text)</Text>
    </If>
    <Else>
      <Text>$(var:dsc_text)</Text>
    </Else>
    <If condition="$(var:dsc_yes)">
      <SoftKeyItem>
        <Name>ENTER</Name>
        <Url track="no">$(var:dsc_yes_url)</Url>
      </SoftKeyItem>
      <SoftKeyItem>
        <If condition="!$(empty:$(var:xml_yes_fkey))">
          <Name>$(var:xml_yes_fkey)</Name>
        </If>
        <Else>
          <Name>F1</Name>
        </Else>
        <Label>F_OK</Label>
        <Url track="no">$(var:dsc_yes_url)</Url>
      </SoftKeyItem>
    </If>
    <If condition="$(var:dsc_no)">
      <SoftKeyItem>
        <Name>CANCEL</Name>
        <Url track="no">$(var:dsc_no_url)</Url>
      </SoftKeyItem>
      <SoftKeyItem>
        <If condition="!$(empty:$(var:xml_no_fkey))">
          <Name>$(var:xml_no_fkey)</Name>
        </If>
        <Else>
          <Name>F2</Name>
        </Else>
        <Label>F_CANCEL</Label>
        <Url track="no">$(var:dsc_no_url)</Url>
      </SoftKeyItem>
    </If>
    <If condition="$(var:dsc_abort)">
      <SoftKeyItem>
        <Name>F_ABORT</Name>
        <Url>$(var:dsc_abort_url)</Url>
      </SoftKeyItem>
      <SoftKeyItem>
        <If condition="!$(empty:$(var:xml_abort_fkey))">
          <Name>$(var:xml_abort_fkey)</Name>
        </If>
        <Else>
          <Name>F3</Name>
        </Else>
        <Label>F_ABORT</Label>
        <Url>$(var:dsc_abort_url)</Url>
      </SoftKeyItem>
    </If>
  </IPPhoneText>
  <IPPhoneText track="no"  state="$(var:dsc_state)" id="dsc_key" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../schemas/minibrowser.xsd">
    <Title>$(var:dsc_title)</Title>
    <Text>$(var:dsc_text)</Text>
    <If condition="$(var:dsc_yes)">
      <SoftKeyItem>
        <Name>ENTER</Name>
        <SoftKey>F_OK</SoftKey>
      </SoftKeyItem>
      <SoftKeyItem>
        <If condition="!$(empty:$(var:xml_yes_fkey))">
          <Name>$(var:xml_yes_fkey)</Name>
        </If>
        <Else>
          <Name>F1</Name>
        </Else>
        <Label>F_OK</Label>
        <SoftKey>F_OK</SoftKey>
      </SoftKeyItem>
    </If>
    <If condition="$(var:dsc_no)">
      <SoftKeyItem>
        <Name>CANCEL</Name>
        <SoftKey>F_CANCEL</SoftKey>
      </SoftKeyItem>
      <SoftKeyItem>
        <If condition="!$(empty:$(var:xml_no_fkey))">
          <Name>$(var:xml_no_fkey)</Name>
        </If>
        <Else>
          <Name>F2</Name>
        </Else>
        <Label>F_CANCEL</Label>
        <SoftKey>F_CANCEL</SoftKey>
      </SoftKeyItem>
    </If>
    <If condition="$(var:dsc_abort)">
      <SoftKeyItem>
        <Name>F_ABORT</Name>
        <SoftKey>F_ABORT</SoftKey>
      </SoftKeyItem>
      <SoftKeyItem>
        <If condition="!$(empty:$(var:xml_abort_fkey))">
          <Name>$(var:xml_abort_fkey)</Name>
        </If>
        <Else>
          <Name>F3</Name>
        </Else>
        <Label>F_ABORT</Label>
        <SoftKey>F_ABORT</SoftKey>
      </SoftKeyItem>
    </If>
  </IPPhoneText>
</IPPhoneBatch>


Example:

Consider the following URL (the newline was added for better readability):

file:///xml/gui/decision.xml
#sub=*[@id="dsc_url"]
&var:dsc_title=decision.xml%20example
&var:dsc_text=Dial%20Alice%253F
&var:dsc_yes=yes
&var:dsc_yes_url=snom%3A%2F%2Fmb_nop%23numberdial%3D700
&var:dsc_no=yes
&var:dsc_no_url=snom%3A%2F%2Fmb_exit
  • the first line means that the decision.xml file inside the phone will be called.
  • the sub function will be executed and due to the given xpath, the SnomIPPhoneText with id dsc_url inside the XML file will be loaded.
  • assign value to variable dsc_title
  • assign value to variable dsc_text
  • assign value to variable dsc_yes to enable the yes option.
  • assign value to variable dsc_yes_url. This contains a target URL to tell the Minibrowser where to go after the user confirms the decision.
  • assign value to variable dsc_no to enable the no option.
  • assign value to variable dsc_no_url. This contain a target URL to tell the Minibrowser where to go after the user cancels the decision.

Here is a possible XML code for using this example:

<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneMenu>
	<MenuItem name="Trigger template example">
		<Url>file:///xml/gui/decision.xml#sub=*[@id="dsc_url"]&amp;var:dsc_title=decision.xml%20example&amp;var:dsc_text=Dial%20Alice%253F&amp;var:dsc_yes=yes&amp;var:dsc_yes_url=snom%3A%2F%2Fmb_nop%23numberdial%3D700&amp;var:dsc_no=yes&amp;var:dsc_no_url=snom%3A%2F%2Fmb_exit</Url>
	</MenuItem>
</SnomIPPhoneMenu>


Result: