[asterisk-commits] may: trunk r291006 - in /trunk/addons: ./ ooh323c/src/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Oct 9 09:04:37 CDT 2010


Author: may
Date: Sat Oct  9 09:04:35 2010
New Revision: 291006

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=291006
Log:
Added fast start and h.245 tunneling options per user and peer.

Added options for faststart/h.245 tunneling per user/peer, properly
handle these and global options, correction of handling fs/tunneling
fields in signalling responses

(closes issue #17972)
Reported by: salecha
Patches:
      fs-tunnel-per-point-3.patch uploaded by may213 (license 454)
Tested by: may213, salecha

Modified:
    trunk/addons/chan_ooh323.c
    trunk/addons/ooh323c/src/ooh245.c
    trunk/addons/ooh323c/src/ooh323.c

Modified: trunk/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/chan_ooh323.c?view=diff&rev=291006&r1=291005&r2=291006
==============================================================================
--- trunk/addons/chan_ooh323.c (original)
+++ trunk/addons/chan_ooh323.c Sat Oct  9 09:04:35 2010
@@ -188,6 +188,7 @@
 	struct OOH323Regex *rtpmask;	/* rtp ip regexp */
 	char rtpmaskstr[120];
 	int rtdrcount, rtdrinterval;	/* roundtripdelayreq */
+	int faststart, h245tunneling;	/* faststart & h245 tunneling */
 	struct ooh323_pvt *next;	/* Next entity */
 } *iflist = NULL;
 
@@ -214,6 +215,7 @@
 	struct OOH323Regex	    *rtpmask;
 	char	    rtpmaskstr[120];
 	int	    rtdrcount, rtdrinterval;
+	int	    faststart, h245tunneling;
 	struct ooh323_user *next;
 };
 
@@ -241,6 +243,7 @@
 	struct OOH323Regex	    *rtpmask;
 	char	    rtpmaskstr[120];
 	int	    rtdrcount,rtdrinterval;
+	int	    faststart, h245tunneling;
 	struct ooh323_peer *next;
 };
 
@@ -636,6 +639,8 @@
 		p->dtmfcodec  = peer->dtmfcodec;
 		p->t38support = peer->t38support;
 		p->rtptimeout = peer->rtptimeout;
+		p->faststart = peer->faststart;
+		p->h245tunneling = peer->h245tunneling;
 		if (peer->rtpmask && peer->rtpmaskstr[0]) {
 			p->rtpmask = peer->rtpmask;
 			ast_copy_string(p->rtpmaskstr, peer->rtpmaskstr, sizeof(p->rtpmaskstr));
@@ -665,6 +670,8 @@
 		p->capability = gCapability;
 		p->rtdrinterval = gRTDRInterval;
 		p->rtdrcount = gRTDRCount;
+		p->faststart = gFastStart;
+		p->h245tunneling = gTunneling;
 
 		memcpy(&p->prefs, &gPrefs, sizeof(struct ast_codec_pref));
 		p->username = strdup(dest);
@@ -914,10 +921,9 @@
 		ast_verbose("---   ooh323_call- %s\n", dest);
 
 
-   if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) 
-   {
+   	if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) {
 		ast_log(LOG_WARNING, "ooh323_call called on %s, neither down nor "
-									"reserved\n", ast->name);
+								"reserved\n", ast->name);
 		return -1;
 	}
 	ast_mutex_lock(&p->lock);
@@ -972,6 +978,8 @@
 	destination[sizeof(destination)-1]='\0';
 
 	opts.transfercap = ast->transfercapability;
+	opts.fastStart = p->faststart;
+	opts.tunneling = p->h245tunneling;
 
 	for (i=0;i<480 && !isRunning(p->callToken);i++) usleep(12000);
 
@@ -1758,6 +1766,18 @@
 		p->dtmfcodec = user->dtmfcodec;
 		p->t38support = user->t38support;
 		p->rtptimeout = user->rtptimeout;
+		p->h245tunneling = user->h245tunneling;
+		p->faststart = user->faststart;
+
+		if (p->faststart)
+         		OO_SETFLAG(call->flags, OO_M_FASTSTART);
+		else
+			OO_CLRFLAG(call->flags, OO_M_FASTSTART);
+		if (p->h245tunneling)
+			OO_SETFLAG(call->flags, OO_M_TUNNELING);
+		else
+			OO_CLRFLAG(call->flags, OO_M_TUNNELING);
+
 		if (user->rtpmask && user->rtpmaskstr[0]) {
 			p->rtpmask = user->rtpmask;
 			ast_copy_string(p->rtpmaskstr, user->rtpmaskstr, 
@@ -2165,6 +2185,8 @@
 		user->dtmfmode = gDTMFMode;
 		user->dtmfcodec = gDTMFCodec;
 		user->t38support = gT38Support;
+		user->faststart = gFastStart;
+		user->h245tunneling = gTunneling;
 		/* set default context */
 		ast_copy_string(user->context, gContext, sizeof(user->context));
 		ast_copy_string(user->accountcode, gAccountcode, sizeof(user->accountcode));
@@ -2182,6 +2204,10 @@
 						sizeof(user->accountcode)-1);
 			} else if (!strcasecmp(v->name, "roundtrip")) {
 				sscanf(v->value, "%d,%d", &user->rtdrcount, &user->rtdrinterval);
+			} else if (!strcasecmp(v->name, "faststart")) {
+				user->faststart = ast_true(v->value);
+			} else if (!strcasecmp(v->name, "h245tunneling")) {
+				user->h245tunneling = ast_true(v->value);
 			} else if (!strcasecmp(v->name, "rtptimeout")) {
 				user->rtptimeout = atoi(v->value);
 				if (user->rtptimeout < 0)
@@ -2270,6 +2296,8 @@
 		peer->dtmfmode = gDTMFMode;
 		peer->dtmfcodec = gDTMFCodec;
 		peer->t38support = gT38Support;
+		peer->faststart = gFastStart;
+		peer->h245tunneling = gTunneling;
       		peer->port = 1720;
 		if (0 == friend_type) {
 			peer->mFriend = 1;
@@ -2316,6 +2344,10 @@
 					peer->outgoinglimit = 0;
 			} else if (!strcasecmp(v->name, "accountcode")) {
 				ast_copy_string(peer->accountcode, v->value, sizeof(peer->accountcode));
+			} else if (!strcasecmp(v->name, "faststart")) {
+				peer->faststart = ast_true(v->value);
+			} else if (!strcasecmp(v->name, "h245tunneling")) {
+				peer->h245tunneling = ast_true(v->value);
 			} else if (!strcasecmp(v->name, "rtptimeout")) {
             			peer->rtptimeout = atoi(v->value);
             			if(peer->rtptimeout < 0)
@@ -2779,6 +2811,8 @@
 	if (peer) {
       sprintf(ip_port, "%s:%d", peer->ip, peer->port);
       ast_cli(a->fd, "%-15.15s%s\n", "Name: ", peer->name);
+      ast_cli(a->fd, "%s:%s,%s\n", "FastStart/H.245 Tunneling", peer->faststart?"yes":"no",
+					peer->h245tunneling?"yes":"no");
       ast_cli(a->fd, "%-15.15s%s", "Format Prefs: ", "(");
       print_codec_to_cli(a->fd, &peer->prefs);
       ast_cli(a->fd, ")\n");
@@ -2922,6 +2956,8 @@
 
 	if (user) {
       ast_cli(a->fd, "%-15.15s%s\n", "Name: ", user->name);
+      ast_cli(a->fd, "%s:%s,%s\n", "FastStart/H.245 Tunneling", user->faststart?"yes":"no",
+					user->h245tunneling?"yes":"no");
       ast_cli(a->fd, "%-15.15s%s", "Format Prefs: ", "(");
       print_codec_to_cli(a->fd, &user->prefs);
       ast_cli(a->fd, ")\n");

Modified: trunk/addons/ooh323c/src/ooh245.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooh245.c?view=diff&rev=291006&r1=291005&r2=291006
==============================================================================
--- trunk/addons/ooh323c/src/ooh245.c (original)
+++ trunk/addons/ooh323c/src/ooh245.c Sat Oct  9 09:04:35 2010
@@ -957,10 +957,8 @@
             /*Since Cap exchange and MasterSlave Procedures are done */
             if(gH323ep.h323Callbacks.openLogicalChannels)
                gH323ep.h323Callbacks.openLogicalChannels(call);
-            else{
-               if(!ooGetTransmitLogicalChannel(call))
-                  ooOpenLogicalChannels(call);
-            }
+            if(!ooGetTransmitLogicalChannel(call))
+               ooOpenLogicalChannels(call);
 #if 0
             if(!call->logicalChans){
                if(!gH323ep.h323Callbacks.openLogicalChannels)
@@ -2114,10 +2112,8 @@
    {
       if(gH323ep.h323Callbacks.openLogicalChannels)
          gH323ep.h323Callbacks.openLogicalChannels(call);
-      else{
-         if(!ooGetTransmitLogicalChannel(call))
-            ooOpenLogicalChannels(call);
-      }
+      if(!ooGetTransmitLogicalChannel(call))
+         ooOpenLogicalChannels(call);
 #if 0
       if(!call->logicalChans){
          if(!gH323ep.h323Callbacks.openLogicalChannels)
@@ -3141,10 +3137,8 @@
  
    if(gH323ep.h323Callbacks.openLogicalChannels)
       gH323ep.h323Callbacks.openLogicalChannels(call);
-   else{
-      if(!ooGetTransmitLogicalChannel(call))
-         ooOpenLogicalChannels(call);
-   }
+   if(!ooGetTransmitLogicalChannel(call))
+      ooOpenLogicalChannels(call);
 #if 0
    if(!call->logicalChans){
       if(!gH323ep.h323Callbacks.openLogicalChannels)

Modified: trunk/addons/ooh323c/src/ooh323.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooh323.c?view=diff&rev=291006&r1=291005&r2=291006
==============================================================================
--- trunk/addons/ooh323c/src/ooh323.c (original)
+++ trunk/addons/ooh323c/src/ooh323.c Sat Oct  9 09:04:35 2010
@@ -751,9 +751,18 @@
       
    }
 
-   /* Retrieve the H.245 control channel address from the connect msg */
+   /* Retrieve tunneling info/H.245 control channel address from the connect msg */
+   if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent && 
+      !q931Msg->userInfo->h323_uu_pdu.h245Tunneling) {
+	if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) {
+		OO_CLRFLAG (call->flags, OO_M_TUNNELING);
+		OOTRACEINFO3("Tunneling is disabled for call due to remote reject tunneling"
+			      " (%s, %s)\n", call->callType, call->callToken);
+	}
+   }
    if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent &&
       q931Msg->userInfo->h323_uu_pdu.h245Tunneling &&
+      OO_TESTFLAG (call->flags, OO_M_TUNNELING) &&
       callProceeding->m.h245AddressPresent) {
       OOTRACEINFO3("Tunneling and h245address provided."
                    "Using Tunneling for H.245 messages (%s, %s)\n", 
@@ -801,6 +810,7 @@
        }
       }
    }
+
    return OO_OK;
 }
 
@@ -970,16 +980,27 @@
 
    }
 
-   /* Retrieve the H.245 control channel address from the connect msg */
+   /* Retrieve tunneling info/H.245 control channel address from the connect msg */
+   if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent && 
+      !q931Msg->userInfo->h323_uu_pdu.h245Tunneling) {
+	if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) {
+		OO_CLRFLAG (call->flags, OO_M_TUNNELING);
+		OOTRACEINFO3("Tunneling is disabled for call due to remote reject tunneling"
+			      " (%s, %s)\n", call->callType, call->callToken);
+	}
+   }
    if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent &&
       q931Msg->userInfo->h323_uu_pdu.h245Tunneling &&
-      alerting->m.h245AddressPresent) {
-      OOTRACEINFO3("Tunneling and h245address provided."
-                   "Giving preference to Tunneling (%s, %s)\n", 
-                   call->callType, call->callToken);
-   }
-   else if(alerting->m.h245AddressPresent)
-   {
+	 OO_TESTFLAG (call->flags, OO_M_TUNNELING)) {
+      if (alerting->m.h245AddressPresent) 
+      	OOTRACEINFO3("Tunneling and h245address provided."
+                     "Giving preference to Tunneling (%s, %s)\n", 
+                   	call->callType, call->callToken);
+	ret =ooSendTCSandMSD(call);
+	if (ret != OO_OK)
+		return ret;
+
+   } else if(alerting->m.h245AddressPresent) {
       if (OO_TESTFLAG (call->flags, OO_M_TUNNELING))
       {
          OO_CLRFLAG (call->flags, OO_M_TUNNELING);
@@ -1019,12 +1040,11 @@
          return OO_FAILED;
        }
       }
-   } else if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) {
-	ret =ooSendTCSandMSD(call);
+   } else if (!call->pH245Channel && !call->h245listener) {
+	ret = ooSendStartH245Facility(call);
 	if (ret != OO_OK)
 		return ret;
    }
-
 
    return OO_OK;
 }
@@ -1195,15 +1215,26 @@
    }
 
    /* Retrieve the H.245 control channel address from the connect msg */
+   /* Retrieve tunneling info/H.245 control channel address from the connect msg */
+   if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent && 
+      !q931Msg->userInfo->h323_uu_pdu.h245Tunneling) {
+	if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) {
+		OO_CLRFLAG (call->flags, OO_M_TUNNELING);
+		OOTRACEINFO3("Tunneling is disabled for call due to remote reject tunneling"
+			      " (%s, %s)\n", call->callType, call->callToken);
+	}
+   }
    if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent &&
       q931Msg->userInfo->h323_uu_pdu.h245Tunneling &&
-      progress->m.h245AddressPresent) {
-      OOTRACEINFO3("Tunneling and h245address provided."
-                   "Giving preference to Tunneling (%s, %s)\n", 
-                   call->callType, call->callToken);
-   }
-   else if(progress->m.h245AddressPresent)
-   {
+      OO_TESTFLAG (call->flags, OO_M_TUNNELING)) {
+      if (progress->m.h245AddressPresent) 
+      	OOTRACEINFO3("Tunneling and h245address provided."
+                     "Giving preference to Tunneling (%s, %s)\n", 
+                     call->callType, call->callToken);
+	ret =ooSendTCSandMSD(call);
+	if (ret != OO_OK)
+		return ret;
+   } else if(progress->m.h245AddressPresent) {
       if (OO_TESTFLAG (call->flags, OO_M_TUNNELING))
       {
          OO_CLRFLAG (call->flags, OO_M_TUNNELING);
@@ -1243,8 +1274,8 @@
          return OO_FAILED;
        }
       }
-   } else if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) {
-	ret =ooSendTCSandMSD(call);
+   } else if (!call->pH245Channel && !call->h245listener) {
+	ret = ooSendStartH245Facility(call);
 	if (ret != OO_OK)
 		return ret;
    }
@@ -1444,9 +1475,18 @@
       OO_SETFLAG(call->flags, OO_M_FASTSTARTANSWERED);
    }
 
-   /* Retrieve the H.245 control channel address from the CONNECT msg */
+   /* Retrieve tunneling info/H.245 control channel address from the connect msg */
+   if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent && 
+      !q931Msg->userInfo->h323_uu_pdu.h245Tunneling) {
+	if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) {
+		OO_CLRFLAG (call->flags, OO_M_TUNNELING);
+		OOTRACEINFO3("Tunneling is disabled for call due to remote reject tunneling"
+			      " (%s, %s)\n", call->callType, call->callToken);
+	}
+   }
    if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent &&
       q931Msg->userInfo->h323_uu_pdu.h245Tunneling &&
+      OO_TESTFLAG (call->flags, OO_M_TUNNELING) &&
       connect->m.h245AddressPresent) {
       OOTRACEINFO3("Tunneling and h245address provided."
                    "Giving preference to Tunneling (%s, %s)\n", 




More information about the asterisk-commits mailing list