[Devel] Return parameters from module functions

Bogdan-Andrei Iancu bogdan at voice-system.ro
Thu Nov 30 17:41:06 CET 2006

Hi Stefan,

retcode variable contain the result code of the last script 
function/instruction (so, not necessary of the last module function).

you should try to store the retcode immediately after your call to avoid 
to be overwrite:

	if (avp_check("$avp(i:10)", "eq/i:10")) {
		{ ... do something ... }
        else if (avp_check)
		 { ... do something else ... }

Most probably the 1 value you got is from the IF evalution :). You may 
also try a simpler approach, by using the switch command:


Stefan Prelle wrote:

>Hi all,
>I am currently playing around with writing a module for OpenSER.
>I stumbled over a problem when trying to return an integer other than
>-1,0 or 1 from a module function.
>My current approach was for example to return with a "return 10;" from
>the C-Code and test the return value with the "retcode" command from
>within the openser.cfg
>        if (myFunction()) {
>                if (retcode==10) { ... do something ... }
>                else if (retcode==20) { ... do something else ... }
>        }
>This doesn't work. It looks like that no matter what I return, a
>positive integer gets converted to 1.
>Judging from what I found via Google, this is intentional.
>So, what is the best way to realize a evaluation of the result of the
>I guess AVPs would help me here - if I only would understand how to use
>them. Can anyone provide me an example for that?
>  Stefan
>Devel mailing list
>Devel at openser.org

More information about the Devel mailing list