]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_sip: SIP route header is missing on UPDATE
authorMark Petersen <bugs.digium.com@zombie.dk>
Mon, 7 Mar 2022 14:11:41 +0000 (15:11 +0100)
committerKevin Harwell <kharwell@digium.com>
Tue, 26 Apr 2022 21:47:14 +0000 (16:47 -0500)
if Asterisk need to send an UPDATE before answer
on a channel that uses Record-Route:
it will not include a Route header

ASTERISK-29955

Change-Id: Id1920ecbfea7739a038b14dc94487ecfe7b57eef

channels/chan_sip.c

index b6aff80cc83ca05c43bb444e54b690e9ea972265..77685b2f80d48f20e9aa35f1df12b0cd180b8265 100644 (file)
@@ -12443,9 +12443,8 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, ui
         * Send UPDATE to the same destination as CANCEL, if call is not in final state.
         */
        if (!sip_route_empty(&p->route) &&
-                       !(sipmethod == SIP_CANCEL ||
-                               (sipmethod == SIP_ACK && (p->invitestate == INV_COMPLETED || p->invitestate == INV_CANCELLED)) ||
-                               (sipmethod == SIP_UPDATE && (p->invitestate == INV_PROCEEDING || p->invitestate == INV_EARLY_MEDIA)))) {
+               !(sipmethod == SIP_CANCEL ||
+                       (sipmethod == SIP_ACK && (p->invitestate == INV_COMPLETED || p->invitestate == INV_CANCELLED)))) {
                if (p->socket.type != AST_TRANSPORT_UDP && p->socket.tcptls_session) {
                        /* For TCP/TLS sockets that are connected we won't need
                         * to do any hostname/IP lookups */
@@ -12453,6 +12452,11 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, ui
                        /* For NATed traffic, we ignore the contact/route and
                         * simply send to the received-from address. No need
                         * for lookups. */
+               } else if (sipmethod == SIP_UPDATE && (p->invitestate == INV_PROCEEDING || p->invitestate == INV_EARLY_MEDIA)) {
+                       /* Calling set_destination for an UPDATE in early dialog
+                        * will result in mangling of the target for a subsequent
+                        * CANCEL according to ASTERISK-24628 so do not do it.
+                        */
                } else {
                        set_destination(p, sip_route_first_uri(&p->route));
                }