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

Henning Westerholt hw at skalatan.de
Sat Dec 14 13:44:28 CET 2019


(adding sr-dev list to CC)

Hi Michael,

small general addition - you are probably already aware of this 
documentation:

https://www.asipto.com/pub/kamailio-devel-guide/

There is work going on right now to update it, it needs also some 
extensions, e.g. for the PV core functions.

Cheers,

Henning

Am 13.12.19 um 19:10 schrieb Michael Iedema:
> 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
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Kamailio Merchandising - https://skalatan.de/merchandising/
Kamailio services - https://skalatan.de/services
Henning Westerholt - https://skalatan.de/blog/



More information about the sr-dev mailing list