[asterisk-commits] oej: branch 1.4 r46403 - in /branches/1.4: ./
channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun Oct 29 12:12:19 MST 2006
Author: oej
Date: Sun Oct 29 13:12:18 2006
New Revision: 46403
URL: http://svn.digium.com/view/asterisk?rev=46403&view=rev
Log:
Issue #7608 - Notifications sent with wrong content-type (imported from 1.2, modified)
Modified:
branches/1.4/ (props changed)
branches/1.4/channels/chan_sip.c
Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?rev=46403&r1=46402&r2=46403&view=diff
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Sun Oct 29 13:12:18 2006
@@ -267,7 +267,6 @@
enum subscriptiontype {
NONE = 0,
- TIMEOUT,
XPIDF_XML,
DIALOG_INFO_XML,
CPIM_PIDF_XML,
@@ -1222,7 +1221,6 @@
static int transmit_refer(struct sip_pvt *p, const char *dest);
static int transmit_notify_with_mwi(struct sip_pvt *p, int newmsgs, int oldmsgs, char *vmexten);
static int transmit_notify_with_sipfrag(struct sip_pvt *p, int cseq, char *message, int terminate);
-static int transmit_state_notify(struct sip_pvt *p, int state, int full);
static int transmit_register(struct sip_registry *r, int sipmethod, const char *auth, const char *authheader);
static int send_response(struct sip_pvt *p, struct sip_request *req, enum xmittype reliable, int seqno);
static int send_request(struct sip_pvt *p, struct sip_request *req, enum xmittype reliable, int seqno);
@@ -1450,8 +1448,8 @@
static int get_rdnis(struct sip_pvt *p, struct sip_request *oreq);
static int get_destination(struct sip_pvt *p, struct sip_request *oreq);
static int get_msg_text(char *buf, int len, struct sip_request *req);
-static const char *gettag(const struct sip_request *req, const char *header, char *tagbuf, int tagbufsize);
static void free_old_route(struct sip_route *route);
+static int transmit_state_notify(struct sip_pvt *p, int state, int full, int timeout);
/*--- Constructing requests and responses */
static void initialize_initreq(struct sip_pvt *p, struct sip_request *req);
@@ -1948,8 +1946,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); /* Send last notification */
+ transmit_state_notify(p, AST_EXTENSION_DEACTIVATED, 1, TRUE); /* Send last notification */
p->subscribed = NONE;
append_history(p, "Subscribestatus", "timeout");
if (option_debug > 2)
@@ -6698,7 +6695,7 @@
}
/*! \brief Used in the SUBSCRIBE notification subsystem */
-static int transmit_state_notify(struct sip_pvt *p, int state, int full)
+static int transmit_state_notify(struct sip_pvt *p, int state, int full, int timeout)
{
char tmp[4000], from[256], to[256];
char *t = tmp, *c, *mfrom, *mto;
@@ -6789,7 +6786,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");
@@ -8038,7 +8035,7 @@
break;
}
if (p->subscribed != NONE) /* Only send state NOTIFY if we know the format */
- transmit_state_notify(p, state, 1);
+ transmit_state_notify(p, state, 1, FALSE);
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);
@@ -14122,7 +14119,7 @@
}
transmit_response(p, "200 OK", req);
- transmit_state_notify(p, firststate, 1); /* Send first notification */
+ transmit_state_notify(p, firststate, 1, FALSE); /* Send first notification */
append_history(p, "Subscribestatus", "%s", ast_extension_state2str(firststate));
/* hide the 'complete' exten/context in the refer_to field for later display */
ast_string_field_build(p, subscribeuri, "%s@%s", p->exten, p->context);
More information about the asterisk-commits
mailing list