diff options
author | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-10-08 23:04:12 +0000 |
---|---|---|
committer | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-10-08 23:04:12 +0000 |
commit | d3edf66a3883cf036bf34ac2769006341374f7fe (patch) | |
tree | 0797eda3b4f5aa8ffb4066f49aa4a2da86c1f27a /channels | |
parent | ee550115e4f4ca624e9305646eb5298ffc200cb9 (diff) |
localize some variables and reduce nesting depth
(indentation will be fixed by a separate commit).
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44749 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 624a9204e..0ed3390dc 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -6522,25 +6522,21 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init) add_header(&req, "Allow", ALLOWED_METHODS); add_header(&req, "Supported", SUPPORTED_EXTENSIONS); - if (p->options && p->options->addsipheaders ) { - struct ast_channel *ast; - struct varshead *headp = NULL; - const struct ast_var_t *current; - - ast = p->owner; /* The owner channel */ - if (ast) { - char *headdup; - headp = &ast->varshead; + if (p->options && p->options->addsipheaders && p->owner) { + struct ast_channel *ast = p->owner; /* The owner channel */ + struct varshead *headp = &ast->varshead; + if (!headp) ast_log(LOG_WARNING,"No Headp for the channel...ooops!\n"); else { + const struct ast_var_t *current; AST_LIST_TRAVERSE(headp, current, entries) { /* SIPADDHEADER: Add SIP header to outgoing call */ if (!strncasecmp(ast_var_name(current), "SIPADDHEADER", strlen("SIPADDHEADER"))) { char *content, *end; const char *header = ast_var_value(current); + char *headdup = ast_strdupa(header); - headdup = ast_strdupa(header); /* Strip of the starting " (if it's there) */ if (*headdup == '"') headdup++; @@ -6559,7 +6555,6 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init) } } } - } } if (sdp) { if (p->udptl && p->t38.state == T38_LOCAL_DIRECT) { |