[asterisk-commits] oej: branch 1.2 r46402 -
/branches/1.2/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun Oct 29 12:00:27 MST 2006
Author: oej
Date: Sun Oct 29 13:00:27 2006
New Revision: 46402
URL: http://svn.digium.com/view/asterisk?rev=46402&view=rev
Log:
issue #7608: Notifications with wrong content-type. Reported by jsiddall.
Modified:
branches/1.2/channels/chan_sip.c
Modified: branches/1.2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_sip.c?rev=46402&r1=46401&r2=46402&view=diff
==============================================================================
--- branches/1.2/channels/chan_sip.c (original)
+++ branches/1.2/channels/chan_sip.c Sun Oct 29 13:00:27 2006
@@ -159,7 +159,6 @@
enum subscriptiontype {
NONE = 0,
- TIMEOUT,
XPIDF_XML,
DIALOG_INFO_XML,
CPIM_PIDF_XML,
@@ -930,7 +929,7 @@
static int determine_firstline_parts(struct sip_request *req);
static void sip_dump_history(struct sip_pvt *dialog); /* Dump history to LOG_DEBUG at end of dialog, before destroying data */
static const struct cfsubscription_types *find_subscription_type(enum subscriptiontype subtype);
-static int transmit_state_notify(struct sip_pvt *p, int state, int full, int substate);
+static int transmit_state_notify(struct sip_pvt *p, int state, int full, int substate, int timeout);
static char *gettag(struct sip_request *req, char *header, char *tagbuf, int tagbufsize);
/*! \brief Definition of this channel for PBX channel registration */
@@ -1321,8 +1320,7 @@
/* If this is a subscription, tell the phone that we got a timeout */
if (p->subscribed) {
- p->subscribed = TIMEOUT;
- transmit_state_notify(p, AST_EXTENSION_DEACTIVATED, 1, 1); /* Send first notification */
+ transmit_state_notify(p, AST_EXTENSION_DEACTIVATED, 1, 1, 1); /* Send first notification */
p->subscribed = NONE;
append_history(p, "Subscribestatus", "timeout");
return 10000; /* Reschedule this destruction so that we know that it's gone */
@@ -5114,7 +5112,7 @@
}
/*! \brief transmit_state_notify: Used in the SUBSCRIBE notification subsystem ----*/
-static int transmit_state_notify(struct sip_pvt *p, int state, int full, int substate)
+static int transmit_state_notify(struct sip_pvt *p, int state, int full, int substate, int timeout)
{
char tmp[4000], from[256], to[256];
char *t = tmp, *c, *a, *mfrom, *mto;
@@ -5210,7 +5208,7 @@
add_header(&req, "Content-Type", subscriptiontype->mediatype);
switch(state) {
case AST_EXTENSION_DEACTIVATED:
- if (p->subscribed == TIMEOUT)
+ if (timeout)
add_header(&req, "Subscription-State", "terminated;reason=timeout");
else {
add_header(&req, "Subscription-State", "terminated;reason=probation");
@@ -6500,7 +6498,7 @@
p->laststate = state;
break;
}
- transmit_state_notify(p, state, 1, 1);
+ transmit_state_notify(p, state, 1, 1, 0);
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_1 "Extension Changed %s new state %s for Notify User %s\n", exten, ast_extension_state2str(state), p->username);
@@ -11098,7 +11096,7 @@
struct sip_pvt *p_old;
transmit_response(p, "200 OK", req);
- transmit_state_notify(p, firststate, 1, 1); /* Send first notification */
+ transmit_state_notify(p, firststate, 1, 1, 0); /* Send first notification */
append_history(p, "Subscribestatus", ast_extension_state2str(firststate));
/* remove any old subscription from this peer for the same exten/context,
More information about the asterisk-commits
mailing list