Content

Page tree


All the Minibrowser main tags can contain the following subtags.


Conditional blocks

The If, Elif, Else tags are used as conditional elements and can depend on dynamic evaluations such as callback expressions of the form $(...). This tags sequence must start with an If tag and it can end with an Else tag, which both can only appear once under the parent element. The Elif tag is optional and can be written zero or more times after If tag end and before Else tag start. This is especially useful for describing alternative child elements.

You can see an usage example here

Valid Attributes

  • condition (If and Elif tag only): if this attribute evaluates to true, the sub elements are interpreted as elements at the position of the if element. This can be either a boolean value like true or false or a comparative expression with one of the following operators: ==, !=, >, <, >=, <= . Additionally you can invert the result by using a ! as first character.

Notes

  • The If, Elif, Else tags can be written almost anywhere (except directly in the XML root).
  • The tests in the condition attribute are case sensitive.
  • The white space will also be accounted in the comparison if it exist
  • Character or word(s) comparison can use only operators == or !=.
  • Number comparison can use operators >, <, >=, <=, == or !=.
  • Using number comparison operators  >, <, >= or <= on alphabet or word(s) comparison can have unexpected results.
  • Write operators >=, <=, != in the correct order.



Repeats

Repeats the containing menu entries while iterating over a list of values and replacing certain parts with the given values.

You can see a Repeats usage example here

Valid Attributes

  • values: Contains a list of values, over which the Repeat loop iterates. During each iteration, the next value from this list is assigned. The first character in this list is the separator, and the list should also end with a separator. The values separator is detected automatically as it the first character in the values list.
    Can't be combined with value_key and var_ifc attribute.
  • value_key: Use callback to generate list. Can't be combined with the values and var_ifc attribute.
  • var_ifc: Contains a composed-id indicating the variable exposed by the addressed variable interface.
  • token: Contains a list of tokens. During each iteration each given token in the sub elements are replaced by the assigned values from the values list. The first character is the separator, and the list should also end with a separator. If combined with var_ifc attribute, the available token will be used as variable for the query.

    It is recommended to use unique tokens. If one token contains another token there might be unexpected results.

    • Good token: token="/__NAME__/__URL__/"
    • Bad token: token="/_name_/_file_name_/"  (this is incorrect because the _name_ tokens is included in the _file_name_ token)

Title

The title that is displayed at the top of the screen when displaying the XML document. Don't use line break inside this tag.


Fetch

Fetches the specified URL (such as another XML file) after a certain delay.

See an example here

Valid Attributes

  • mil: The delay in milliseconds, after which the URL is fetched

Notes

  • Use 1 as value for the of mil attribute to make the phone fetch the URL as fast as possible. The actual minimum value for 'mil' attribute depends on phone type and file load time.
  • The accuracy of fetch tag varies depending on phone type and file load time. Because of this, it is not recommended to use the fetch tag to measure time.
  • Fetch with empty value will not load anything.


SoftKeyItem

Re-configures the functionality of a key and - in case of a context key - its screen label. The keys can be mapped to an URL that will be fetched or to another (virtual-)key. See example here.

Valid Sub Tags

  • Name: the name of the function key. Example: F1, F2, F3, F4, F_REDIAL, F_CANCEL. For a list of valid values see: Key Events.
  • Label: text for the screen label. Only applies to context keys.
  • SoftKey: Key identifier to which the key is remapped to. Example: F_REDIAL, F_DND, F_CANCEL. For a list of valid values see: Key Events.
  • Url: the URL to fetch when the key is pressed
    • Valid attribute: consume_key_event:  (used in XML documents where the state is set to "others_except_mb") if this is set to "1" (or "true"), the key event is consumed by the minibrowser and not passed to the underlying phone state. See an example here
  • Icon: show an icon (for the context keys which are displayed on the screen). This can either be a link to a file containing an image, or the name of an internal icon. If an internal icon is used, the icon will only be shown if the icon exists with a height of 24 pixels (otherwise the Snom logo will be shown). See the internal icon documentation for the icon heights available in the most recent version.
  • If, Elif, Else: conditional blocks



Led

Allows users to control the LEDs of the Free Function Keys. When set to anything other than "Off", the respective LED setting will override any automated, state or event-based control associated with the intended functionality of the LED. For example, if a Line Key LED is manually overridden with this tag, pressing the Line Key button will not trigger any LED changes. Restoring control is achieved via the Minibrowser by setting the state in the Led tag to "Off".

Basic example:

<LED number="6" color="green">blinkfast</LED>

See a more complex example here

Valid Attributes

  • number: LED numbering according to LED Number Order. For example, number="0" is addressed to message LED.
  • color: Valid values: red, green, orange

Valid values

  • On
  • Off
  • Blink
  • blinkfast

  • blinkslow

LED Number Order

Some LEDs are associated with label pages. For example, on a D785, LED5 is the first Line Key LED on page 1. LED11 is the first Line Key LED on page 2. Changing pages will synchronize the LED with its associated state for that page, whether set manually or via the functional rules.

The LED numbering start with:

  • 0. Message LED (All except D120)
  • 1. In Call LED (All phones)
  • 2. Mute LED (All phones in the 7xx Series)
  • 3. Speaker LED (All phones in the 7xx Series)
  • 4. Headset LED (All phones in the 7xx Series)
  • 5-8. Label Page LED (Only D745)

The LED numbers for the line keys have different fixed starting points, because the phones have a varying number of LEDs:

  • D120
    Line LED start at number 1

  • D305 / D315 /  D335 / D345 / D375 / D385
    Line LED start at number 2

  • D712 / D715 / D717 / D725 / D735 / D765 / D785
    Line LED start at number 5

  • D745
    Line LED start at number 9

Notes

  • The changed LED is not listed on the phone's state_of_gui.htm web page
  • If the LED has only one color, this will be triggered by any valid value of the Led tag.
  • Chassis Led and line Led have different behavior based on the value of the Led tag and the value of the color attribute


Examples

Conditional blocks

The Snom Minibrowser supports also conditional code block that can be executed after a condition evaluation. Conditional blocks are implemented trough the tags If, Elif and Else

Simple use of tags

<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneText>
    <If condition="$(set:phone_type)==snomD375">
        <Title>This is a Snom D375</Title>
    </If>
    <Elif condition="$(set:phone_type)==snomD735">
        <Title>This is a Snom D735</Title>
    </Elif>
    <Else>
        <Title>Unknown Snom phone</Title>
    </Else>
    <Text>Snom phone sample text</Text>
</SnomIPPhoneText>

Result


Test on some operators

<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneMenu>
    <Menu name="Menu1">
<!-- TRUE -->   <If condition="a==a"><MenuItem name="TRUE>>a==a" /></If>
        <Else><MenuItem name="FALSE>>a==a" /></Else>
<!-- FALSE -->  <If condition="a==A"><MenuItem name="TRUE>>a==A" /></If>
        <Else><MenuItem name="FALSE>>a==A" /></Else>
<!-- FALSE -->  <If condition="!a==a"><MenuItem name="TRUE>>!a==a" /></If>
        <Else><MenuItem name="FALSE>>!a==a" /></Else>
<!-- FALSE -->  <If condition=" a==a"><MenuItem name="TRUE>> a==a" /></If>
        <Else><MenuItem name="FALSE>> a==a" /></Else>
<!-- TRUE -->   <If condition=" 10>=10"> <MenuItem name="TRUE>> 10>=10" /></If>
        <Else><MenuItem name="FALSE>> 10>=10" /></Else>
<!-- TRUE -->   <If condition="10>= 10"><MenuItem name="TRUE>>10>= 10" /></If>
        <Else><MenuItem name="FALSE>>10>= 10" /></Else>
    </Menu>
</SnomIPPhoneMenu>


Result

Repeat

Example code using the values attribute

<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneMenu>
    <Repeat token="/__NAME__/__URL__/" values="|foo|http://foo.com|bar|http://bar.com|">
        <MenuItem name="__NAME__">
            <Url>__URL__</Url>
        </MenuItem>
    </Repeat>
</SnomIPPhoneMenu>


Result


Example code using the var_ifc attribute

<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneMenu>
    <Title>var_ifc test</Title>
    <Repeat token="|__state__|__name__|__file_name__|" var_ifc="lang.pui.*">
        <if condition="__state__==active">
            <MenuItem name="$(x_o:$(condition:__state__==active)) __name__(__file_name__)" sel="true"/>
        </if>
        <else>
            <MenuItem name="$(x_o:$(condition:__state__==active)) __name__(__file_name__)" sel="false"/>
        </else>
    </Repeat>
</SnomIPPhoneMenu>


Result

Fetch

Fetch example, first page

Please replace http://link_to_second_page_xml.xml in this code example with a link to the XML file from the next example

<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneText>
    <Title>1st page</Title>
    <Text>This text shown only for 4 seconds</Text>
    <fetch mil="4000">http://link_to_second_page_xml.xml</fetch>
</SnomIPPhoneText>


Fetch example, second page

<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneText>
    <Title>2nd page</Title>
    <Text>Bye bye!</Text>
    <Fetch mil="4000">snom://mb_exit</Fetch>
</SnomIPPhoneText>


Result

Led

The first example in this section will turn some LEDs on and the second example will turn them off.


Led example: led on

Please replace http://link_to_second_page_xml.xml in this code example with a link to the XML file from the next example

<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneText>
    <Title>LED Control Feature</Title>
    <Text>This sample page demonstrates the Minibrowser LED control feature.</Text>
    <Led number="1">On</Led>
    <Led number="2">blink</Led>
    <Led number="3">blinkfast</Led>
    <Led number="4">blinkslow</Led>
    <Led number="5" color="green">on</Led>
    <SoftKeyItem>
        <Name>F1</Name>
        <Label>Off</Label>
        <URL>http://link_to_second_page_xml.xml</URL>
    </SoftKeyItem>
    <SoftKeyItem>
        <Name>F2</Name>
        <Label>Exit</Label>
        <URL>snom://mb_exit</URL>
    </SoftKeyItem> 
</SnomIPPhoneText>


Led example: led off

Please replace http://link_to_first_page_xml.xml in this code example with a link to the XML file from the previous example

<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneText>
    <Title>LED Control Feature</Title>
    <Text>This sample page demonstrates the Minibrowser LED control feature.</Text>
    <Led number="1">Off</Led>
    <Led number="2">Off</Led>
    <Led number="3">Off</Led>
    <Led number="4">Off</Led>
    <Led number="5" color="green">Off</Led>
    <SoftKeyItem>
        <Name>F1</Name>
        <Label>On</Label>
        <URL>http://link_to_first_page_xml.xml</URL>
    </SoftKeyItem>    
    <SoftKeyItem>
        <Name>F2</Name>
        <Label>Exit</Label>
        <URL>snom://mb_exit</URL>
    </SoftKeyItem>    
</SnomIPPhoneText>

SoftKeyItem

Example code
<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneMenu name="SoftkeyItem example" state="relevant">
	<SoftKeyItem>
        	<Name>F1</Name>
			<Icon>https://service.snom.com/download/attachments/36831457/room_service.png</Icon>
        	<Label>Example 1</Label>
			<URL>http://something</URL>
	</SoftKeyItem>
	<SoftKeyItem>
        	<Name>F2</Name>
			<Icon>kIconSettingsMaintenance</Icon>
        	<Label>Example 2</Label>
			<SoftKey>F_SETTINGS</SoftKey>
	</SoftKeyItem>
	<Menu name="See softkeys below">
	</Menu>
</SnomIPPhoneMenu>


Result:


SoftKeyItem with consume_key_event

To test the following example:

  • the phone must be in a connected call
  • then, fetch the following minibrowser code
  • press the X (Cancel) key
  • this will call http://10.110.16.61/do_something_else but it will not end the call (the Cancel will not get sent to the  underlying phone state due to consume_key_event="true")

If you change line 8 and remove consume_key_event="true", pressing the X (Cancel) key in a call will not call  http://10.110.16.61/do_something_else. Instead, it will send the Cancel to the underlying phone state and end the call.

<?xml version="1.0" encoding="utf-8"?>
<SnomIPPhoneMenu title="Test" track="false" speedselect="off" state="others_except_mb">
	<MenuItem id="test" name="Press CANCEL to see if it ends call">
		<Url>http://10.110.16.61/do_something.xml</Url>
	</MenuItem>
	<SoftKeyItem>
		<Name>CANCEL</Name>
		<Url consume_key_event="true">http://10.110.16.61/do_something_else</Url>
	</SoftKeyItem>
</SnomIPPhoneMenu>