[asterisk-commits] irroot: branch irroot/distrotech-customers-trunk r322170 - /team/irroot/distr...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 6 22:51:40 CDT 2011


Author: irroot
Date: Mon Jun  6 22:51:36 2011
New Revision: 322170

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=322170
Log:
Add RB:1253 Make handle_request_publish do dialog expiration and destruction.

Modified:
    team/irroot/distrotech-customers-trunk/channels/chan_sip.c

Modified: team/irroot/distrotech-customers-trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-trunk/channels/chan_sip.c?view=diff&rev=322170&r1=322169&r2=322170
==============================================================================
--- team/irroot/distrotech-customers-trunk/channels/chan_sip.c (original)
+++ team/irroot/distrotech-customers-trunk/channels/chan_sip.c Mon Jun  6 22:51:36 2011
@@ -24145,11 +24145,13 @@
 
 	if (ast_strlen_zero(event)) {
 		transmit_response(p, "489 Bad Event", req);
+		pvt_set_needdestroy(p, "missing Event: header");
 		return -1;
 	}
 
 	if (!(esc = get_esc(event))) {
 		transmit_response(p, "489 Bad Event", req);
+		pvt_set_needdestroy(p, "unknown event package in publish");
 		return -1;
 	}
 
@@ -24174,6 +24176,15 @@
 	}
 
 	publish_type = determine_sip_publish_type(req, event, etag, expires_str, &expires_int);
+
+	if (expires_int > max_expiry) {
+		expires_int = max_expiry;
+	} else if (expires_int < min_expiry && expires_int > 0) {
+		transmit_response_with_minexpires(p, "423 Interval too small", req);
+		pvt_set_needdestroy(p, "Expires is less that the min expires allowed.");
+		return 0;
+	}
+	p->expiry = expires_int;
 
 	/* It is the responsibility of these handlers to formulate any response
 	 * sent for a PUBLISH
@@ -24198,6 +24209,11 @@
 		transmit_response(p, "400 Impossible Condition", req);
 		break;
 	}
+	if (!handler_result && p->expiry > 0) {
+		sip_scheddestroy(p, (p->expiry + 10) * 1000);
+	} else {
+		pvt_set_needdestroy(p, "forcing expiration");
+	}
 
 	return handler_result;
 }
@@ -24580,8 +24596,7 @@
 			ast_log(LOG_WARNING, "Received subscription for extension \"%s\" context \"%s\" "
 				"with Expire header less that 'minexpire' limit. Received \"Expire: %d\" min is %d\n",
 				p->exten, p->context, p->expiry, min_expiry);
-			p->expiry = min_expiry;
-			pvt_set_needdestroy(p, "Expires is less that the min expires allowed. ");
+			pvt_set_needdestroy(p, "Expires is less that the min expires allowed.");
 			return 0;
 		}
 




More information about the asterisk-commits mailing list