[SR-Users] using a pseudo-variable as a parameter to a module function

Michael Iedema michael at kapsulate.com
Fri Dec 13 19:10:02 CET 2019


Hi all,

I’m trying to write a basic Kamailio module from scratch and have run into an area where I’m in need of a couple pointers (pun not intended). :-) I have the module loading correctly and can call a function in my routing script like this:

mymod_getinfo(“5551234”);

This, for now, just triggers a print of the submitted parameter.

What I’d like to do next is have it accept and print the From URI in configuration script like so:

mymod_getinfo(“$fU”);

For now, this prints the string literal of “$fU” and I’m trying to extract the value of the referenced variable and print that. The example module “print” does not involve this concept of pseudo-variables. The skeleton module example in the wiki also does not mention variables.

I’ve looked into other modules to see how it works but they all seem to have a slightly different handling of this task. Can someone point me to an example in the modules which accomplishes this?

What I’ve been searching for is a replace_all function which accepts a string containing pseudo-variables and returns a new string with them all replaced with their corresponding values.

Thanks in advance and apologies if I’ve overlooked a relevant piece of developer documentation or if I’m looking at this incorrectly.

Regards,
-Michael




More information about the sr-users mailing list