Skip to content

Commit

Permalink
fix: sending non 2xx ACK must use resolved destination #168
Browse files Browse the repository at this point in the history
  • Loading branch information
emiago committed Dec 22, 2024
1 parent be0ac6a commit 4738d60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sip/transaction_client_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ func (tx *ClientTx) ack() {
ack := newAckRequestNon2xx(tx.origin, resp, nil)
tx.fsmAck = ack // NOTE: this could be incorect property to use but it helps preventing loops in some cases

// https://github.com/emiago/sipgo/issues/168
// Destination can be FQDN and we do not want to resolve this.
// Still in case reliable connection, this ack will reuse same INVITE connection
ack.SetDestination(tx.origin.Destination())

err := tx.conn.WriteMsg(ack)
if err != nil {
tx.log.Error().
Expand Down
2 changes: 2 additions & 0 deletions sip/transport_layer.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ func (l *TransportLayer) ClientRequestConnection(ctx context.Context, req *Reque
}

// Save destination in request to avoid repeated resolving
// This also solves problem where subsequent request like NON 2xx ACK can
// send on same destination without resolving again.
req.SetDestination(raddr.String())
}

Expand Down

0 comments on commit 4738d60

Please sign in to comment.