Snom Minibrowser Callbacks #
To make use of dynamic information the content of certain elements and attributes are evaluated in order to translate special callback expressions. They have the form $(name) or $(name:arg) and are dynamically replaced by their return values.
Note
The result from callback in example code, which using the telephone specific setting, may differs for another Snom telephone
Things to consider when writing callbacks:
- Callbacks argument: necessity of the argument, limitation on argument.
- Extra white space on callbacks name and arguments: see the example below.
- Character case of the callback and its argument
Warning
There are 2 type of callback place holder, $(...) and $[...]. The one using square brackets will be explained here
Here some examples of common errors:
Correct syntax:
$(max_pkeys)
$(set:vol_speakers)
Error Example | Description |
---|---|
$ (max_pkeys) | whitespace |
$( max_pkeys) | whitespace |
$(max_pkeys ) | whitespace |
$(max_pkeys:argument) | unnecessary argument |
$(set :vol_speaker) | whitespace |
$(set: vol_speaker) | whitespace |
$(set:vol_speaker ) | whitespace |
$(set) | missing argument |
List of available callbacks #
Callback Name | Description |
---|---|
arch_series | Returns the device architecture (Eg. architecture: snom3XX, snom7Xx, snom8XX) |
bool_eval | Returns the boolean value for true or false value |
checkbox_property | Returns if the checkbox property is available on this phone (available, none) |
condition | Returns "1" if the condition is true, else "0". This is the callback version of the attribute of the same name here. |
create_url | Creates an URL out of the parameter |
current_input | Returns the current minibrowser input |
current_line | Returns the current line of 1-12 (active user id) |
date | Return the current date |
time | Returns the current time |
display_type | Returns the display type of phone: color_touch, color, greyscale, monochrome, character, none |
edit_mode | Toggles edit mode to the next one |
next_edit_mode | Returns the next edit mode of the system |
empty | Returns true or false depending if arg is a an empty string |
enum | Returns an enumeration out of parameter start[:end[:step]] . e.g. $(enum:$(max_registrations)) = |1|2|3|4|5|6|7|8|9|10|11|12| |
fragment | Returns the corresponding value for the given key from the current uri fragment |
lang | Returns the localized gui string for a given language key |
lastsel | Returns the data of the selected list item. (Sometimes it's the id attribute of the last MenuItem) |
sel | Returns the data of the selected list item. (Sometimes it's the id attribute of a MenuItem) |
lines | Returns number of calls |
list_size | Returns the number of listed items |
cb_math_eval | Evaluate the parameter into a math result |
max_registrations | Returns the number of maximum registrations |
max_pkeys | Returns the number of maximum programable keys |
mod_ifc | Return boolean value if module (or module's variable) exists |
module_id_of_current_line | Returns the module-id of the current menu line |
on_off | Returns the localized string of an on/off for boolean value |
phone_state | Returns the current phone state |
remove_cmd | Command to remove leading cmd of fkeys setting (Eg. blf 123) |
set | Returns the value of a setting |
setcache | Returns the corresponding value for the given setting in the settings cache |
show_feature | Return true or false depend if feature is activated or exist |
status_message | Returns the status message |
urlencode | Returns the argument URL-encoded |
user_displayname | Returns the displayname of given identity |
var | Returns the corresponding value for the given variable in the variables cache |
var_ifc | Ask the value of a variable from telephone modules |
wifiscan | Scans for available WIFI SSIDs and returns them as a list |
wlang | Returns the localized web string for a given language key |
x_o | Returns checked or unchecked character for boolean value |
yes_no | Returns the localized string of an yes/no for boolean value |
Differences between placeholders #
Callback can be used with two different placeholder, $(...) and $[...]. the main difference between them is, when the value will be fetched.
Demo
<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneBatch xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../minibrowser_test.xsd">
<SnomIPPhoneMenu id="menu">
<MenuItem name="mi1" id="mi1">
<Url>http://docs.snom.io/xml_minibrowser/examples/xml/cb_different_placeholdes.xml#sub=*[@id="text"]&var:text=$[sel]</Url>
</MenuItem>
<MenuItem name="mi2" id="mi2">
<Url>http://docs.snom.io/xml_minibrowser/examples/xml/cb_different_placeholdes.xml#sub=*[@id="text"]&var:text=$[sel]</Url>
</MenuItem>
<MenuItem name="mi3" id="mi3">
<Url>http://docs.snom.io/xml_minibrowser/examples/xml/cb_different_placeholdes.xml#sub=*[@id="text"]&var:text=$[sel]</Url>
</MenuItem>
</SnomIPPhoneMenu>
<SnomIPPhoneText id="text">
<Text>selected id = $(var:text)</Text>
</SnomIPPhoneText>
</SnomIPPhoneBatch>
In the first page sel callback is not yet replaced. But after one of the MenuItem is selected, the sel callback will be replaced with selected MenuItem id and it will be printed on second page through var callback.