aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-22 08:52:49 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-22 08:52:49 +0000
commit12b5a1f44485ce00a432df93ccb4bea5aaf01caa (patch)
tree87a58c724ad7387e02a40d6761f3f893a1c35da0
parentc04fe23d51d0d9d77b2c384525e5ba625d0b7f87 (diff)
Bug 6281 - Cannot set more than a single header with SIPAddHeader
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@8429 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_sip.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 5a2184b61..66c6320cf 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -12796,14 +12796,11 @@ static int sip_dtmfmode(struct ast_channel *chan, void *data)
/*! \brief sip_addheader: Add a SIP header ---*/
static int sip_addheader(struct ast_channel *chan, void *data)
{
- int arglen;
int no = 0;
int ok = 0;
- char *content = (char *) NULL;
char varbuf[128];
- arglen = strlen(data);
- if (!arglen) {
+ if (ast_strlen_zero((char *)data)) {
ast_log(LOG_WARNING, "This application requires the argument: Header\n");
return 0;
}
@@ -12812,14 +12809,12 @@ static int sip_addheader(struct ast_channel *chan, void *data)
/* Check for headers */
while (!ok && no <= 50) {
no++;
- snprintf(varbuf, sizeof(varbuf), "_SIPADDHEADER%.2d", no);
- content = pbx_builtin_getvar_helper(chan, varbuf);
-
- if (!content)
+ snprintf(varbuf, sizeof(varbuf), "_SIPADDHEADER%02d", no);
+ if (ast_strlen_zero(pbx_builtin_getvar_helper(chan, varbuf + 1)))
ok = 1;
}
if (ok) {
- pbx_builtin_setvar_helper (chan, varbuf, data);
+ pbx_builtin_setvar_helper (chan, varbuf, (char *)data);
if (sipdebug)
ast_log(LOG_DEBUG,"SIP Header added \"%s\" as %s\n", (char *) data, varbuf);
} else {