[Serusers] Rewriting URI in the Contact field

Claudio Thorell dos Santos cthorell at telenova.net
Fri Jan 17 14:00:05 CET 2003


Hello,

I was looking for a NAT traversal solution for both SIP messages and RTP,
but it looks like this modification will only handle SIP messages, am I
rigth?
If so, is there any solution for UAs registered behind a NAT?

Thanks,
Claudio

----- Original Message -----
From: "Maxim Sobolev" <sobomax at freebsd.org>
To: "Jiri Kuthan" <jiri at iptel.org>
Cc: <serusers at lists.iptel.org>; <kapitan at portaone.com>
Sent: Saturday, January 11, 2003 2:50 AM
Subject: Re: [Serusers] Rewriting URI in the Contact field


> Thank you for the explanation! Attached please find first version
> of `rport' support for SER (we need it in the core engine), the
> module will follow probably tomorrow. Please note that the code
> is quite raw (6:20 am here ;) and I did not perform any seriuos
> tests yet.
>
> The code does the following:
>
> 1. Adds support for `rport' Via field parameter into the message
> parser;
>
> 2. Extends parser to allow valueless parameters as requred by
> the draft RFC. This will probably requre additional code
> review, as there may be places in the code where it is
> assumed that parameter value could not be a NULL pointer;
>
> 3. Fills in blank rport parameter if present before forwarding
> a request or replying to it;
>
> 4. Changes the code, so that if `rport' is present, then this
> port is used for connecting to that UA.
>
> Any comments, corrections or suggestions are highly appreciated!
>
> -Maxim
>
> On Sat, Jan 11, 2003 at 12:04:34AM +0100, Jiri Kuthan wrote:
> > that's correct.
> >
> > >1. Check that _m->somefield is NULL and call parse_headers() with the
> > >appropriate HDR_FOO flag.
> >
> > yes. you can skip the first check, parse_headers will do it;
> > don't forget to handle errors if parse_headers returns -1
> > (most likely mem alloc failure)
> >
> > >2. Check that _m->somefield is non-NULL and return if false.
> >
> >   yes, that means, that the header field is not in message.
> >
> >   note too that some header fields may occur multiple times; in which
case
> >   msg->hdr_foo points to the first occurence; if you wish to
> >   process all of them, you need to traverse the list
> >   msg->headers
> >
> > example from record-routing (XXX are my extra comments):
> >
> > int find_first_route(struct sip_msg* _m)
> > {
> >     /* XXX don't look at _m->route ... parse_headers will do it for you
*/
> >     if (parse_headers(_m, HDR_ROUTE, 0) == -1) {
> >         /* XXX -1 is some bad error, most likely lack of memory  --
leave! */
> >         LOG(L_ERR, "find_first_route(): Error while parsing headers\n");
> >         return -1;
> >     } else {
> >
> >         if (_m->route) {
> >             return 0;
> >         } else { /* XXX not found .... the header field is not there */
> >             DBG("find_first_route(): No Route headers found\n");
> >             return 1;
> >         }
> >     }
> > }
> >
> >
> >
> > >3. Modify _m->somefield according to the type of that field.
> > >4. Using del_lump() mark original version of the header for deletion
and
> > >using insert_new_lump() indicate where modified version should be
placed
> > >before sending a message out.
> >
> > 3 is the same as 4, isn't it. you modify a header field by creating
> > a delete lump refering the old value and an insert lump with the new
> > value. the new value must be created using pkg_malloc. the replace
> > action in textops module is a good example. (The lump lists, sort
> > of "diffs", is processed when later on the message is printed and
forwarded.)
> >
> > -Jiri
>
>




More information about the sr-users mailing list