summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2005-01-12 23:01:44 +0000
committerMark Spencer <markster@digium.com>2005-01-12 23:01:44 +0000
commit5bb53baa0e186757cbe9b61f611a4e2adcb72965 (patch)
treeeb42633c555f517faebd84526180a049e5096c18 /channels
parentb730f9435c9899b4b9886f331c1c9bc65391e848 (diff)
Send 405 Method Not Allowed when message received outside of call (bug #3324, commited from within the plane to huntsville)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4771 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_sip.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index a5fdc4980..d8cc023cf 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -7912,14 +7912,17 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
ast_set_flag(p, SIP_NEEDDESTROY);
transmit_response(p, "200 OK", req);
} else if (!strcasecmp(cmd, "MESSAGE")) {
- if (!ignore) {
- if (debug)
- ast_verbose("Receiving message!\n");
- receive_message(p, req);
- }
- transmit_response(p, "200 OK", req);
- if (!p->lastinvite)
+ if (p->lastinvite) {
+ if (!ignore) {
+ if (debug)
+ ast_verbose("Receiving message!\n");
+ receive_message(p, req);
+ }
+ transmit_response(p, "200 OK", req);
+ } else {
+ transmit_response(p, "405 Method Not Allowed", req);
ast_set_flag(p, SIP_NEEDDESTROY);
+ }
} else if (!strcasecmp(cmd, "SUBSCRIBE")) {
if (!ignore) {
/* Use this as the basis */