[asterisk-commits] trunk - r8643 /trunk/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jan 25 05:11:32 MST 2006


Author: oej
Date: Wed Jan 25 06:11:30 2006
New Revision: 8643

URL: http://svn.digium.com/view/asterisk?rev=8643&view=rev
Log:
- Remove unused option to transmit_state_notify
- Allow for expiry=0 in subscription requests that only wants *one* update and that's it.

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=8643&r1=8642&r2=8643&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Wed Jan 25 06:11:30 2006
@@ -942,7 +942,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);
 static char *gettag(struct sip_request *req, char *header, char *tagbuf, int tagbufsize);
 int find_sip_method(char *msg);
 unsigned int parse_sip_options(struct sip_pvt *pvt, char *supported);
@@ -1325,7 +1325,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);	/* Send last notification */
 		p->subscribed = NONE;
 		append_history(p, "Subscribestatus", "timeout");
 		if (option_debug > 2)
@@ -5042,7 +5042,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)
 {
 	char tmp[4000], from[256], to[256];
 	char *t = tmp, *c, *a, *mfrom, *mto;
@@ -6418,7 +6418,7 @@
 		p->laststate = state;
 		break;
 	}
-	transmit_state_notify(p, state, 1, 1);
+	transmit_state_notify(p, state, 1);
 
 	if (option_debug > 1)
 		ast_verbose(VERBOSE_PREFIX_1 "Extension Changed %s new state %s for Notify User %s\n", exten, ast_extension_state2str(state), p->username);
@@ -10891,14 +10891,15 @@
 		/* check if the requested expiry-time is within the approved limits from sip.conf */
 		if (p->expiry > max_expiry)
 			p->expiry = max_expiry;
-		if (p->expiry < min_expiry)
+		if (p->expiry < min_expiry && p->expiry > 0)
 			p->expiry = min_expiry;
 
 		if (sipdebug || option_debug > 1)
 			ast_log(LOG_DEBUG, "Adding subscription for extension %s context %s for peer %s\n", p->exten, p->context, p->username);
 		if (p->autokillid > -1)
 			sip_cancel_destroy(p);	/* Remove subscription expiry for renewals */
-		sip_scheddestroy(p, (p->expiry + 10) * 1000);	/* Set timer for destruction of call at expiration */
+		if (p->expiry > 0)
+			sip_scheddestroy(p, (p->expiry + 10) * 1000);	/* Set timer for destruction of call at expiration */
 
 		if ((firststate = ast_extension_state(NULL, p->context, p->exten)) < 0) {
 			ast_log(LOG_ERROR, "Got SUBSCRIBE for extensions without hint. Please add hint to %s in context %s\n", p->exten, p->context);
@@ -10909,7 +10910,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);	/* Send first notification */
 			append_history(p, "Subscribestatus", "%s", ast_extension_state2str(firststate));
 
 			/* remove any old subscription from this peer for the same exten/context,



More information about the asterisk-commits mailing list