[SR-Users] Reg. shared library linking during compiling time

kiran bhosale kbhosale at synteltelecom.com
Fri Feb 8 08:06:36 CET 2013


madhumanjusha at integramicro.com wrote:
> Hello All,
> Please find below steps...and kindly let me know the error solution.
>
> STEP 1::
> Under modules I created a directory name b2bentities
> /root/kamailio-3.3.2/modules/b2bentities
> $ls
> b2bentities.so  b2b_server.c  b2b_server.d  b2b_server.h  b2b_server.o
> dialog.h  librpath.lst  makecfg.lst  Makefile
>
> In b2b_server.h
> #ifndef SERVER_H
> #define SERVER_H
> #endif
>
> int b2b_dlg_reply();
>
>
>
> In b2b_server.c I wrote following code ::
>
> int b2b_dlg_reply()
> {
>         LOG(L_INFO,"Hello am in b2bua module\n");
>         return 0;
> }
>
> Also,I added below code to the same file as per steps given in kamailio
> server's developer's guide.
> In developer's guide,they told to initialize parameters as per module's
> requirement but i made them all empty and null...
> for example
> static int mod_init(void)
> {
>         LOG(L_INFO,"IN mod_init\n");
>         return 0;
> }
>
> static cmd_export_t commands[] = {
> };
>
>
> static param_export_t params[]={
> };
>
> struct module_exports exports = {
>     "b2bentities",    // module name
>     NULL, // dlopen flags
>     commands,        // exported functions
>     params,      // exported parameters
>     NULL,            // exported statistics
>     NULL,            // exported MI functions
>     NULL,            // exported pseudo-variables
>     NULL,            // extra processes
>     mod_init,        // module init function (before fork. kids will inherit)
>     NULL,            // reply processing function
>     NULL,            // destroy function
>     child_init       // child init function
> };
>
>
> STEP 2::
> In kamailio core
> file : In receive.c
> Method Name : In receive_msg
>
> i did this way...
>
> In receive.c add follow piece of code::
>
> #include "modules/b2bentities/b2b_server.h"
>
> int receive_msg(....)
> {
>    /*my code*/
>     int b2b_ret;
>         int (*ptr)();
>         ptr= b2b_dlg_reply;
>         if(msg->REQ_METHOD!=METHOD_REGISTER)
>         {
>
>                 b2b_ret=(*ptr)();
>                 if(b2b_ret!=0)
>                 {
>                         LOG(L_INFO,"B2B Dialogue reply function failed\n");
>                         exit(1);
>                 }
>                 else
>                 {
>                         LOG(L_INFO,"B2B Dialogue reply function success\n");
>                         exit(1);
>                 }
>
>         }
>
>
> }
>
> STEP 3::
> I even added kamailio.cfg  load module "b2bentities.so"
>
>
>
> STEP 4::
> Final step,when I do make all.....
> its giving me the following error ::
> [root at kamserver kamailio-3.3.2]# make all
> CC (gcc) [kamailio]             receive.o
> LD (gcc) [kamailio]             kamailio
> receive.o: In function `receive_msg':
> /root/kamailio-3.3.2/receive.c:163: undefined reference to `b2b_dlg_reply'
> collect2: ld returned 1 exit status
> make: *** [kamailio] Error 1
>
>
>
> My doubt:
> Where should my b2bentities.so should be linked during compiling time?
> Please tell me the steps for it.
>
> Thanks & Regards,
> Manjusha A.
> Integra Micro Software Services (P) Ltd.
>
>
>
>
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>   
seems that you want to create your custom module. have you checked the 
makefile of your module. in order to develop the custom module just copy 
the existing module and make relevant changes there. this is genuine way 
. for this u need to include makefile.lst ,Makefile in your module. so 
best way is to copy the smallest module (e.g.) pdb module and make changes.




More information about the sr-users mailing list