[asterisk-commits] mmichelson: branch group/issue8824 r156009 - /team/group/issue8824/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 11 14:28:50 CST 2008


Author: mmichelson
Date: Tue Nov 11 14:28:49 2008
New Revision: 156009

URL: http://svn.digium.com/view/asterisk?view=rev&rev=156009
Log:
This introduces a new option for sip.conf, rpid_immediate.

By setting this option to "yes," any connected line updates
which occur during call setup will be immediately sent as
provisional messages to the caller's channel. By setting this
to "no" the information will instead be collected and sent out
in the next provisional response that is sent.

Closes AST-135


Modified:
    team/group/issue8824/channels/chan_sip.c

Modified: team/group/issue8824/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_sip.c?view=diff&rev=156009&r1=156008&r2=156009
==============================================================================
--- team/group/issue8824/channels/chan_sip.c (original)
+++ team/group/issue8824/channels/chan_sip.c Tue Nov 11 14:28:49 2008
@@ -1356,6 +1356,9 @@
 /* Space for addition of other realtime flags in the future */
 #define SIP_PAGE2_STATECHANGEQUEUE	(1 << 9)	/*!< D: Unsent state pending change exists */
 
+#define SIP_PAGE2_CONNECTLINEUPDATE_PEND		(1 << 10)
+#define SIP_PAGE2_RPID_IMMEDIATE			(1 << 11)
+
 #define SIP_PAGE2_VIDEOSUPPORT		(1 << 14)	/*!< DP: Video supported if offered? */
 #define SIP_PAGE2_TEXTSUPPORT		(1 << 15)	/*!< GDP: Global text enable */
 #define SIP_PAGE2_ALLOWSUBSCRIBE	(1 << 16)	/*!< GP: Allow subscriptions from this peer? */
@@ -1383,7 +1386,7 @@
 	(SIP_PAGE2_ALLOWSUBSCRIBE | SIP_PAGE2_ALLOWOVERLAP | SIP_PAGE2_VIDEOSUPPORT | \
 	SIP_PAGE2_T38SUPPORT | SIP_PAGE2_RFC2833_COMPENSATE | SIP_PAGE2_BUGGY_MWI | \
 	SIP_PAGE2_TEXTSUPPORT | SIP_PAGE2_UDPTL_DESTINATION | \
-	SIP_PAGE2_VIDEOSUPPORT_ALWAYS)
+	SIP_PAGE2_VIDEOSUPPORT_ALWAYS | SIP_PAGE2_RPID_IMMEDIATE)
 
 /*@}*/ 
 
@@ -8449,6 +8452,14 @@
 		return -1;
 	}
 	respprep(&resp, p, msg, req);
+
+	if (ast_test_flag(&p->flags[0], SIP_SENDRPID) 
+			&& ast_test_flag(&p->flags[1], SIP_PAGE2_CONNECTLINEUPDATE_PEND) 
+			&& (!strcasecmp(msg, "180 Ringing") || !strcasecmp(msg, "183 Session Progress"))) {
+		ast_clear_flag(&p->flags[1], SIP_PAGE2_CONNECTLINEUPDATE_PEND);
+		add_rpid(&resp, p);
+	}
+
 	add_header_contentLength(&resp, 0);
 	/* If we are cancelling an incoming invite for some reason, add information
 		about the reason why we are doing this in clear text */
@@ -10382,20 +10393,24 @@
 			send_request(p, &req, XMIT_CRITICAL, p->ocseq);
 		}
 	} else {
-		struct sip_request resp;
-
-		if ((p->owner->_state == AST_STATE_RING) && !ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT)) {
-			respprep(&resp, p, "180 Ringing", &p->initreq);
-			add_rpid(&resp, p);
-			send_response(p, &resp, XMIT_UNRELIABLE, 0);
-			ast_set_flag(&p->flags[0], SIP_RINGING);
-		} else if (p->owner->_state == AST_STATE_RINGING) {
-			respprep(&resp, p, "183 Session Progress", &p->initreq);
-			add_rpid(&resp, p);
-			send_response(p, &resp, XMIT_UNRELIABLE, 0);
-			ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);
+		if (ast_test_flag(&p->flags[1], SIP_PAGE2_RPID_IMMEDIATE)) {
+			struct sip_request resp;
+  
+			if ((p->owner->_state == AST_STATE_RING) && !ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT)) {
+				respprep(&resp, p, "180 Ringing", &p->initreq);
+				add_rpid(&resp, p);
+				send_response(p, &resp, XMIT_UNRELIABLE, 0);
+				ast_set_flag(&p->flags[0], SIP_RINGING);
+			} else if (p->owner->_state == AST_STATE_RINGING) {
+				respprep(&resp, p, "183 Session Progress", &p->initreq);
+				add_rpid(&resp, p);
+				send_response(p, &resp, XMIT_UNRELIABLE, 0);
+				ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);
+			} else {
+				ast_log(LOG_DEBUG, "Unable able to send update to '%s' in state '%s'\n", p->owner->name, ast_state2str(p->owner->_state));
+			}
 		} else {
-			ast_log(LOG_DEBUG, "Unable able to send update to '%s' in state '%s'\n", p->owner->name, ast_state2str(p->owner->_state));
+			ast_set_flag(&p->flags[1], SIP_PAGE2_CONNECTLINEUPDATE_PEND);
 		}
 	}
 }
@@ -21932,6 +21947,9 @@
 		} else if (ast_true(v->value)) {
 			ast_set_flag(&flags[0], SIP_SENDRPID_RPID);
 		}
+	} else if (!strcasecmp(v->name, "rpid_immediate")) {
+		ast_set_flag(&mask[1], SIP_PAGE2_RPID_IMMEDIATE);
+		ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_RPID_IMMEDIATE);
 	} else if (!strcasecmp(v->name, "g726nonstandard")) {
 		ast_set_flag(&mask[0], SIP_G726_NONSTANDARD);
 		ast_set2_flag(&flags[0], ast_true(v->value), SIP_G726_NONSTANDARD);




More information about the asterisk-commits mailing list