|
|
@ -22682,7 +22682,7 @@ static int sip_addheader(struct ast_channel *chan, void *data)
|
|
|
|
int no = 0;
|
|
|
|
int no = 0;
|
|
|
|
int ok = FALSE;
|
|
|
|
int ok = FALSE;
|
|
|
|
char varbuf[30];
|
|
|
|
char varbuf[30];
|
|
|
|
char *inbuf = data;
|
|
|
|
char *inbuf = data, *subbuf;
|
|
|
|
|
|
|
|
|
|
|
|
if (ast_strlen_zero(inbuf)) {
|
|
|
|
if (ast_strlen_zero(inbuf)) {
|
|
|
|
ast_log(LOG_WARNING, "This application requires the argument: Header\n");
|
|
|
|
ast_log(LOG_WARNING, "This application requires the argument: Header\n");
|
|
|
@ -22696,13 +22696,18 @@ static int sip_addheader(struct ast_channel *chan, void *data)
|
|
|
|
snprintf(varbuf, sizeof(varbuf), "__SIPADDHEADER%.2d", no);
|
|
|
|
snprintf(varbuf, sizeof(varbuf), "__SIPADDHEADER%.2d", no);
|
|
|
|
|
|
|
|
|
|
|
|
/* Compare without the leading underscores */
|
|
|
|
/* Compare without the leading underscores */
|
|
|
|
if( (pbx_builtin_getvar_helper(chan, (const char *) varbuf + 2) == (const char *) NULL) )
|
|
|
|
if ((pbx_builtin_getvar_helper(chan, (const char *) varbuf + 2) == (const char *) NULL)) {
|
|
|
|
ok = TRUE;
|
|
|
|
ok = TRUE;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ok) {
|
|
|
|
if (ok) {
|
|
|
|
pbx_builtin_setvar_helper (chan, varbuf, inbuf);
|
|
|
|
size_t len = strlen(inbuf);
|
|
|
|
if (sipdebug)
|
|
|
|
subbuf = alloca(len + 1);
|
|
|
|
|
|
|
|
ast_get_encoded_str(inbuf, subbuf, len + 1);
|
|
|
|
|
|
|
|
pbx_builtin_setvar_helper(chan, varbuf, subbuf);
|
|
|
|
|
|
|
|
if (sipdebug) {
|
|
|
|
ast_debug(1, "SIP Header added \"%s\" as %s\n", inbuf, varbuf);
|
|
|
|
ast_debug(1, "SIP Header added \"%s\" as %s\n", inbuf, varbuf);
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ast_log(LOG_WARNING, "Too many SIP headers added, max 50\n");
|
|
|
|
ast_log(LOG_WARNING, "Too many SIP headers added, max 50\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|