On Tue, January 22, 2013 1:58 pm, sr-users-request@lists.sip-router.org wrote:
Send sr-users mailing list submissions to sr-users@lists.sip-router.org
To subscribe or unsubscribe via the World Wide Web, visit http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users or, via email, send a message with subject or body 'help' to sr-users-request@lists.sip-router.org
You can reach the person managing the list at sr-users-owner@lists.sip-router.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of sr-users digest..."
Today's Topics:
- Modify IP address in SDP (Austin Einter)
- Re: Modify IP address in SDP (Olle E. Johansson)
- Problem with 4.0 nightlies and IMS - sem_post undefined
(Barry Flanagan) 4. Patch to resolve segfault in json module (Richard Brady) 5. Re: Modify IP address in SDP (Austin Einter) 6. Re: Patch to resolve segfault in json module (Daniel-Constantin Mierla) 7. Re: [sr-dev] FOSDEM (Daniel Pocock)
Message: 1 Date: Tue, 22 Jan 2013 18:37:13 +0530 From: Austin Einter austin.einter@gmail.com Subject: [SR-Users] Modify IP address in SDP To: "SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List" sr-users@lists.sip-router.org Message-ID: CANXt1k--VtC6aYHGTBZ5GqF8n=66g5PVwG4YhOC_uefxpVYy=g@mail.gmail.com Content-Type: text/plain; charset="iso-8859-1"
Dear All When 200 OK to INVITE passes through Kamailio proxy , I want to change the IP address in SDP to a specific IP address.
Can this be done by just modifying configuration files or do I need to modify in source code.
In case I need to modify source code, which files I need to look at.
Kindly provide pointers for said problem.
Thanks Austin
Hello Austin, 1...I was doing similar one for my task. Files : /root/kamailio-3.3.2/parser/sdp/sdp.h sdp.h file has struct that holds ip address and port numbers of audio and video. Stucture: sdp_session_cell struct has member named str ip_addr will give you ip address in sdp.
2...Yes you can edit existing code or else you can create your own 200ok packet.I created my own 200OK and invite packets with sdp.
3...You can grab below ip address when kamailio proxy is about to forward 200OK to end client.File where you can find 200OK is (though not sure but you can try this file edit existing 200OK): /root/kamailio-3.3.2/modules/tm/t_reply.c has below function static int _reply( struct cell *trans, struct sip_msg* p_msg, unsigned int code, char * text, int lock ) {
}
4...I did the following way to get ipaddr...and below piece of code you can use it in the above function's body to edit 200OK's ip address:: char my_src_rtp_addr[8]; int my_src_rtp_addr_len=0; struct sdp_session_cell *sdp_session;
if(0 != parse_sdp(p_msg)) { LOG(L_INFO,"Unable to parse sdp\n"); } sdp_session=get_sdp_session(p_msg,0); if(sdp_session!=0){ my_src_rtp_addr_len=strlen(my_src_rtp_addr); my_src_rtp_addr[my_src_rtp_addr_len]='\0'; my_src_rtp_addr[my_src_rtp_addr_len+1]='\0'; my_src_rtp_addr[my_src_rtp_addr_len+2]='\0'; my_src_rtp_addr[my_src_rtp_addr_len+3]='\0'; strncpy(my_src_rtp_addr,sdp_session->ip_addr.s,sdp_session->ip_addr.len);
}
If any questions,please let me know.
Thanks & Regards, Manjusha A. Integra Micro Software Services (P) Ltd.
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@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.
madhumanjusha@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@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@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.
Hello,
some guidelines to write a new module are available at: - http://www.asipto.com/pub/kamailio-devel-guide/#c16_devel_new_module
Cheers, Daniel
On 2/8/13 8:06 AM, kiran bhosale wrote:
madhumanjusha@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@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@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.
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users