[sr-dev] update_sock_struct_from_ip() [forward.h] question

Daniel-Constantin Mierla miconda at gmail.com
Wed Sep 23 12:51:12 CEST 2015


Hello,

the specs say that the reply has to be sent to the port in Via header,
if rport is not specified (either as rport param in Via or forced by
admin in config).

So, at a quick look the macro seems ok from my point of view, it its
purpose is to figure out the port where to send the reply.

Cheers,
Daniel

On 23/09/15 12:41, Camille Oudot wrote:
> Hi,
>
> I was investigating an issue we had on siptrace with homer: the
> destination port of all SIP responses to our websocket SIP client was
> always set to 5060 in the HEP headers of the traced packets sent to
> Homer, but the websocket client is not actually communicating on port
> 5060.
>
> When I set the global config option `force_rport=yes`, the trace
> dst port started to be correct.
>
> Digging further, I found this macro in forward.h:
>
> 1  /* use src_ip, port=src_port if rport, via port if via port, 5060 otherwise */
> 2  #define update_sock_struct_from_ip(  to, msg ) \
> 3    init_su((to), &(msg)->rcv.src_ip, \
> 4        (((msg)->via1->rport)|| \
> 5         (((msg)->msg_flags|global_req_flags)&FL_FORCE_RPORT))? \
> 6                (msg)->rcv.src_port: \
> 7                ((msg)->via1->port)?(msg)->via1->port: SIP_PORT )
>
> And I suspect that to conform to the description, line 4 should be:
>
> 4        (((msg)->rcv.src_port)|| \
>
> instead. This way, I shouldn't need to set `force_rport=yes` to have
> the tm callbacks containing the correct response dst port.
>
> Any thoughts on this?
>

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com
Kamailio Advanced Training, Sep 28-30, 2015, in Berlin - http://asipto.com/u/kat




More information about the sr-dev mailing list