diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 7fb4bdda54e881fe5a207104fd7aab5e9e4c441d..db07df9e6155c7b796297430055e71698e565d3f 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -3556,14 +3556,19 @@ static int get_destination(struct sip_pvt *p, struct sip_request *oreq) strncpy(tmpf, get_header(req, "From"), sizeof(tmpf) - 1); fr = ditch_braces(tmpf); - if (fr && !strlen(fr)) - fr = NULL; - if (strncmp(c, "sip:", 4)) { ast_log(LOG_WARNING, "Huh? Not a SIP header (%s)?\n", c); return -1; } c += 4; + if (strlen(fr)) { + if (strncmp(fr, "sip:", 4)) { + ast_log(LOG_WARNING, "Huh? Not a SIP header (%s)?\n", fr); + return -1; + } + fr += 4; + } else + fr = NULL; if ((a = strchr(c, '@')) || (a = strchr(c, ';'))) { *a = '\0'; }