State of primitives and lua bindings

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at

Holger Freyther holger at
Wed Nov 29 16:04:27 UTC 2017


I think I have the minimal patchset to add primitives and lua
bindings to have useful functionality and know what is good/bad
with it and extend/iterate it from here. I would like to share
the state and what's next. On the higher level we have:

* Primitive for timers
* Primitives OP_IND for started/shutdown handling
* Primitives OP_IND for SMS status and RX SMS
* Primitives OP_IND for Mobility Management state changes

Next steps:

* Pack MNCC and enable/handle voice calls as well to do
call control.

What needs to change in future iterations:

* SMS, MM, started/shutdown indications should be async.
Especially for MM handling that will do further state changes
from within the new_mm_state. So if we enable/disable the MS
within this callback we ask for trouble.

* The lua scripting code is calling some routines directly. E.g.
for a "simple" SMS sending routine, to query state. This should
probably be converted to primitives as well. But that can be done
while keeping the lua API (e.g. with continuations or cache the
MS status).

* Finish the OsmocomBB manual documentation for the API

* Bikeshed. Number vs. Bool... ;)

Bugs found by scripting:

* I found an ASAN issue in mobile (fix pending)
* Noticed paging with outdated TMSI on NITB
* Trying to encode an alphabetic phone number causes issue in
libosmocore (bug report pending)




# Print through logging framework
print("Hello from Lua");
log_notice("Notice from lua");
log_debug("Debug from Lua");
log_error("Error from Lua");
log_fatal("Fatal from Lua");

# Start a timer... and cancel it. Notice the ':'
local timer = osmo.timeout(1000, function()
	print("After timeout!!!")

# Access a singleton table/object
print("MS", type(;"1234", "21321324", "fooooooo", 23)

# Callbacks...
function ms_started_cb(started)

function ms_shutdown_cb(old_state, new_state)

function sms_cb(sms, cause, valid)
	for i, v in pairs(sms) do
		print(i, v)

function mm_cb(new_state, new_substate, old_substate)
	if new_state == 19 and new_substate == 1 then"1234", "21321324", "fooooooo", 23)

local cbs = {

More information about the baseband-devel mailing list