[SR-Users] sr-users Digest, Vol 92, Issue 50:Modify IP address in SDP (Austin Einter)

madhumanjusha at integramicro.com madhumanjusha at integramicro.com
Wed Jan 23 05:24:13 CET 2013


On Tue, January 22, 2013 1:58 pm, sr-users-request at lists.sip-router.org
wrote:
> Send sr-users mailing list submissions to
> sr-users at 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 at lists.sip-router.org
>
> You can reach the person managing the list at
> sr-users-owner at 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:
>
>
> 1. Modify IP address in SDP (Austin Einter)
> 2. Re: Modify IP address in SDP (Olle E. Johansson)
> 3. 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 at 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 at lists.sip-router.org>
> Message-ID:
> <CANXt1k--VtC6aYHGTBZ5GqF8n=66g5PVwG4YhOC_uefxpVYy=g at 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.






More information about the sr-users mailing list