Skip to content

Version 2.4 and 2.6#

key#

key.setInfo()#

nil key:setTitle/Info/Icon( [setMe:string/default=nil] )
Set or remove custom Strings for this key.

setIcon only works on phones that have a colored screen.

Icon-Values can be:

  • a '@drawable/..'-reference to an icon that's part of the firmware. See debug.getDrawables().
  • a http-url to an icon.
  • a base64 encoded image.

key.setIcon()#

nil key:setTitle/Info/Icon( [setMe:string/default=nil] )
Set or remove custom Strings for this key.

setIcon only works on phones that have a colored screen.

Icon-Values can be:

  • a '@drawable/..'-reference to an icon that's part of the firmware. See debug.getDrawables().
  • a http-url to an icon.
  • a base64 encoded image.

key.setLed()#

nil key:setLed( color:string [blink:boolean/default=false] )
nil key:setLed{ color:string [blink:boolean/default=false] }
Set LED corresponding to the key to the specified color.

Allowed color-values are "red", "green", "yellow" and "off".

key.setTitle()#

nil key:setTitle/Info/Icon( [setMe:string/default=nil] )
Set or remove custom Strings for this key.

setIcon only works on phones that have a colored screen.

Icon-Values can be:

  • a '@drawable/..'-reference to an icon that's part of the firmware. See debug.getDrawables().
  • a http-url to an icon.
  • a base64 encoded image.

sip#

sip.setupSubscriptionType()#

boolean sip.setupSubscriptionType{ name:string accepted:string/array<string> }
allow a specific custom subscription to be sent the name argument specifies what has to be used in the subscribe as type.

dialog and message-summary do not have to be setup, since the phone initiates them automatically.accepted is a list of acceptable mime type for the notifies e.g. 'application/dialog-info+xml'.

sip.invite()#

nil sip.invite( uri:string [, pickup:boolean/default=false] [, line:int] [, hidden:boolean/default=false] )
? sip.invite{ uri:string [pickup:boolean/default=false] [line:int] [hidden=boolean/default:false] [headers=table/default:nil] [returnHttpResult:boolean/default=false] [callLogNr:int]}
Send an invite, aka makes a call to the specified uri. Uri can be just a telephone-number or a complete sip-uri.

Attemps a pickup if pickup-parameter is true.

line is the number of the identity to use. When not set the default identity (see idle-screen) is used.

pass a headers-map if you want to add additional headers to the outgoing sip-invite.

With hidden=true -> call will not be shown on the phones display. It won't have audio either.

callLogNr defines which party to log for this call, i.e. whom to callback when selecting this call in the redial-history.

Provide a number > 0 to name the party counting from the one we called originally, e.g.:

1 -> originally called number 2 -> the first party the call got diverted to. Provide a number < 0 to name the party counting from backwards from the last connected party, e.g.:

-1 -> last/final party the call was connected or diverted to Provide nothing and setting Telephony.CallLogWithReachedTarget (provisioning only, default: false aka initial) is used.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.subscribe()#

SipSubscription sip.subscribe{uri:string  [onNotify:function] [onTerminated:function] [line:int] [type:string/default=dialog]}
Start a sip-subscription of the given type. If none provided -> dialog is used.

uri is the target of the subscription, i.e. where to subscribe to.

It may not have to be a full uri, username of subscription-uri is enough.

type can be custom, but than it needs to be enabled with sip.setupSubscriptionType beforehand'.

line is the number of the identity to use for subscription (1-based index).

It defaults to the currently selected identity (see idle screen of phone).

On incoming Notify-messages the onNotify-callback is called with 3 parameters:

  • same SipSubscription-object as is returned here by sip.subscribe()
  • data:string is the raw content of the notify message
  • headers:table is a table of string headers paired with either a single or a list of header values Any return value of that callback is ignored.

When the subscription gets terminated, onTerminated() is called with 1 parameter:

  • same SipSubscription-object as is returned here by sip.subscribe() Any return value of that callback is ignored.

Return value is a SipSubscription-object which can be used to unsubscribe.

sip.unsubscribe()#

nil sip.unsubscribe( handle:SipSubscription )
nil sip.unsubscribe{ handle:SipSubscription }
Unsubscribe a resource previously subscribed with subscribe().

sip.sendMessage()#

nil sip.sendMessage{ line:int, message:string, target:string [returnHttpResult:boolean/default=false] }
Sends a Sip-Message with the provided message as plain/text-body to the provided destination.

line is the number of the identity to use (1-based index).

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.call-object#

call:getRemote()#

uri:string, name:string call:getRemote()
Get details about the other side of the call.

Returns the sip-uri (string) as the first value and if there is a known name it is returned as the second result (string) else NIL

call:resume()#

nil call:resume( [call2:call-object/callId-string] )
? call:resume{ [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }
Resumes a call.

Accepts a 2nd call as parameter to resume an entire conference at once.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

call:accept()#

nil call:accept()
? call:accept{ [returnHttpResult:boolean/default=false] }
Accepts an incoming call.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

call:terminate()#

nil call:terminate( [call2:call-object/callId-string] )
? call:terminate{ [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }
Terminates a call.

Accepts a 2nd call as parameter to terminate an entire conference at once.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

call:getDisconnectCause()#

code:int, reason:string call:getDisconnectCause()
Get the cause for disconnect of a disconnected call.

Returns the sip-code (int) as the first value and the reason (string) as the second.

call:getId()#

string call:getId()
Get the id of the call.

call:getState()#

string call:getState()
Get the state of the call.

Returns one of the following Strings:

  • calling (outgoing call that was not yet active (i.e. connected))
  • ringing (incoming call that was not yet active (i.e. connected))
  • active (connected call)
  • holding (call was put on hold, i.e. this phone is holding the other party)
  • disconnected (call has ended)
  • unknown (fallback)

call:isIncoming()#

boolean call:isIncoming()
Returns true when call is an incoming one, aka some party called this phone.

call:getIdentityIndex()#

int call:getIdentityIndex()
Get the index of the identity (starts with 1) with which the call is made or 0 on error.

call:hold()#

nil call:hold( [call2:call-object/callId-string] )
? call:hold{ [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }
Holds a call.

Accepts a 2nd call as parameter to hold an entire conference at once.

The call2-parameter may either be a call-obj or just a callId.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

call:transfer()#

? call:transfer( number:string )
? call:transfer{ number:string [returnHttpResult:boolean/default=false] }

Transfers a call to a specified number.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

call:isOutgoing()#

boolean call:isOutgoing()
Returns true when call is an outgoing, aka this phone is calling some party.

call:join()#

nil call:join( [call2:call-object/callId-string] )
? call:join{ [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }
Joins two calls, aka a transfer. This phone will no longer be involved in the calls.

When 2nd call-parameter is missing, phone will do it's best to select the obvious one.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

call:putDetail()#

nil call:putDetail( label:string, value:string )
? call:putDetail{ label:string value:string [returnHttpResult:boolean/default=false] }

Add/Replace a call-detail. These details will make it onto the phones screen whenever the call is displayed in full.

You can delete a detail by passing an empty value.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

call:conference()#

nil call:conference( [call2:call-object/callId-string] )
? call:conference{ [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }
Joins two calls into a local conference, aka where audio is mixed on this phone.

Conferences may be dissolved by only holding or terminating one of the conference members

When 2nd call-parameter is missing, phone will do it's best to select the obvious one.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

call:dtmf()#

? call:dtmf( dtmf:string )
? call:dtmf{ dtmf:string [returnHttpResult:boolean/default=false] }
Sends a dtmf-sequence on an active call.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.identityListener-object#

identityListener:stop()#

nil identityListener:stop()
Stop listening for registration-changes, i.e. don't call the callback anymore.

sip.sipSubscription-object#

sipSubscription:getLine()#

string SipSubscription:getLine()
Returns the line index (1-based) of the identity which issued the subscription.

sipSubscription:getUri()#

string SipSubscription:getUri()
Returns the uri this subscription subscribed to.

sipSubscription:unsubscribe()#

nil SipSubscription:unsubscribe()
Stop this sip-subscription.

sipSubscription:resubscribe()#

nil SipSubscription:resubscribe()
Stop the sip-subscription and re-subscribe right after.

sipSubscription:getType()#

string SipSubscription:getType()
Returns the type of this subscription, e.g. dialog.

sip.calls#

sip.calls.resume()#

nil sip.calls.resume( [call:call-object/callId-string], [call2:call-object/callId-string] )
? sip.calls.resume{ [call:call-object/callId-string] [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }
Resumes a call or a conference.

If you omit the callId's, the first found held call or conference will be resumed.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.terminate()#

nil sip.calls.terminate( [call:call-object/callId-string], [call2:call-object/callId-string]])
? sip.calls.terminate{ [call:call-object/callId-string] [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }
Terminates (hangup) a call or conference.

If you omit the callId's, the active call or conference will be terminated. If none is active, phone searches first for outgoing

ringing calls, next for incoming ringing calls and last for any calls. Only if it finds one single call or conference in any of theses

states, will it actually terminate without having a specific ID

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.accept()#

nil sip.calls.accept( [call:call-object/callId-string] )
? sip.calls.accept{ [call:call-object/callId-string] [returnHttpResult:boolean/default=false] }
Accepts an incoming call.

If you omit the callId, the first ringing call found will be accepted.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.listen()#

handle:data sip.calls.listen( callback:function )
handle:data sip.calls.listen{ callback:function [line:int] [user:string] }
Subscribe for call changes.

Set optional line to >=1 to only receive call-updates that involve the given identity.

Set a user to only receive call-updates where remote party has same username.

Returns handle which can be passed to stop_listen.

The callback is called with multiple parameters, first one names the change:

  • 'add', call-obj - there is a new call
  • 'remove', call-obj - call was deleted
  • 'remote_update', call-obj - either number or name of call have changed, see call:getRemote()
  • 'state_changed', call-obj - state of call changed (e.g.: put on hold), see call:getState()
  • 'transferred', call-obj - call got transferred -> new party on the other end
  • 'conferenced', call-obj, call-obj - both calls are now in a conference
  • 'unconferenced', call-obj, call-obj - both calls are no longern in a conference
  • 'transfer_initiated', call-obj, call-obj - starting attended transfer, both remote parties of both calls are being connected.
  • 'transfer_failed', call-obj, call-obj - attended transfer failed
  • 'transfer_done', call-obj, call-obj - attended transfer was successful
  • 'transfer_done', call-obj, target:string - blind transfer was successful Call objects can be used to query or modify the call.

The return value of the callback is ignored.

sip.calls.get_all()#

array<calls> sip.calls.get_all()
Returns an indexed table (array) of calls

sip.calls.hold()#

nil sip.calls.hold( [call:call-object/callId-string], [call2:call-object/callId-string] )
? sip.calls.hold{ [call:call-object/callId-string] [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }
Holds a call or a conference.

If you omit the callId's, the active call or conference will be held.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.transfer()#

nil sip.calls.transfer( [call:call-object/callId-string], number:string )
? sip.calls.transfer{ number:string [call:call-object/callId-string] [returnHttpResult:boolean/default=false] }
Transfers a call to a specified number.

You may set the callId to nil in which case the the phone will make a guess which call is ment.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.join()#

nil sip.calls.join( [call:call-object/callId-string], [call2:call-object/callId-string] )
? sip.calls.join{ [call:call-object/callId-string] [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }
Joins two calls, aka a transfer. This phone will no longer be involved in the calls.

If you omit one or both call's, the phone will make a guess which calls are ment.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.putDetail()#

nil sip.calls.putDetail( [call:call-object/callId-string], label:string, value:string )
? sip.calls.putDetail{ label:string value:string [call:call-object/callId-string] [returnHttpResult:boolean/default=false] }

Add/Replace a call-detail. These details will make it onto the phones screen whenever the call is displayed in full.

You can delete a detail by passing an empty value.

You may set the callId to nil in which case the the phone will make a guess which call is ment.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.conference()#

nil sip.calls.conference( [call:call-object/callId-string], [call2:call-object/callId-string] )
? sip.calls.conference{ [call:call-object/callId-string] [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }
Joins two calls into a lokal conference, aka where audio is mixed on this phone.

Conferences may be dissolved by only holding or terminating one of the conference members

If you omit one or both callId's, the phone will make a guess which calls are ment.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.make()#

nil sip.calls.make( uri:string [, pickup:boolean/default=false] [, line:int] [, hidden:boolean/default=false] )
? sip.calls.make{ uri:string [pickup:boolean/default=false] [line:int] [hidden:boolean/default=false] [returnHttpResult:boolean/default=false] }
Makes a call to the specified uri. Uri can be just a telephone-number or a complete sip-uri.

Attemps a pickup if pickup-parameter is true.

Line is the number of the identity to use. When not set the default identity (see idle-screen) is used.

With hidden=true -> call will not be shown on the phones display. It won't have audio either.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.dtmf()#

nil sip.calls.dtmf( [call:call-object/callId-string], dtmf:string )
? sip.calls.dtmf{ dtmf:string [call:call-object/callId-string] [returnHttpResult:boolean/default=false] }
Sends a dtmf-sequence on an active call.

You may set the callId to nil in which case the active call is used, if there is one.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.stop_listen()#

nil sip.calls.stop_listen( handle:data )
nil sip.calls.stop_listen{ handle:data }
Stop listening for calls previously started with listen().

sip.identities#

sip.identities.is_active()#

boolean sip.identities.is_active( line:int )
boolean sip.identities.is_active{ line:int }
Returns whether an identity is registered or not.

line is the number of the identity to check (1-based index).

sip.identities.stop_listen()#

nil sip.identities.stop_listen( handle:identityListener )
nil sip.identities.stop_listen{ handle:identityListener }
Stop listening for account state changes previously started with sip.identities.listen().

sip.identities.listen()#

identityListener sip.identities.listen( callback:function, [line:int] )
identityListener sip.identities.listen{ callback:function [line:int] }
Subscribe for account state changes.

Returns handle which can be passed to stop_listen.

line is the number of the identity which is to be monitored (1-based index).If none is provided, all registry-changes of all identities are reported to the callback.

The callback is called with two parameters:

1: a string that's either unregistered or registered.

2: an int, i.e. the line that changed.

The return an identityListener-object which can be used to stop this monitor.

sip.identities.getDomain()#

string sip.identities.getDomain( line:int )
string sip.identities.getDomain{ line:int }
Returns the host of an identity, i.e. either it's registrar or when configured: its domain.

The host is needed to construct valid sip-uri's e.g. for subscriptions or when making calls.

line is the number of the identity to check (1-based index).

debug#

debug.getDocu()#

string debug.getDocu( thing:lua-object )
string debug.getDocu{ thing:lua-object }
Returns the documentation for the provided function, table or other lua-object.

May return nil when no documentation exists.

debug.log()#

nil debug.log( message:string [, debug_level:string/default=i] )
? debug.log{ message:string [debug_level:string/default=i] [returnHttpResult:boolean/default=false] }
Log the provided message into androids LogCat-system.

debug_level = e/w/i/d/v -> i.e. a one-char String (only first char is looked at) that marks the severity of the log: error, warning, info, debug or verbose.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

Warning

on D100/200 there is a setting that limits logs to only show errors and warnings by default. To enable logs up to debug, you need to set Access → Extended Logging.

Info

verbose logs usually do not show up, unless you use androids adb-tool to connect to your phone and increase the log sensitivity with adb shell setprop log.tag.LuaScript VERBOSE.

debug.getLoadableLibs()#

table<string> debug.getLoadableLibs()
Returns a list of all Libraries that can be called into any LuaScript using require("[libname]").

These include baked-in modules like the penlight library as well as the LuaLibraries which are part of the settings.

debug.getDrawables()#

table<string> debug.getDrawables()
Returns a list of all drawables that can be used e.g. for key.setIcon().

system#

system.toast()#

nil system.toast( text:string )
? system.toast{ text:string [returnHttpResult:boolean/default=false] }
Shows the provided text as a toast.

On colored devices you may alternatively provide a '@drawable/..' (See debug.getDrawables).

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

system.intent()#

nil system.intent( action:string )
? system.intent{ action:string [component:string] [data:string(uri-format)] [extras:table] [returnHttpResult:boolean/default=false]}
send an intent to the android system.

for an complete decription of the parameters see: https://developer.android.com/guide/components/intents-filtersIf you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

system.notifications#

system.notifications.getAll()#

array<notifications> notifications.getAll()
Returns an indexed table (array) of all active notifications.

system.notifications.monitor()#

monitor:obj notifications.monitor{onCreated:callback onDeleted:callback [pkg:string] [id:int] [tag:string]}
Calls onCreated or onDeleted callback with notification-obj as parameter whenever a notification matching the search-criteria appears or disappears.

system.notifications.get()#

notification:obj notifications.get{[pkg:string] [id:int] [tag:string] [key:string]}
Searches all active notifications for the one specified and returns the first one that matches the criteria or nil when none matches.

When key is provided, id, tag and pkg are ignored.

When nothing is provided, the first found active notification is returned.

system.notifications.add()#

nil notifications.add{tag:string id:int title:string message:string [icon:string]  [led:on|blink|off(default)] [persistent:boolean/default=false] [volatile:boolean/default=false] [alert:boolean/default=false] [alertOkText:string] [alertCancelText:string] [alertsound:boolean/default=true][autoClickDelay:number/default=0] [onClicked:callback] [onDeleted:callback]}
Create a notification.

onClicked and onDeleted are callbacks with two parameters cb(tag:string id:int) that get called when user deletes a notification or clicks on it.

A persistent notification cannot be deleted by the user.

A volatile notification disappears when clicked (cannot be combined with persistent).

A alerting notification will auto-open on screen and play a notification sound. The sound can also be disabled with 'alertsound=false'.

You can add ok and cancel-buttons by providing alertOkText and/or alertCancelText. Provide a empty string (not NIL) to use the standard ok/cancel-translations.

When user clicks ok then the onClicked-callback will be called. In the same manner a cancel-click will delete the message and call the onDeleted-callback.

A cancel-option will not be shown for persistent notifications.

A non persistent notification can be automatically clicked after a certain delay. For example 'autoClickDelay=10' triggers an OnClickEvent after 10 seconds. If the message text contains a %AutoClickCountdown% placeholder, then the placeholder is replaced with the current countdown value.Icon-Values can be:

  • a '@drawable/..'-reference to an icon that's part of the firmware. See debug.getDrawables().
  • a http-url to an icon.
  • a base64 encoded image. The led parameter defines the desired behaviour of the LED of the message-key. If you set it to 'on' it will cause the Message-LED to turn on, unless there is another message that overrides this with blinking.

Use tag and id parameter to make your notification unique to the system and to identify it in onClicked- and onDeleted-callbacks.

system.notifications.monitor-object#

monitor:remove()#

nil monitor:remove()
Remove the monitor, i.e. dont call it's callbacks anymore.

system.notifications.notification-object#

notification:delete()#

nil notification:delete()
Delete the notification, i.e. it wont be seen anymore unless it's a persistent notification that cannot be deleted.

If a notification has some intent tied to it's deletion, it will be called.

notification:remove()#

nil notification:remove()
Remove a notification that was previously created in lua. This is the only way to remove a persistent notification.

notification:getTitleAndMsg()#

string, string notification:getTitleAndMsg()
Returns title and message of the notification.

notification:getPkg()#

string notification:getPkg()
Get the package of the notification.

notification:isPersistent()#

bool notification:isPersistent()
Returns true if the notification is persistent (cannot be deleted by user).

notification:getKey()#

string notification:getKey()
Get the key of the notification.

notification:getId()#

int notification:getId()
Get the id of the notification.

notification:getTag()#

string notification:getTag()
Get the tag of the notification.

system.notifications.constants#

luaPkg: "de.auerswald.functions"
vpnIdTrying: 1623130911
vpnPkg: "de.blinkt.openvpn"
vpnIdSuccess: 1346787898

system.network#

system.network.monitor()#

monitor:obj network.monitor{onAvailable:callback onLost:callback transports:string/array<string> [capabilities:array<int>]}
Calls onAvailable or onLost callback whenever the requested network gets established or is lost.

The transports-parameter defines the network-types you are interested in. It is expected as an indexed table with the values being one of these strings: wifi, eth, bluetooth and vpn

The capabilities-parameter is an int defined by android, you can find a list of supported capabilities in network.capabilities.

Returned monitor-obj can be used to end this monitor via its :remove()-function.

Returns nil on error.

system.network.monitor-object#

monitor:remove()#

nil monitor:remove()
Remove the monitor, i.e. dont call it's callbacks anymore.

system.network.capabilities#

VALIDATED: 16
WIFI_P2P: 6
UNTRUSTED: 14
VPN: 15
INTERNET: 12
CAPTIVE_PORTAL: 17
FOREGROUND: 18
RESTRICTED: 13

http#

http.post()#

nil http.post(url:string [, callback:function [, content:string [, headers:table]]])
nil http.post{url:string [callback:function] [content:string] [headers:table] [follow_redirects:boolean/default=true] [verifyHostname:boolean/default=true] [acceptUnsignedCerts:boolean/default=false]}
Send an http post request to the provided url.

See http.request() for details.

http.delete()#

nil http.delete(url:string [, callback:function [, content:string [, headers:table]]])
nil http.delete{url:string [callback:function] [content:string] [headers:table] [follow_redirects:boolean/default=true] [verifyHostname:boolean/default=true] [acceptUnsignedCerts:boolean/default=false]}
Send an http delete request to the provided url.

See http.request() for details.

http.put()#

nil http.put(url:string [, callback:function [, content:string [, headers:table]]])
nil http.put{url:string [callback:function] [content:string] [headers:table] [follow_redirects:boolean/default=true] [verifyHostname:boolean/default=true] [acceptUnsignedCerts:boolean/default=false]}
Send an http put request to the provided url.

See http.request() for details.

http.request()#

nil http.request(url:string [, callback:function [, method:string/default=GET [, content:string]], headers:table])
nil http.request{url:string [callback:function] [method:string/default=GET] [content:string] [headers:table] [follow_redirects:boolean/default=true] [verifyHostname:boolean/default=true] [acceptUnsignedCerts:boolean/default=false]}
Send an http request to the provided url.

The url-parameter must start with http:// or https://.

You can pass credentials for authorization challenges via: http://username:password@...

The callback receives 3 parameters: callback(responseCode:int [, content:string, headers:table]).

  • when the request was unsuccessful, the callback gets called with just the http error code. The method-parameter should be either GET, POST, DELETE or PUT.

The content-parameter is appended as the body of the http-request.

With follow_redirects=false you can get to the headers an body of a 3xx-response.

You can optionally supply request headers as a table mapping string keys to string values.

http.get()#

nil http.get(url:string [, callback:function [, headers:table]])
nil http.get{url:string [callback:function] [content:string] [headers:table] [follow_redirects:boolean/default=true] [verifyHostname:boolean/default=true] [acceptUnsignedCerts:boolean/default=false]}
Send an http get request to the provided url.

See http.request() for details.

http.listen()#

handle:data http.listen(path:string, callback:function [, exclusive:boolean/default=false])
Listen for HTTP requests under https://<your-phone-IP>/api/v1/exec/<path>.

The request has to be authenticated (via Login or token).

Returns handle which can be passed to stop_listen.

If the parameter <exclusive> is true and there already exists a handler for the supplied <path>,

the function returns nil and the handler is not installed.

The request goes to the supplied callback function, which is called with these parameters:

  • the requested path as a string, aka same as the original path-parameter
  • the request body as a string
  • the request headers as a table with string keys and values
  • another table, with additional infos like 'request_method', 'query_string' and 'query_map'

If <exclusive> is true, then the callback can return the HTTP response code, the response body and a map of additional headers to include in the response.

If the code is nil, 200 is sent. If the body is nil, an empty body is sent.

If <exclusive> is false, any return value from the callback is ignored.

http.stop_listen()#

nil http.stop_listen(handle:data)
Stop listening for HTTP requests. Parameter handle must be the return value from previous call to http.listen().

dialog#

dialog.show()#

nil dialog.show( text:string )
Shows the provided text in fullscreen.

Warning

function is deprecated and may get removed in future, use system.toast() instead.

xml#

xml.eval()#

XmlObj xml.eval(xml:str)
Convert the provided xml-string into a xml object.

xml.append()#

XmlObj xml.append(XmlObj, tableOrTag:table)
XmlObj xml.append(XmlObj, tableOrTag:string)
Create new XmlObj like xml.new() and append it to the child elements of the provided XmlObj.

The children are stored at index 1 and up in the XmlObj.Returns the new child.

xml.appendtext()#

XmlObj xml.appendtext(XmlObj, text:string)
Append a plain-text element to the child elements ot the provided XmlObj.

The children are stored at index 1 and up in the XmlObj.Returns the provided XmlObj.

xml.tostring()#

string xml.tostring(XmlObj)
Return string representation of the provided XmlObj.

xml.find()#

XmlObj xml.find(XmlObj [, tag[, key[, value]]])
Find a XmlObj within the provided XmlObj. The provided XmlObj is checked as well as it's children and any of their children recursivly. The first match is returned or nil if no match was found.

Tag can be nil or "" to find an element with any tag.

If key is not nil or "", the element must have an attribute with this key.

If value is not nil, the attribute must have this value.

xml.new()#

XmlObj xml.new(tableOrTag:table)
XmlObj xml.new(tableOrTag:string)
Create a new xml object.

If tableOrTag is a table, use and convert it to a xml object (i.e. keep the data as is and add a metatable for object-like access).

If tableOrTag is a string, use as the tag of the XmlObj.

XmlObj's have their tag stored at index [0].

At index [1] and above all children are stored. These are either XmlObj's themselfes or a string representing plain-text content.

xml.tag()#

string xml.tag(XmlObj)
nil xml.tag(XmlObj, tag:string)
Returns or sets the tag of the XmlObj.If tag nil, returns the tag of the provided XmlObj.

If tag is a string, changes the tag of the XmlObj.

json#

json.object()#

JsonObj json.object([base:table])
Create a new json object.

If base is set, copy all its string-key-value pairs to JsonObj[key.tostring()] = value.tostring().

Values of type table get skipped.

json.eval()#

JsonObj json.eval(json:string)
Parse a string and return a json object.

json.insert()#

nil json.insert(array:JsonAry [, index:int], value:data)
With an index inserts the provided value at the marked position into the JsonAry.

Without an index adds the provided value at the end of the JsonAry.

The value should be either a JsonObj, a JsonAry or a string.

json.array()#

JsonAry json.array([base:array])
Create a new json array.

If base is set, copy all its indexed values to JsonAry[idx] = value.tostring().

Values of type table get skipped.

json.tostring()#

string json.tostring(stringMe:JsonObj)
string json.tostring(stringMe:JsonAry)
Return string representation of the provided json object or array.

bluetooth#

bluetooth.registerStateListener()#

nil bluetooth.registerStateListener(callback)
register to get called when the bluetooth state changes.

values: State

-2 - Error -1 - Not Available 0 - Off

1 - Turning On

2 - On

3 - Turning Off

4 - BLE Turning On

5 - BLE On

6 - BLE Turning Off

bluetooth.registerRangeCheck()#

nil bluetooth.registerRangeCheck(addr:string, callback:function)
nil bluetooth.registerRangeCheck{addr:string, callback:function}
Register for updates on the signal-strength (rssi) of a bluetooth device.

You'll need a paired bluetooth 4 device to receive rssi-updates.

Provide the bluetooth-mac-address as addr-parameter.

The callback receives two parameters: callback(status:string, rssi:int).

  • the callback gets called in a fixed interval once the device connects for the first time.
  • status will either be "OK" or "NOT FOUND".
  • rssi is an int or NIL if not in range.

bluetooth.enable()#

nil bluetooth.enable(onOff:boolean)
enables or disables the bluetooth adapter.

bluetooth.unregisterRangeCheck()#

nil bluetooth.unregisterRangeCheck(addr:string, callback:function)
nil bluetooth.unregisterRangeCheck{addr:string, callback:function}
Unregister from updates on the signal-strength (rssi) of a bluetooth device.

bluetooth.unregisterStateListener()#

nil bluetooth.unregisterStateListener(callback)
unregister the callback function

bluetooth.getDevices()#

{} bluetooth.getDevices()
Returns a dictionary of all known bluetooth devices. Keys are the addresses and the value holds the name.Returns NIL on error, e.g. missing bluetooth dongle.

time#

time.sleep()#

nil time.sleep(sleepInSeconds:number)
sleeps up to 5 minutes

Warning

function is deprecated and may get removed in future, use time.callbackIn() instead.

time.unregister()#

nil time.unregister(callback)
unregister to get a callback every passing minute

time.register()#

nil time.register(callback)
register to get a callback every passing minute

time.callbackIn()#

nil time.callbackIn(callback, delayInSeconds)
register LuaFunction callback, to be called in delayInSeconds

time.callbackIn(callMe, 0.1) will call callMe in 100 milliseconds.

smallest resolution is 1 ms

async#

async.async()#

async.async()
Create a new async object. The object has two functions:

complete(...) -> set the return values of await() ... await([timeout]) -> wait for and return the values given to complete() timeout is specified in seconds the function will never wait longer than 5 minutes even if no timeout is given

example:

local function http_get_sync(url) local async = async.async() http.get(url, function(code, response, headers) async.complete(response) end) local res, response = async.await() return response end

Returns async object

phoneInfo#

phoneInfo.getBrand()#

string phoneInfo.getBrand()
Returns either Auerswald or Fontevo

phoneInfo.getMacAddress()#

string phoneInfo.getMacAddress()
Returns the mac address of the phone.

phoneInfo.getIPs()#

array<string> phoneInfo.getIPs()
Returns an indexed table (array) of all IPs the phone has.IPv4's get listed up front, followed by all IPv6's

phoneInfo.getModel()#

string phoneInfo.getModel()
Returns the model of the phone, e.g.: D400

phoneInfo.getFwVersion()#

string phoneInfo.getFwVersion()
Returns the firmware version, e.g.: 1.6A

config#

config.unregister()#

nil config.unregister( path:string, callback:function )
nil config.unregister{ path:string callback:function }
Unregister callback function for the specified path.

path is the xPath to a setting or group of settings.

config.set()#

nil config.set( path:string, value:string )
nil config.set{ path:string value:string}
Set a setting-value.

path is the xPath to the desired setting.

value holds the new desired value.

config.get()#

string config.get( path:string )
string config.get{ path:string }
Get a setting-value.

path is the xPath to the desired setting.

config.register()#

nil config.register( path:string, callback:function )
nil config.register{ path:string callback:function }
Register to be informed of changing setting(s).

path is the xPath to a setting or group of settings.

callback will be called with one parameter:

  • path:string -> the xPath of the changed setting(s) return-value of callback is ignored.

database#

database.subscribe()#

dbMonitor:obj database.subscribe{dbUri:string onChanged:callback [query:string] [orderBy:string] [columns:array<string>]}
Start a continuous db-query. The provided callback will be called initially with the results

of your query and whenever something changes. You can turn this into a one-time-query by simply

stopping the subscription the first time your callback is called.

Please restrict your query as much as possible (using specific query and naming only the columns

of interest) to keep the load low and the performance up of your phone.

dbUri names the database you are interested in. It is expected to be a content uri,

e.g.: content://call_log/calls

orderBy defines how to order the rows, it is formatted as an SQL ORDER BY clause (excluding the ORDER BY itself). Passing null will use the default sort order, which may be unordered.

The onChanged-callback will be called with one parameter, the result of the query. It is an array

where each entry is a map of column-name to value.

The query parameter restricts your search to certain entries that fulfill the query. It is formatted

as an SQL WHERE clause (excluding the WHERE itself) and passed as is to android. It might simply

ask for entries where a column-value has a certain value, e.g.: 'new=1'

Use the columns-array to restrict your answers to the values you are interested in.

database.dbMonitor-object#

dbMonitor:remove()#

nil dbMonitor:remove()
Remove the database monitor, i.e. stop the query and don't call the callback anymore.

sipTools#

sipTools.mkReplaces()#

string, string sipTools.mkReplaces{callId:string [from:string] [to:string]}
Returns a pair of Replaces-header-name and its value. Returns nil when callid is missing.

sipTools.parseUri()#

sipUri:obj sipTools.parseUri{sipUri:string [fromUserInput:boolean/default=false] [idIdx:int]}
Create a sipUri-object for individual access e.g. to the username. Simple telphone numbers from

user-input, i.e. those that aren't a uri yet may get expanded, e.g. the host/registrar is added if

the idIdx is provided.

Please set fromUserInput to true when sipUri-strings stems from a setting-value or some other place

where a user had written it. The parser employs different strategies to turn the input into a valid

sipUri. E.g. a simple sequence of digits may be 'enhanced' with '@registrar' when it stems from human

input but if it came from the network it would be wrong to fantasize a host to the tail of the input.

idIdx indicates which identity the uri belongs to, e.g. 1 for the first identity.

calllog#

calllog.monitorMissed()#

missedMonitor:obj calllog.monitorMissed{onNewMissed:callback [line:int] [user:string]}
...?

calllog.missedMonitor-object#

missedMonitor:remove()#

nil missedMonitor:remove()
Remove the calllog monitor, i.e. stop the query and don't call the callback anymore.