[Kamailio-Users] Problem with sip uri in contact field

Geir O. Jensen geir.o.jensen at uninett.no
Tue Mar 3 12:22:51 CET 2009


I think maybe there's some misunderstanding here. We don't modify RURI in
the looseroute, it's quite simply 

if looseroute t_relay() 

We do modify the original INVITE's (basically adding prefixes and changing
domain to forward it to the correct gateway).

Thing is, the contact field from the PBX is
Contact: sip:192.168.20.1

This causes the phone to reply with 
ACK sip:192.168.20.1 SIP/2.0

And apparently OpenSER (our script?) doesn't know how to handle this when it
comes to looseroute so it looks at the To: header instead (which is the
original unmodified header i.e. To: number at sip.domain.no

>From our Gateway the contact field is 
Contact: sip:number at gateway.net

To which the phone replies
ACK sip:number at gateway.net SIP/2.0

And seems to be more to OpenSERs (our scripts?) liking as it then just
relays it to the correct address.

Is using rewritehost() the WRONG way to go about forwarding the INVITEs to
the right Gateway?

- Geir

> -----Original Message-----
> From: Iñaki Baz Castillo [mailto:ibc at aliax.net] 
> Sent: 3. mars 2009 12:16
> To: Geir O. Jensen
> Cc: users at lists.kamailio.org
> Subject: Re: [Kamailio-Users] Problem with sip uri in contact field
> 
> 2009/3/3 Geir O. Jensen <geir.o.jensen at uninett.no>:
> > Hm. We do rather a lot of things with the SIP uri, both 
> reformatting 
> > the content and changing hosts depending on the number.
> 
> You should NEVER modify a request uri in an in-dialog request, NEVER.
> 
> 
> > However, I thought this was OK since anything that was 
> changed would 
> > be "record routed" and handled via the loose route portion.
> 
> Again: RURI must not be modified in an in-dialog request, 
> regardless of the usage of record-route.
> 
> 
> > The ACK that is sent from the SNOM gets caught by the 
> looseroute script.
> > Should it?
> 
> The ACK from SNOM must pass through looseroute script since, 
> as I already explained, it is in fact an in-dialog request.
> 
> 
> 
> > I'm a bit confused now, can't really see how I'm going to 
> fix this... 
> > Our script is rather large and ugly :/
> 
> Don't modify RURI in loose-route section. Just it.
> 
> 
> > I was just under the impression that loose route meant the 
> packets "knew"
> > where they were going...
> 
> Yes, and that is due to the existance of a Route header. When 
> a proxy receives an in-dialog request with Route header it 
> must inspect that header. Usually it contains a proxy local 
> address so the proxy removes that header and routes the 
> request based on the RURI (but MUST NOT change the RURI !!!).
> 
> 
> 
> --
> Iñaki Baz Castillo
> <ibc at aliax.net>
> 
> 





More information about the sr-users mailing list