aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authoroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-29 19:12:18 +0000
committeroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-29 19:12:18 +0000
commit22d83723fa0b304984797aab729bc4bd750e1e21 (patch)
treeb0022733d030dae8693cc3b4cf00acd8e852eedd /channels
parentc51726c440ccb360cda737dc9e69075b26a02cba (diff)
Issue #7608 - Notifications sent with wrong content-type (imported from 1.2, modified)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@46403 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index a99c0af9c..99b004973 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -267,7 +267,6 @@ enum parse_register_result {
enum subscriptiontype {
NONE = 0,
- TIMEOUT,
XPIDF_XML,
DIALOG_INFO_XML,
CPIM_PIDF_XML,
@@ -1222,7 +1221,6 @@ static int transmit_message_with_text(struct sip_pvt *p, const char *text);
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_rpid_num(const char *input, char *output, int maxlen);
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 @@ static int __sip_autodestruct(void *data)
/* 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 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init)
}
/*! \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 @@ static int transmit_state_notify(struct sip_pvt *p, int state, int full)
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 @@ static int cb_extensionstate(char *context, char* exten, int state, void *data)
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 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
}
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);