Fix the compactheaders option in sip.conf
[asterisk/asterisk.git] / channels / chan_sip.c
index 7db4d24..99c70f9 100644 (file)
@@ -8055,11 +8055,12 @@ static int add_header(struct sip_request *req, const char *var, const char *valu
                return -1;
        }
 
+       if (sip_cfg.compactheaders) {
+               var = find_alias(var, var);
+
        ast_str_append(&req->data, 0, "%s: %s\r\n", var, value);
        req->header[req->headers] = req->data->str + req->len;
 
-       if (sip_cfg.compactheaders)
-               var = find_alias(var, var);
        req->len += strlen(req->header[req->headers]);
        req->headers++;