Vi.
Vi.

Reputation: 38734

Where SIP client should send replies to INVITEs?

Suppose there's a SIP client listening at 100.0.0.100:5059.

It receives an UDP packet from 10.0.0.101:5060 with INVITE inside with certain headers. For example:

Where should it send "ACK", "Tryinng", "Dialog Establishment", "BYE" and other things? 100.0.0.what?

(Background: trying to write "the whole SIP in single TCP connection" wrapper that translates all addresses seen in SIP to itself, but getting "Request Timeout", "Loop detected", "Relaying frobidden" errors making conversation to last only 15 seconds... Probably because of the wrapper doing something wrong... Why there are so many various confusing IP addresses in headers and application/sdp?..).

Upvotes: 2

Views: 1631

Answers (1)

Frank Shearar
Frank Shearar

Reputation: 17132

RFC 3261 section 18.2.2 tells you what to do. The third step in the algorithm is the one that applies:

  o  Otherwise (for unreliable unicast transports), if the top Via
     has a "received" parameter, the response MUST be sent to the
     address in the "received" parameter, using the port indicated
     in the "sent-by" value, or using port 5060 if none is specified
     explicitly.  If this fails, for example, elicits an ICMP "port
     unreachable" response, the procedures of Section 5 of [4]
     SHOULD be used to determine where to send the response.
  o  Otherwise, if it is not receiver-tagged, the response MUST be
     sent to the address indicated by the "sent-by" value, using the
     procedures in Section 5 of [4].

Where the [4] refers here.

Receiving requests over TCP is a simpler case: you send the request over the open connection if you can. Otherwise, you open a TCP connection to the IP address in the received parameter of the topmost Via if present, or that header's sent-by token if not. If that attempt fails, you have to fall back to the algorithm in RFC 3263 mentioned above.

Upvotes: 0

Related Questions