[asterisk-commits] oej: branch oej/darjeeling-prack-1.8 r369435 - in /team/oej/darjeeling-prack-...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 27 15:54:57 CDT 2012


Author: oej
Date: Wed Jun 27 15:54:55 2012
New Revision: 369435

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369435
Log:
Working on negotating the various options here. 

If the other side REQUIREs PRACK and we don't support it, we should answer negatively.
If the other side SUPPORT PRACK and we support it, we should activate it for this dialog.
If the other side do not support PRACK and we support it, do not activate it for this dialog.
If the other side SUPPORT PRACK and we don't, don't activate either


Modified:
    team/oej/darjeeling-prack-1.8/channels/chan_sip.c
    team/oej/darjeeling-prack-1.8/channels/sip/include/sip.h

Modified: team/oej/darjeeling-prack-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/channels/chan_sip.c?view=diff&rev=369435&r1=369434&r2=369435
==============================================================================
--- team/oej/darjeeling-prack-1.8/channels/chan_sip.c (original)
+++ team/oej/darjeeling-prack-1.8/channels/chan_sip.c Wed Jun 27 15:54:55 2012
@@ -12259,6 +12259,7 @@
 	other end knows and replace the current call with this new call */
 	if (p->options && !ast_strlen_zero(p->options->replaces)) {
 		add_header(&req, "Replaces", p->options->replaces);
+		/* XXX This needs to be automated since we can have multiple options here */
 		add_header(&req, "Require", "replaces");
 	}
 
@@ -18676,6 +18677,9 @@
 			ast_cli(a->fd, "  Theoretical Address:    %s\n", ast_sockaddr_stringify(&cur->sa));
 			ast_cli(a->fd, "  Received Address:       %s\n", ast_sockaddr_stringify(&cur->recv));
 			ast_cli(a->fd, "  SIP Transfer mode:      %s\n", transfermode2str(cur->allowtransfer));
+			ast_cli(a->fd, "  SIP PRACK support:      %s\n", ast_test_flag(&cur->flags[2], SIP_PAGE3_100REL) ? "Active" :
+				 (ast_test_flag(&cur->flags[2], SIP_PAGE3_PRACK) ? "Enabled" : "Disabled"));
+
 			ast_cli(a->fd, "  Force rport:            %s\n", AST_CLI_YESNO(ast_test_flag(&cur->flags[0], SIP_NAT_FORCE_RPORT)));
 			if (ast_sockaddr_isnull(&cur->redirip)) {
 				ast_cli(a->fd,
@@ -21125,6 +21129,8 @@
 		if (activeextensions & SIP_OPT_100REL) {
 			ast_debug(3, "!=!=!=!=!=! Response relies on PRACK! \n");
 			/* DO Something here !!! */
+			/* XXX If the response relies on PRACK, we need to start a PRACK transaction
+			 */
 		}
 		if (activeextensions & SIP_OPT_TIMER) {
 			ast_debug(3, "!=!=!=!=!=! The other side activated Session timers! \n");
@@ -22433,6 +22439,24 @@
 	Include the Require: option tags for further processing as well */
 	p->sipoptions |= required_profile;
 	p->reqsipoptions = required_profile;
+
+	/* Check if the request supports or require PRACK */
+	if (p->reqsipoptions & SIP_OPT_100REL || p->sipoptions & SIP_OPT_100REL) {
+		if (ast_test_flag(&p->flags[2], SIP_PAGE3_PRACK)) {	/* Is PRACK enabled for this dialog? */
+			ast_set_flag(&p->flags[2], SIP_PAGE3_100REL);	/* Mark PRACK as active for this dialog */
+		} else {
+			/* If PRACK was required but is disabled in configuration, don't play */
+			if (p->reqsipoptions & SIP_OPT_100REL) {
+				transmit_response(p, "420 Bad extension (unsupported)", req);
+			}
+			p->invitestate = INV_COMPLETED;
+			if (!p->lastinvite) {
+				sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
+			}
+			res = -1;
+			goto request_invite_cleanup;
+		}
+	}
 
 	/* Check if this is a loop */
 	if (ast_test_flag(&p->flags[0], SIP_OUTGOING) && p->owner && (p->invitestate != INV_TERMINATED && p->invitestate != INV_CONFIRMED) && p->owner->_state != AST_STATE_UP) {
@@ -28306,7 +28330,6 @@
 	sip_cfg.allowsubscribe = FALSE;
 	sip_cfg.disallowed_methods = SIP_UNKNOWN;
 	sip_cfg.contact_ha = NULL;		/* Reset the contact ACL */
-	sip_cfg.prack = DEFAULT_PRACK;
 	snprintf(global_useragent, sizeof(global_useragent), "%s %s", DEFAULT_USERAGENT, ast_get_version());
 	snprintf(global_sdpsession, sizeof(global_sdpsession), "%s %s", DEFAULT_SDPSESSION, ast_get_version());
 	snprintf(global_sdpowner, sizeof(global_sdpowner), "%s", DEFAULT_SDPOWNER);

Modified: team/oej/darjeeling-prack-1.8/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/channels/sip/include/sip.h?view=diff&rev=369435&r1=369434&r2=369435
==============================================================================
--- team/oej/darjeeling-prack-1.8/channels/sip/include/sip.h (original)
+++ team/oej/darjeeling-prack-1.8/channels/sip/include/sip.h Wed Jun 27 15:54:55 2012
@@ -358,7 +358,8 @@
 
 
 #define SIP_PAGE3_SNOM_AOC               (1 << 0)  /*!< DPG: Allow snom aoc messages */
-#define SIP_PAGE3_PRACK               (2 << 0)  /*!< DPG: Allow snom aoc messages */
+#define SIP_PAGE3_PRACK               (1 << 1)  /*!< DPG: Allow snom aoc messages */
+#define SIP_PAGE3_100REL               (1 << 2)  /*!< D: If PRACK is active for a specific dialog */
 
 #define SIP_PAGE3_FLAGS_TO_COPY \
 	(SIP_PAGE3_SNOM_AOC | SIP_PAGE3_PRACK)
@@ -699,7 +700,6 @@
 	unsigned int disallowed_methods;   /*!< methods that we should never try to use */
 	int notifyringing;          /*!< Send notifications on ringing */
 	int notifyhold;             /*!< Send notifications on hold */
-	int prack;			/*!< 0 offer prack, 1 use prack in responses */
 	enum notifycid_setting notifycid;  /*!< Send CID with ringing notifications */
 	enum transfermodes allowtransfer;  /*!< SIP Refer restriction scheme */
 	int allowsubscribe;         /*!< Flag for disabling ALL subscriptions, this is FALSE only if all peers are FALSE




More information about the asterisk-commits mailing list