]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
automerge commit
authorAutomerge Script <automerge@asterisk.org>
Tue, 6 Mar 2007 22:54:26 +0000 (22:54 +0000)
committerAutomerge Script <automerge@asterisk.org>
Tue, 6 Mar 2007 22:54:26 +0000 (22:54 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@58118 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 655f0e1167965e3c869b10a58012491dedee3f7e..a6caf0bea96d91da15662b87ca466e5f037bd767 100644 (file)
@@ -11192,10 +11192,23 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
                                        p->subscribed = CPIM_PIDF_XML;    /* RFC 3863 format */
                                } else if (strstr(accept, "application/xpidf+xml")) {
                                        p->subscribed = XPIDF_XML;        /* Early pre-RFC 3863 format with MSN additions (Microsoft Messenger) */
+                               } else if (ast_strlen_zero(accept)) {
+                                       if (p->subscribed == NONE) { /* if the subscribed field is not already set, and there is no accept header... */
+                                               transmit_response(p, "489 Bad Event", req);
+
+                                               ast_log(LOG_WARNING,"SUBSCRIBE failure: no Accept header: pvt: stateid: %d, laststate: %d, dialogver: %d, subscribecont: '%s'\n",
+                                                       p->stateid, p->laststate, p->dialogver, p->subscribecontext);
+                                               ast_set_flag(p, SIP_NEEDDESTROY);
+                                               return 0;
+                                       }
+                                       /* if p->subscribed is non-zero, then accept is not obligatory; according to rfc 3265 section 3.1.3, at least.
+                                          so, we'll just let it ride, keeping the value from a previous subscription, and not abort the subscription */
                                } else {
                                        /* Can't find a format for events that we know about */
-                                       transmit_response(p, "489 Bad Event", req);
-                                       ast_set_flag(p, SIP_NEEDDESTROY);       
+                                       char mybuf[200];
+                                       snprintf(mybuf,sizeof(mybuf),"489 Bad Event (format %s)", accept);
+                                       transmit_response(p, mybuf, req);
+                                       ast_set_flag(p, SIP_NEEDDESTROY);
                                        return 0;
                                }
                                if (option_debug > 2)