[OpenSER-Devel] Skeleton Module

Daniel-Constantin Mierla daniel at voice-system.ro
Tue Dec 4 08:20:05 UTC 2007


Is it working now? If not, please send full output. Also, if you can 
send the config, would be better.

Debug level does not affect whether a module can be loaded or not.

Cheers,
Daniel

On 12/04/07 00:43, Daniel Corbe wrote:
> Much better, thanks.
>
> I guess I had the debug level set too low.
>
> I still don't know what this means, though.
>
>  0(24332) loading module /usr/local/lib/openser/modules/page.so
>  0(24332) DEBUG:load_module:Reloading module 
> /usr/local/lib/openser/modules/page.so with flags 674921376
>
> -Daniel
>
> On Dec 3, 2007 4:47 PM, Daniel-Constantin Mierla 
> <daniel at voice-system.ro <mailto:daniel at voice-system.ro>> wrote:
>
>     Hello,
>
>     set debug=7, log_stderror=yes in config file and send the output here.
>     Shall give some hints about the problems.
>
>     Cheers,
>     Daniel
>
>
>     On 12/03/07 23:28, Daniel Corbe wrote:
>     > I'm having issues with a "skeletal" module, and the openser core
>     > refuses to start when I have it "load"ed in my config file.  Not
>     sure
>     > why, and I could use a bit of direction from the rest of the list.
>     >
>     > It compiles
>     >
>     > -Daniel
>     >
>     > -- Cut Here --
>     >
>     > #include "../../sr_module.h"
>     >
>     >
>     > static int mod_init(void);
>     >
>     > static void mod_destroy(void);
>     >
>     > static int child_init(int);
>     >
>     > static int pagemod_test(struct sip_msg *msg);
>     >
>     >
>     > /* SER exports */
>     >
>     > static cmd_export_t cmds[]=
>     >
>     > {
>     >
>     > {"test", pagemod_test, 0, 0, REQUEST_ROUTE | FAILURE_ROUTE |
>     > ONREPLY_ROUTE | BRANCH_ROUTE },
>     >
>     > {0, 0, 0, 0, 0}
>     >
>     > };
>     >
>     >
>     >
>     > /*
>     >
>     >  * Script parameters
>     >
>     >  */
>     >
>     > static param_export_t mod_params[]=
>     >
>     > {
>     >
>     > {0, 0, 0}
>     >
>     > };
>     >
>     >
>     >
>     > /*
>     >
>     >  * Export the statistics we have
>     >
>     >  */
>     >
>     > static stat_export_t mod_stats[] =
>     >
>     > {
>     >
>     > {0, 0, 0}
>     >
>     > };
>     >
>     >
>     > struct module_exports exports =
>     >
>     > {
>     >
>     > "page" , /* module's name */
>     >
>     > cmds,
>     > /* exported functions */
>     >
>     > mod_params,
>     > /* param exports */
>     >
>     > mod_stats,
>     > /* exported statistics */
>     >
>     > mod_init,
>     > /* module initialization function */
>     >
>     > 0 , /* reply processing function FIXME Not sure when this is used */
>     >
>     > mod_destroy,
>     > /* Destroy function */
>     >
>     > child_init
>     > /* per-child init function */
>     >
>     > };
>     >
>     >
>     > MODULE_VERSION
>     >
>     > /*
>     >
>     >  * Script commands we export.
>     >
>     >  */
>     >
>     >
>     >
>     >
>     >
>     > /**
>     >
>     >  * @return 0 to continue to load the OpenSER, -1 to stop the loading
>     >
>     >  * and abort OpenSER.
>     >
>     >  */
>     >
>     > static int mod_init(void)
>     >
>     > {
>     >
>     > int result = 0;
>     >
>     >
>     > return(result);
>     >
>     > }
>     >
>     >
>     >
>     > /**
>     >
>     >  * Called only once when OpenSER is shuting down to clean up module
>     >
>     >  * resources.
>     >
>     >  */
>     >
>     > static void mod_destroy()
>     >
>     > {
>     >
>     > LOG(L_NOTICE, "Starting Up\n");
>     >
>     > return;
>     >
>     > }
>     >
>     >
>     >
>     > /**
>     >
>     >  * The rank will be o for the main process calling this function,
>     >
>     >  * or 1 through n for each listener process. The rank can have a
>     negative
>     >
>     >  * value if it is a special process calling the child init
>     function.
>     >
>     >  * Other then the listeners, the rank will equal one of these
>     values:
>     >
>     >  * PROC_MAIN      0  Main ser process
>     >
>     >  * PROC_TIMER    -1  Timer attendant process
>     >
>     >  * PROC_FIFO     -2  FIFO attendant process
>     >
>     >  * PROC_TCP_MAIN -4  TCP main process
>     >
>     >  * PROC_UNIXSOCK -5  Unix domain socket server processes
>     >
>     >  *
>     >
>     >  * If this function returns a nonzero value the loading of
>     OpenSER will
>     >
>     >  * stop.
>     >
>     >  */
>     >
>     > static int child_init(int rank)
>     >
>     > {
>     >
>     > int result = 0;
>     >
>     >
>     > LOG(L_NOTICE, "Starting Child\n" );
>     >
>     >
>     >
>     > return(result);
>     >
>     > }
>     >
>     >
>     > static int pagemod_test(struct sip_msg *msg)
>     >
>     > {
>     >
>     > LOG(L_NOTICE, "Testing 1 2 3\n");
>     >
>     > }
>     >
>     >
>     >
>     >
>     ------------------------------------------------------------------------
>     >
>     > _______________________________________________
>     > Devel mailing list
>     > Devel at lists.openser.org <mailto:Devel at lists.openser.org>
>     > http://lists.openser.org/cgi-bin/mailman/listinfo/devel
>     >
>
>



More information about the Devel mailing list