From 7de89a5a4499f94c67ef03b97aa9e6d113ad4017 Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Tue, 11 Sep 2012 16:28:13 -0400
Subject: [PATCH] * #14529: sip: don't overwrite routeset in hangup

This was preventing us from correctly sending BYE requests for hangup.
---
 daemon/src/sip/sipvoiplink.cpp | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp
index fd27e325d0..47a7588bcb 100644
--- a/daemon/src/sip/sipvoiplink.cpp
+++ b/daemon/src/sip/sipvoiplink.cpp
@@ -926,10 +926,15 @@ SIPVoIPLink::hangup(const std::string& id)
     if (inv == NULL)
         throw VoipLinkException("No invite session for this call");
 
-    // Looks for sip routes
-    if (account->hasServiceRoute()) {
-        pjsip_route_hdr *route_set = sip_utils::createRouteSetList(account->getServiceRoute(), inv->pool);
-        pjsip_dlg_set_route_set(inv->dlg, route_set);
+    pjsip_route_hdr *route = inv->dlg->route_set.next;
+    while (route and route != &inv->dlg->route_set) {
+        char buf[1024];
+        int printed = pjsip_hdr_print_on(route, buf, sizeof(buf));
+        if (printed >= 0) {
+            buf[printed] = '\0';
+            DEBUG("Route header %s", buf);
+        }
+        route = route->next;
     }
 
     pjsip_tx_data *tdata = NULL;
-- 
GitLab