[Kamailio-Users] custom module depends on usrloc, the load order

toly hippo_big at hotmail.com
Thu Sep 11 02:02:42 CEST 2008


Greetings,

I have 2 questions.

1. I've created custom module where I'd like to get number of users from
usrloc module. Here is the code:

 LOG(L_INFO,"PRESOURCE: Initializing\n");
    bind_usrloc = (bind_usrloc_t)find_export("ul_bind_usrloc", 1, 0);
    if ( !bind_usrloc ) {
         LOG(L_CRIT, "Can't bind usrloc (find_export) check if loaded");
         goto error;
    }
    if ( !bind_usrloc(&ul) ) {
         LOG(L_CRIT, "Can't bind usrloc");
         goto error;
    }

When this code is enabled if fails on second if. Looks like usrloc module is
not loaded. Here's the log

09/10 18:50:57 4431 info  <statistics.c: 135> INFO: statistics manager
successfully initialized
09/10 18:50:57 4431 info  <uac.c: 139> UAC - initializing
09/10 18:50:57 4431 info  <hslot.c: 44> INFO:ul_init_locks: locks array size
512
09/10 18:50:57 4431 info  <pike.c: 108> PIKE - initializing
09/10 18:50:57 4431 info  <ip_tree.c: 86> INFO:pike:init_lock_set: probing
256 set size
09/10 18:50:57 4431 info  <avpops.c: 164> AVPops - initializing
09/10 18:50:57 4431 info  <sl.c: 130> StateLess module - initializing
09/10 18:50:57 4431 info  <tm.c: 586> TM - initializing...
09/10 18:50:57 4431 notice  <maxfwd.c: 97> Maxfwd module- initializing
09/10 18:50:57 4431 info  <presource.c: 146> PRESOURCE: Initializing
09/10 18:50:57 4431 crit  <presource.c: 155> Can't bind usrloc
09/10 18:50:57 4431 err  <sr_module.c: 465> init_mod(): Error while
initializing module presource

In config script loadmodule("usrloc.so") is prior to load my custom module.
When I disable above code, then load order follows config file order.

2. Here's how I wanted to get number of users:
unsigned long get_number_of_users()
{
    return ul.get_number_of_users();
}

But usrloc_api_t does not contain this cmd function despite it's exported in
usrloc module

typedef struct usrloc_api {
        int           use_domain;
        int           db_mode;
        unsigned int  nat_flag;

        register_udomain_t   register_udomain;
        get_all_ucontacts_t  get_all_ucontacts;

        insert_urecord_t     insert_urecord;
        delete_urecord_t     delete_urecord;
        get_urecord_t        get_urecord;
        lock_udomain_t       lock_udomain;
        unlock_udomain_t     unlock_udomain;

        release_urecord_t    release_urecord;
        insert_ucontact_t    insert_ucontact;
        delete_ucontact_t    delete_ucontact;
        get_ucontact_t       get_ucontact;

        update_ucontact_t    update_ucontact;

        register_watcher_t   register_watcher;
        unregister_watcher_t unregister_watcher;
        register_ulcb_t      register_ulcb;
} usrloc_api_t;


Thanks,
Toly

-- 
View this message in context: http://www.nabble.com/custom-module-depends-on-usrloc%2C-the-load-order-tp19425469p19425469.html
Sent from the OpenSER Users Mailing List mailing list archive at Nabble.com.





More information about the sr-users mailing list