diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 4aa88292e2..2f7da5fd23 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -16314,7 +16314,8 @@ static int sip_addheader(struct ast_channel *chan, void *data) no++; snprintf(varbuf, sizeof(varbuf), "_SIPADDHEADER%.2d", no); - if( (pbx_builtin_getvar_helper(chan, (const char *) varbuf) == (const char *) NULL) ) + /* Compare without the leading underscore */ + if( (pbx_builtin_getvar_helper(chan, (const char *) varbuf + 1) == (const char *) NULL) ) ok = TRUE; } if (ok) {