[Devel] Return parameters from module functions

Stefan Prelle s.prelle at broadnet.de
Thu Nov 30 17:32:31 CET 2006


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
C-Function? 

I guess AVPs would help me here - if I only would understand how to use
them. Can anyone provide me an example for that?

Regards,
  Stefan





More information about the Devel mailing list