diff options
author | Luigi Rizzo <rizzo@icir.org> | 2006-06-03 23:58:32 +0000 |
---|---|---|
committer | Luigi Rizzo <rizzo@icir.org> | 2006-06-03 23:58:32 +0000 |
commit | 88077a4d1fff77a8168bff33a6d234e28ea017aa (patch) | |
tree | 561c7cd65695f5b61c499376f02bc350cfbf2938 /channels | |
parent | 2724885b78a7afb65c041246df5f4d2ecc8758dc (diff) |
remove some duplicated code;
fix indentation on one line;
mark XXX some unreachable code;
mark XXX another place where we could reduce the nesting depth.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@31872 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index e57942b83..0d1c828df 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -11222,6 +11222,8 @@ static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, str ast_set_flag(&p->flags[0], SIP_NEEDDESTROY); return -1; } else { + /* XXX reduce nesting depth */ + /* Handle REFER notifications */ char buf[1024]; @@ -11321,6 +11323,7 @@ static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, str return res; }; + /* XXX hey, we never reach this code! */ /* THis could be voicemail notification */ transmit_response(p, "200 OK", req); if (!p->lastinvite) @@ -11370,7 +11373,7 @@ static int handle_invite_replaces(struct sip_pvt *p, struct sip_request *req, in /* We have no bridge */ if (!earlyreplace) { if (option_debug > 1) - ast_log(LOG_DEBUG, " Attended transfer attempted to replace call with no bridge (maybe ringing). Channel %s!\n", replacecall->name); + ast_log(LOG_DEBUG, " Attended transfer attempted to replace call with no bridge (maybe ringing). Channel %s!\n", replacecall->name); oneleggedreplace = 1; } } @@ -11935,20 +11938,19 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int } } else { if (p && !ast_test_flag(&p->flags[0], SIP_NEEDDESTROY)) { - if (!p->jointcapability) { - if (ast_test_flag(req, SIP_PKT_IGNORE)) - transmit_response(p, "488 Not Acceptable Here (codec error)", req); - else - transmit_response_reliable(p, "488 Not Acceptable Here (codec error)", req); - ast_set_flag(&p->flags[0], SIP_NEEDDESTROY); - } else { + const char *msg; + + if (!p->jointcapability) + msg = "488 Not Acceptable Here (codec error)"; + else { ast_log(LOG_NOTICE, "Unable to create/find SIP channel for this INVITE\n"); - if (ast_test_flag(req, SIP_PKT_IGNORE)) - transmit_response(p, "503 Unavailable", req); - else - transmit_response_reliable(p, "503 Unavailable", req); - ast_set_flag(&p->flags[0], SIP_NEEDDESTROY); + msg = "503 Unavailable"; } + if (ast_test_flag(req, SIP_PKT_IGNORE)) + transmit_response(p, msg, req); + else + transmit_response_reliable(p, msg, req); + ast_set_flag(&p->flags[0], SIP_NEEDDESTROY); } } return res; |