[SR-Dev] extending module interface

Daniel-Constantin Mierla miconda at gmail.com
Thu Nov 20 10:50:38 CET 2008


working to port PV engine to srouter, but also needed for kamailio's 
migration of pseudo-variables (PVs) from core to modules, I need to 
extend the module interface. The srouter has already support to work in 
dual mode committed by Andrei few days ago, so it should affect only 
kamailio's module interface if ser side does not need.

Here is the issue. In kamailio/openser we have so called transformations 
that are bound to PV. They are now implemented directly in core. To move 
them in a module, the interface needs to be extended, like we did in the 
past to export PVs from modules. The important aspect is that they must 
become visible immediately after the module is loaded -- this happens 
also with PVs (so cannot use mod_init, etc...). This is required because 
they may occur during script parsing, therefore the core/parser should 
get knowledge of them in very early stage.

PVs are exported via a specific structure in module interface. We can do 
same for transformations. There is another option, which can be used for 
other purposes in the future - introducing in module interface a 
callback to be run immediately after a module is loaded. The 
transformations can be exported inside the callback.

Extending this way, in the future, the modules can make other attributes 
visible to core/other modules immediately after loading without changing 
the module interface.

Therefore I would go for second option. Other opinions?


Daniel-Constantin Mierla

More information about the sr-dev mailing list