diff --git a/channels/chan_sip.c b/channels/chan_sip.c index f8b0470670..7a95c1d765 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -12310,7 +12310,7 @@ static int sip_notify(int fd, int argc, char *argv[]) initreqprep(&req, p, SIP_NOTIFY); for (var = varlist; var; var = var->next) - add_header(&req, var->name, var->value); + add_header(&req, var->name, ast_unescape_semicolon(var->value)); /* Recalculate our side, and recalculate Call ID */ ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip); diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h index 8b0daab87b..76b58d7150 100644 --- a/include/asterisk/strings.h +++ b/include/asterisk/strings.h @@ -146,6 +146,13 @@ char *ast_strip(char *s), */ char *ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes); +/*! + \brief Strip backslash for "escaped" semicolons. + \brief s The string to be stripped (will be modified). + \return The stripped string. + */ +char *ast_unescape_semicolon(char *s); + /*! \brief Size-limited null-terminating string copy. \arg dst The destination buffer. diff --git a/main/utils.c b/main/utils.c index a73927e5ac..2b87e2b4a4 100644 --- a/main/utils.c +++ b/main/utils.c @@ -935,6 +935,21 @@ char *ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes) return s; } +char *ast_unescape_semicolon(char *s) +{ + char *e; + char *work = s; + + while ((e = strchr(work, ';'))) { + if ((e > work) && (*(e-1) == '\\')) { + memmove(e - 1, e, strlen(e) + 1); + work = e; + } + } + + return s; +} + int ast_build_string_va(char **buffer, size_t *space, const char *fmt, va_list ap) { int result;