chan_sip: prevent add_route from adding empty header.
authorCorey Farrell <git@cfware.com>
Fri, 21 Feb 2014 16:49:03 +0000 (16:49 +0000)
committerCorey Farrell <git@cfware.com>
Fri, 21 Feb 2014 16:49:03 +0000 (16:49 +0000)
Fix regression caused by ASTERISK-22582.  Empty Route
headers were added when the route had a single strict
hop.

(closes issue ASTERISK-23306)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/3236/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408699 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index a54437a..f717c77 100644 (file)
@@ -11687,7 +11687,9 @@ static void add_route(struct sip_request *req, struct sip_route *route, int skip
        }
 
        if ((r = sip_route_list(route, 0, skip))) {
-               add_header(req, "Route", ast_str_buffer(r));
+               if (ast_str_strlen(r)) {
+                       add_header(req, "Route", ast_str_buffer(r));
+               }
                ast_free(r);
        }
 }