[asterisk-commits] russell: branch russell/events r121504 - in /team/russell/events: ./ channels...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 10 09:12:21 CDT 2008


Author: russell
Date: Tue Jun 10 09:12:21 2008
New Revision: 121504

URL: http://svn.digium.com/view/asterisk?view=rev&rev=121504
Log:
sync with trunk

Modified:
    team/russell/events/   (props changed)
    team/russell/events/channels/chan_sip.c
    team/russell/events/main/devicestate.c

Propchange: team/russell/events/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/russell/events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jun 10 09:12:21 2008
@@ -1,1 +1,1 @@
-/trunk:1-121484
+/trunk:1-121503

Modified: team/russell/events/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/channels/chan_sip.c?view=diff&rev=121504&r1=121503&r2=121504
==============================================================================
--- team/russell/events/channels/chan_sip.c (original)
+++ team/russell/events/channels/chan_sip.c Tue Jun 10 09:12:21 2008
@@ -2485,7 +2485,7 @@
 		dialog->stateid = -1; /* shouldn't we 'zero' this out? */
 	}
 	/* Remove link from peer to subscription of MWI */
-	if (dialog->relatedpeer && dialog->relatedpeer->mwipvt)
+	if (dialog->relatedpeer && dialog->relatedpeer->mwipvt == dialog)
 		dialog->relatedpeer->mwipvt = dialog_unref(dialog->relatedpeer->mwipvt, "delete ->relatedpeer->mwipvt");
 	if (dialog->relatedpeer && dialog->relatedpeer->call == dialog)
 		dialog->relatedpeer->call = dialog_unref(dialog->relatedpeer->call, "unset the relatedpeer->call field in tandem with relatedpeer field itself");
@@ -7845,8 +7845,13 @@
 		ast_string_field_set(p, url, NULL);
 	}
 
-	/* Add Session-Timers related headers if the feature is active for this session */
-	if (p->stimer && p->stimer->st_active == TRUE && p->stimer->st_active_peer_ua == TRUE) {
+	/* Add Session-Timers related headers if the feature is active for this session.
+	   An exception to this behavior is the ACK request. Since Asterisk never requires 
+	   session-timers support from a remote end-point (UAS) in an INVITE, it must 
+	   not send 'Require: timer' header in the ACK request. Also, Require: header 
+	   is not applicable for CANCEL method. */
+	if (p->stimer && p->stimer->st_active == TRUE && p->stimer->st_active_peer_ua == TRUE 
+	    && sipmethod != SIP_ACK && sipmethod != SIP_CANCEL) {
 		char se_hdr[256];
 		snprintf(se_hdr, sizeof(se_hdr), "%d;refresher=%s", p->stimer->st_interval, 
 			strefresher2str(p->stimer->st_ref));
@@ -9168,6 +9173,7 @@
 		
 		snprintf(i2astr, sizeof(i2astr), "%d", p->stimer->st_interval);
 		add_header(&req, "Session-Expires", i2astr);
+		snprintf(i2astr, sizeof(i2astr), "%d", st_get_se(p, FALSE));
 		add_header(&req, "Min-SE", i2astr);
 	}
 

Modified: team/russell/events/main/devicestate.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/main/devicestate.c?view=diff&rev=121504&r1=121503&r2=121504
==============================================================================
--- team/russell/events/main/devicestate.c (original)
+++ team/russell/events/main/devicestate.c Tue Jun 10 09:12:21 2008
@@ -843,3 +843,91 @@
 
 	return 0;
 }
+
+void ast_devstate_aggregate_init(struct ast_devstate_aggregate *agg)
+{
+	memset(agg, 0, sizeof(*agg));
+
+	agg->all_unavail = 1;
+	agg->all_busy = 1;
+	agg->all_free = 1;
+	agg->all_on_hold = 1;
+}
+
+void ast_devstate_aggregate_add(struct ast_devstate_aggregate *agg, enum ast_device_state state)
+{
+	switch (state) {
+	case AST_DEVICE_NOT_INUSE:
+		agg->all_unavail = 0;
+		agg->all_busy = 0;
+		agg->all_on_hold = 0;
+		break;
+	case AST_DEVICE_INUSE:
+		agg->in_use = 1;
+		agg->all_busy = 0;
+		agg->all_unavail = 0;
+		agg->all_free = 0;
+		agg->all_on_hold = 0;
+		break;
+	case AST_DEVICE_RINGING:
+		agg->ring = 1;
+		agg->all_busy = 0;
+		agg->all_unavail = 0;
+		agg->all_free = 0;
+		agg->all_on_hold = 0;
+		break;
+	case AST_DEVICE_RINGINUSE:
+		agg->in_use = 1;
+		agg->ring = 1;
+		agg->all_busy = 0;
+		agg->all_unavail = 0;
+		agg->all_free = 0;
+		agg->all_on_hold = 0;
+		break;
+	case AST_DEVICE_ONHOLD:
+		agg->all_unavail = 0;
+		agg->all_free = 0;
+		break;
+	case AST_DEVICE_BUSY:
+		agg->all_unavail = 0;
+		agg->all_free = 0;
+		agg->all_on_hold = 0;
+		agg->busy = 1;
+		break;
+	case AST_DEVICE_UNAVAILABLE:
+	case AST_DEVICE_INVALID:
+		agg->all_busy = 0;
+		agg->all_free = 0;
+		agg->all_on_hold = 0;
+		break;
+	case AST_DEVICE_UNKNOWN:
+		break;
+	}
+}
+
+enum ast_device_state ast_devstate_aggregate_result(struct ast_devstate_aggregate *agg)
+{
+	if (agg->all_free)
+		return AST_DEVICE_NOT_INUSE;
+	
+	if (agg->all_on_hold)
+		return AST_DEVICE_ONHOLD;
+	
+	if (agg->all_busy)
+		return AST_DEVICE_BUSY;
+
+	if (agg->all_unavail)
+		return AST_DEVICE_UNAVAILABLE;
+	
+	if (agg->ring)
+		return agg->in_use ? AST_DEVICE_RINGINUSE : AST_DEVICE_RINGING;
+
+	if (agg->in_use)
+		return AST_DEVICE_INUSE;
+
+	if (agg->busy)
+		return AST_DEVICE_BUSY;
+	
+	return AST_DEVICE_NOT_INUSE;
+}
+




More information about the asterisk-commits mailing list