aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-06 22:52:52 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-06 22:52:52 +0000
commitb585ba928d3b2a70ad931955e1be02b69e8fd10a (patch)
tree8da686fb957f72c3c8a7ccfdcf898d3af700df46 /channels/chan_sip.c
parent1f6a13c65ad83190d1d0ce1ce0305a44cfb0cdbd (diff)
Fix for 9220: Eyebeam cannot renew subscriptions for presence info. Reason: re-SUBSCRIBE requests don't include Accept headers, which the rfc says are optional (to put it tersely), (it uses MAY), and luckily, the sip_pvt struct has the format info stored, so we simply leave it if the format is set, and the accept header null.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@58115 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index a9d658b46..c9eefcdf8 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -11082,10 +11082,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)