formatting cleanup (bug #4330)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5737 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2-netsec
Kevin P. Fleming 21 years ago
parent 6ac98c6724
commit d5b50fc83d

@ -1356,7 +1356,10 @@ static struct sip_peer *realtime_peer(const char *peername, struct sockaddr_in *
/* Peer found in realtime, now build it in memory */
peer = build_peer(newpeername, var, !ast_test_flag((&global_flags_page2), SIP_PAGE2_RTCACHEFRIENDS));
if (peer) {
if (!peer) {
ast_variables_destroy(var);
return (struct sip_peer *) NULL;
}
if (ast_test_flag((&global_flags_page2), SIP_PAGE2_RTCACHEFRIENDS)) {
/* Cache peer */
ast_copy_flags((&peer->flags_page2),(&global_flags_page2), SIP_PAGE2_RTAUTOCLEAR|SIP_PAGE2_RTCACHEFRIENDS);
@ -1370,8 +1373,6 @@ static struct sip_peer *realtime_peer(const char *peername, struct sockaddr_in *
} else {
ast_set_flag(peer, SIP_REALTIME);
}
}
ast_variables_destroy(var);
return peer;
}
@ -1448,7 +1449,11 @@ static struct sip_user *realtime_user(const char *username)
user = build_user(username, var, !ast_test_flag((&global_flags_page2), SIP_PAGE2_RTCACHEFRIENDS));
if (user) {
if (!user) { /* No user found */
ast_variables_destroy(var);
return NULL;
}
if (ast_test_flag((&global_flags_page2), SIP_PAGE2_RTCACHEFRIENDS)) {
ast_set_flag((&user->flags_page2), SIP_PAGE2_RTCACHEFRIENDS);
suserobjs++;
@ -1459,7 +1464,6 @@ static struct sip_user *realtime_user(const char *username)
ruserobjs++;
ast_set_flag(user, SIP_REALTIME);
}
}
ast_variables_destroy(var);
return user;
}
@ -2698,6 +2702,7 @@ static struct sip_pvt *sip_alloc(char *callid, struct sockaddr_in *sin, int useg
if (ast_test_flag(p, SIP_DTMF) == SIP_DTMF_RFC2833)
p->noncodeccapability |= AST_RTP_DTMF;
strcpy(p->context, default_context);
/* Add to active dialog list */
ast_mutex_lock(&iflock);
p->next = iflist;
@ -2981,6 +2986,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
int sendonly = 0;
int x,y;
int debug=sip_debug_test_pvt(p);
struct ast_channel *bridgepeer = NULL;
/* Update our last rtprx when we receive an SDP, too */
time(&p->lastrtprx);
@ -3166,8 +3172,10 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
ast_log(LOG_NOTICE, "No compatible codecs!\n");
return -1;
}
if (p->owner) { /* There's an open channel owning us */
struct ast_channel *bridgepeer = NULL;
if (!p->owner) /* There's no open channel owning us */
return 0;
if (!(p->owner->nativeformats & p->jointcapability)) {
const unsigned slen=512;
char s1[slen], s2[slen];
@ -3195,7 +3203,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
}
ast_clear_flag(p, SIP_CALL_ONHOLD);
/* Somehow, we need to check if we need to re-invite here */
/* If this call had a native bridge, it's broken
/* If this call had a external native bridge, it's broken
now and we need to start all over again.
The bridged peer, if SIP, now listens
to RTP from Asterisk instead of from
@ -3225,9 +3233,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
ast_rtp_stop(p->rtp);
}
}
}
return 0;
}
/*--- add_header: Add header to SIP message */
@ -3256,12 +3262,11 @@ static int add_header(struct sip_request *req, char *var, char *value)
snprintf(req->header[req->headers], sizeof(req->data) - req->len - 4, "%s: %s\r\n", var, value);
}
req->len += strlen(req->header[req->headers]);
if (req->headers < SIP_MAX_HEADERS)
req->headers++;
else {
ast_log(LOG_WARNING, "Out of header space\n");
if (req->headers == SIP_MAX_HEADERS) {
ast_log(LOG_WARNING, "Out of SIP header space\n");
return -1;
}
req->headers++;
return 0;
}
@ -3279,12 +3284,11 @@ static int add_blank_header(struct sip_request *req)
req->header[req->headers] = req->data + req->len;
snprintf(req->header[req->headers], sizeof(req->data) - req->len, "\r\n");
req->len += strlen(req->header[req->headers]);
if (req->headers < SIP_MAX_HEADERS)
req->headers++;
else {
ast_log(LOG_WARNING, "Out of header space\n");
if (req->headers == SIP_MAX_HEADERS) {
ast_log(LOG_WARNING, "Out of SIP header space\n");
return -1;
}
req->headers++;
return 0;
}
@ -3303,12 +3307,11 @@ static int add_line(struct sip_request *req, const char *line)
req->line[req->lines] = req->data + req->len;
snprintf(req->line[req->lines], sizeof(req->data) - req->len, "%s", line);
req->len += strlen(req->line[req->lines]);
if (req->lines < SIP_MAX_LINES)
req->lines++;
else {
ast_log(LOG_WARNING, "Out of line space\n");
if (req->lines == SIP_MAX_LINES) {
ast_log(LOG_WARNING, "Out of SIP line space\n");
return -1;
}
req->lines++;
return 0;
}

Loading…
Cancel
Save