< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index Next in Thread >

Re: [reSIProcate] repro inserting rport in Via



On 02/12/16 20:07, Scott Godin wrote:
> Hi Daniel,
> 
> rport is only supposed to be used by entities for response routing if
> the request was sent over an unreliable transport.
> 
> See the following text from RFC3581:
> 
> When a server attempts to send a response, it examines the topmost
>    Via header field value of that response.  If the "sent-protocol"
>    component indicates an *unreliable unicast transport protocol, such as 
> UDP*, and there is no "maddr" parameter, but there is both a
>    "received" parameter and an "rport" parameter, the response MUST be
>    sent to the IP address listed in the "received" parameter, and the
>    port in the "rport" parameter.
> 


Thanks for pointing that out

In my case, the UA sending the response is reConServer, which is based
on reCon / reSIProcate

It occurs in my REGISTER forwarding logic (a subclass of TransactionUser)

The relevant code snippet is below, notice my current workaround is to
remove p_rport.  Should the TU code be checking if it is a reliable
transport, or should the stack do that for the TU after send() is called?


         if(sipMsg->isRequest() && sipMsg->method()==REGISTER)
         {
            StackLog(<<"Handling a REGISTER request");
            sipMsg->header(h_Supporteds).push_back(Token(Symbols::Path));
            if(sipMsg->header(h_Expires).value() > 60)
            {
               sipMsg->header(h_Expires).value() = 60;
            }

sipMsg->header(h_Paths).push_front(NameAddr("sip:sbc.example.org;transport=tcp;lr"));
            NameAddr
regProxy("sip:reg-proxy.example.org:15060;transport=tcp;lr");
            sipMsg->header(h_Routes).clear(); // remove ourselves
            sipMsg->header(h_Routes).push_front(regProxy);
            mStack.send(*sipMsg, this);
         }
         else if(sipMsg->isResponse() && sipMsg->header(h_CSeq).method()
== REGISTER)
         {
            StackLog(<<"Handling a REGISTER response");
            sipMsg->header(h_Vias).front().remove(p_rport);  // FIXME?
            mStack.send(*sipMsg, this);
         }