[OpenSIPS-Users] Question: how to return string from module function to config script?

Ovidiu Sas osas at voipembedded.com
Sun Nov 1 00:45:26 EST 2020


Hello Elaine,

 A module function in opensips returns and integer.
Based on the return value, you can test if the function was successful or
not.
More details here:
https://www.opensips.org/Documentation/Development-Manual#toc37
Take a look at the big yellow warning at the end of documentation for the
module function for how return codes are interpreted.

If you want to return a string, here’s an example:
https://opensips.org/html/docs/modules/devel/dialplan.html#func_dp_translate
See the out_var parameter.

Hope this helps,
Ovidiu

On Sat, Oct 31, 2020 at 18:57 Elaine Huang <u8k.mel at gmail.com> wrote:

> I'm new to opensips and I'm wondering if it's possible for a module
> function to return a string instead of integer?
>
> My wishful thinking is in my config:
>
> $var(myVar) = myFunc(params...);
> # then myVar becomes a string value that I can manipulate, compare, etc
>
>
> If this is not achievable, what's the conventional way to get a string
> from a module function? Is it pseudo variable that I should use?
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-- 
VoIP Embedded, Inc.
http://www.voipembedded.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20201031/2f2a7ab6/attachment-0001.html>


More information about the Users mailing list