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

Elaine Huang u8k.mel at gmail.com
Wed Nov 4 23:38:02 EST 2020


Hello Ovidiu,

Thanks for your reply. Reading the linked doc it seemed to me exported
functions can only return integers.

I don't quite get the dialplan dp_translate function, how do I decide what
dialplan id to use, and what's a translation rule?

Should I create my own pseudo variable and store the string there for
scripting access? Sorry for all the questions.


Cheers,
Wenshan

On Sun., 1 Nov. 2020, 11:47 Ovidiu Sas, <osas at voipembedded.com> wrote:

> 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
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20201105/8e2239c9/attachment.html>


More information about the Users mailing list