[asterisk-commits] may: branch may/ooh323_ipv6 r307521 - in /team/may/ooh323_ipv6: ./ addons/ ad...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 10 14:10:19 CST 2011


Author: may
Date: Thu Feb 10 14:10:14 2011
New Revision: 307521

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=307521
Log:
Recorded merge of revisions 307396 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r307396 | may | 2011-02-10 16:29:19 +0300 (Thu, 10 Feb 2011) | 23 lines
  
  Corrections for properly work with H.323v2 (older) endpoints and other
  small fixes.
  
  Interpret remote side H.225 version.
  
  Corrections for H.323v2 endpoints: 
  don't start TCS and MSD before connect,
  don't start TCS and MSD by accepting H.245 connection,
  start TCS and MSD by StartH245 facility message.
  
  Other fixes:
  fix non zeroended remoteDisplayName issue, small fixes in call clearing
  by closing H.245 connection, tcp keepalive introduced on TCP
  connections (now is hardcoded, will be configurable in the future), 
  don't force H.245tunneling if FastStart is active, don't send Alerting 
  singal more than once per call.
  
  (closes issue #18542)
  Reported by: vmikhelson
  Patches: 
        issue18542-final-3.patch uploaded by may213 (license 454)
  Tested by: vmikhelson
........

Modified:
    team/may/ooh323_ipv6/   (props changed)
    team/may/ooh323_ipv6/addons/chan_ooh323.c
    team/may/ooh323_ipv6/addons/ooh323c/src/ooCalls.h
    team/may/ooh323_ipv6/addons/ooh323c/src/ooSocket.c
    team/may/ooh323_ipv6/addons/ooh323c/src/ooStackCmds.c
    team/may/ooh323_ipv6/addons/ooh323c/src/oochannels.c
    team/may/ooh323_ipv6/addons/ooh323c/src/ooh245.c
    team/may/ooh323_ipv6/addons/ooh323c/src/ooh323.c
    team/may/ooh323_ipv6/addons/ooh323c/src/ooq931.c

Propchange: team/may/ooh323_ipv6/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Feb 10 14:10:14 2011
@@ -1,1 +1,1 @@
-/trunk:1-307374
+/trunk:1-307374,307396

Modified: team/may/ooh323_ipv6/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/chan_ooh323.c?view=diff&rev=307521&r1=307520&r2=307521
==============================================================================
--- team/may/ooh323_ipv6/addons/chan_ooh323.c (original)
+++ team/may/ooh323_ipv6/addons/chan_ooh323.c Thu Feb 10 14:10:14 2011
@@ -183,6 +183,7 @@
 	int nat;
 	int amaflags;
 	int progsent;			/* progress is sent */
+	int alertsent;			/* alerting is sent */
 	struct ast_dsp *vad;
 	struct OOH323Regex *rtpmask;	/* rtp ip regexp */
 	char rtpmaskstr[120];
@@ -1222,12 +1223,16 @@
 	    break;
       case AST_CONTROL_RINGING:
 	    if (ast->_state == AST_STATE_RING || ast->_state == AST_STATE_RINGING) {
-	    	if (gH323Debug) 
-			ast_log(LOG_DEBUG,"Sending manual ringback for %s, res = %d\n", 
-			callToken,
-            		ooManualRingback(callToken));
-		 else
-	    		ooManualRingback(callToken);
+		if (!p->alertsent) {
+			if (gH323Debug) {
+				ast_debug(1, "Sending manual ringback for %s, res = %d\n",
+					callToken,
+					ooManualRingback(callToken));
+			} else {
+				ooManualRingback(callToken);
+			}
+			p->alertsent = 1;
+                }
 	    }
 	 break;
 	case AST_CONTROL_SRCUPDATE:

Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooCalls.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooCalls.h?view=diff&rev=307521&r1=307520&r2=307521
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooCalls.h (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooCalls.h Thu Feb 10 14:10:14 2011
@@ -172,6 +172,7 @@
    OOCallState          callState;
    OOCallClearReason    callEndReason;
    int			q931cause;
+   ASN1UINT		h225version;
    unsigned             h245ConnectionAttempts;
    OOH245SessionState   h245SessionState;
    int                  dtmfmode;

Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooSocket.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooSocket.c?view=diff&rev=307521&r1=307520&r2=307521
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooSocket.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooSocket.c Thu Feb 10 14:10:14 2011
@@ -199,8 +199,9 @@
 {
    int on;
    OOSOCKET sock;
-
+   int keepalive = 1, keepcnt = 24, keepidle = 120, keepintvl = 30;
    struct linger linger;
+
    if (family == 6) {
    	sock = socket (AF_INET6,
                              	SOCK_STREAM,
@@ -231,6 +232,11 @@
       OOTRACEERR1("Error:Failed to set socket option linger\n");
       return ASN_E_INVSOCKET;
    }
+   setsockopt (sock, SOL_SOCKET, SO_KEEPALIVE, (const char *)&keepalive,
+			sizeof(keepalive));
+   setsockopt (sock, SOL_TCP, TCP_KEEPCNT, &keepcnt, sizeof(keepcnt));
+   setsockopt (sock, SOL_TCP, TCP_KEEPIDLE, &keepidle, sizeof(keepidle));
+   setsockopt (sock, SOL_TCP, TCP_KEEPINTVL, &keepintvl, sizeof(keepintvl));
    *psocket = sock;
    return ASN_OK;
 }

Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooStackCmds.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooStackCmds.c?view=diff&rev=307521&r1=307520&r2=307521
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooStackCmds.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooStackCmds.c Thu Feb 10 14:10:14 2011
@@ -261,6 +261,9 @@
          return OO_STKCMD_CONNECTIONERR;
    }
 
+   if (call->h225version < 4)
+      return OO_STKCMD_SUCCESS;
+
    memset(&cmd, 0, sizeof(OOStackCommand));
    cmd.type = OO_CMD_MANUALPROGRESS;
    cmd.param1 = (void*) malloc(strlen(callToken)+1);

Modified: team/may/ooh323_ipv6/addons/ooh323c/src/oochannels.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/oochannels.c?view=diff&rev=307521&r1=307520&r2=307521
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/oochannels.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/oochannels.c Thu Feb 10 14:10:14 2011
@@ -484,15 +484,6 @@
    OOTRACEINFO3("H.245 connection established (%s, %s)\n", 
                 call->callType, call->callToken);
 
-
-   /* Start terminal capability exchange and master slave determination */
-   ret = ooSendTermCapMsg(call);
-   if(ret != OO_OK)
-   {
-      OOTRACEERR3("ERROR:Sending Terminal capability message (%s, %s)\n",
-                   call->callType, call->callToken);
-      return ret;
-   }
    return OO_OK;
 }
 
@@ -1847,6 +1838,8 @@
       }
       else{
          ooCloseH245Connection(call);
+	 if(call->callState < OO_CALL_CLEAR)
+	    call->callState = OO_CALL_CLEAR;
       }
       break;
    case OOCloseLogicalChannel:

Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooh245.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooh245.c?view=diff&rev=307521&r1=307520&r2=307521
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooh245.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooh245.c Thu Feb 10 14:10:14 2011
@@ -2112,14 +2112,12 @@
                }
             }
             ooCloseH245Connection(call);
+	    if (call->callState < OO_CALL_CLEAR)
+	        call->callState = OO_CALL_CLEAR;
          }
          else{
 
             call->h245SessionState = OO_H245SESSION_ENDRECVD;
-#if 0
-            if(call->callState < OO_CALL_CLEAR)
-               call->callState = OO_CALL_CLEAR;
-#else 
             if(call->logicalChans)
             {
                OOTRACEINFO3("In response to received EndSessionCommand - "
@@ -2128,7 +2126,6 @@
                ooClearAllLogicalChannels(call);
             }
             ooSendEndSessionCommand(call);
-#endif
          }
             
             

Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooh323.c?view=diff&rev=307521&r1=307520&r2=307521
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooh323.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooh323.c Thu Feb 10 14:10:14 2011
@@ -40,6 +40,7 @@
 int ooOnReceivedAlerting(OOH323CallData *call, Q931Message *q931Msg);
 int ooOnReceivedProgress(OOH323CallData *call, Q931Message *q931Msg);
 int ooHandleDisplayIE(OOH323CallData *call, Q931Message *q931Msg);
+int ooHandleH2250ID (OOH323CallData *call, H225ProtocolIdentifier protocolIdentifier);
 
 int ooHandleDisplayIE(OOH323CallData *call, Q931Message *q931Msg) {
    Q931InformationElement* pDisplayIE;
@@ -57,6 +58,17 @@
    return OO_OK;
 }
 
+int ooHandleH2250ID (OOH323CallData *call, H225ProtocolIdentifier protocolIdentifier) {
+   if (!call->h225version && (protocolIdentifier.numids >= 6) &&
+	(protocolIdentifier.subid[3] == 2250)) {
+	call->h225version = protocolIdentifier.subid[5];
+	OOTRACEDBGC4("Extract H.225 remote version, it's %d, (%s, %s)\n", call->h225version, 
+						call->callType, call->callToken);
+
+   }
+   return OO_OK;
+}
+
 int ooHandleFastStart(OOH323CallData *call, H225Facility_UUIE *facility)
 {
    H245OpenLogicalChannel* olc;
@@ -241,7 +253,9 @@
        }
       }
    } else if (OO_TESTFLAG (call->flags, OO_M_TUNNELING)) {
-	ret =ooSendTCSandMSD(call);
+	if (call->h225version >= 4) {
+		ret =ooSendTCSandMSD(call);
+	}
 	if (ret != OO_OK)
 		return ret;
    }
@@ -374,6 +388,7 @@
                   "%s\n", call->callType, call->callToken);
       return OO_FAILED;
    }
+   ooHandleH2250ID(call, setup->protocolIdentifier);
    memcpy(call->callIdentifier.guid.data, setup->callIdentifier.guid.data, 
           setup->callIdentifier.guid.numocts);
    call->callIdentifier.guid.numocts = setup->callIdentifier.guid.numocts;
@@ -386,9 +401,9 @@
    pDisplayIE = ooQ931GetIE(q931Msg, Q931DisplayIE);
    if(pDisplayIE)
    {
-      call->remoteDisplayName = (char *) memAlloc(call->pctxt, 
+      call->remoteDisplayName = (char *) memAllocZ(call->pctxt, 
                                  pDisplayIE->length*sizeof(ASN1OCTET)+1);
-      strcpy(call->remoteDisplayName, (char *)pDisplayIE->data);
+      strncpy(call->remoteDisplayName, (char *)pDisplayIE->data, pDisplayIE->length*sizeof(ASN1OCTET));
    }
    /*Extract Remote Aliases, if present*/
    if(setup->m.sourceAddressPresent)
@@ -628,6 +643,7 @@
       return OO_FAILED;
    }
 
+   ooHandleH2250ID(call, callProceeding->protocolIdentifier);
    /* Handle fast-start */
    if(OO_TESTFLAG (call->flags, OO_M_FASTSTART))
    {
@@ -856,6 +872,7 @@
       }
       return OO_FAILED;
    }
+   ooHandleH2250ID(call, alerting->protocolIdentifier);
    /*Handle fast-start */
    if(OO_TESTFLAG (call->flags, OO_M_FASTSTART) &&
       !OO_TESTFLAG(call->flags, OO_M_FASTSTARTANSWERED))
@@ -1006,7 +1023,9 @@
       	OOTRACEINFO3("Tunneling and h245address provided."
                      "Giving preference to Tunneling (%s, %s)\n", 
                    	call->callType, call->callToken);
-	ret =ooSendTCSandMSD(call);
+	if (call->h225version >= 4) {
+		ret =ooSendTCSandMSD(call);
+	}
 	if (ret != OO_OK)
 		return ret;
 
@@ -1048,6 +1067,10 @@
             call->callState = OO_CALL_CLEAR;
          }
          return OO_FAILED;
+       } else {
+	if (call->h225version >= 4) {
+		ret =ooSendTCSandMSD(call);
+	}
        }
       }
    }
@@ -1086,6 +1109,7 @@
       }
       return OO_FAILED;
    }
+   ooHandleH2250ID(call, progress->protocolIdentifier);
    /*Handle fast-start */
    if(OO_TESTFLAG (call->flags, OO_M_FASTSTART) &&
       !OO_TESTFLAG(call->flags, OO_M_FASTSTARTANSWERED))
@@ -1237,7 +1261,9 @@
       	OOTRACEINFO3("Tunneling and h245address provided."
                      "Giving preference to Tunneling (%s, %s)\n", 
                      call->callType, call->callToken);
-	ret =ooSendTCSandMSD(call);
+	if (call->h225version >= 4) {
+		ret =ooSendTCSandMSD(call);
+	}
 	if (ret != OO_OK)
 		return ret;
    } else if(progress->m.h245AddressPresent) {
@@ -1278,6 +1304,10 @@
             call->callState = OO_CALL_CLEAR;
          }
          return OO_FAILED;
+       } else {
+	if (call->h225version >= 4) {
+		ret =ooSendTCSandMSD(call);
+	}
        }
       }
    }
@@ -1323,7 +1353,7 @@
       }
       return OO_FAILED;
    }
-
+   ooHandleH2250ID(call, connect->protocolIdentifier);
    /*Handle fast-start */
    if(OO_TESTFLAG (call->flags, OO_M_FASTSTART) && 
       !OO_TESTFLAG (call->flags, OO_M_FASTSTARTANSWERED))
@@ -1558,24 +1588,24 @@
       OOTRACEDBGB3("Finished tunneled messages in Connect. (%s, %s)\n",
                     call->callType, call->callToken);
 
-      /*
+   }
+   /*
         Send TCS as call established and no capability exchange has yet 
         started. This will be true only when separate h245 connection is not
         established and tunneling is being used.
-      */
-      if(call->localTermCapState == OO_LocalTermCapExchange_Idle)
-      {
-         /*Start terminal capability exchange and master slave determination */
-         ret = ooSendTermCapMsg(call);
-         if(ret != OO_OK)
-         {
-            OOTRACEERR3("ERROR:Sending Terminal capability message (%s, %s)\n",
-                         call->callType, call->callToken);
-            return ret;
-         }
-      }
-
-   }
+   */
+   if(call->localTermCapState == OO_LocalTermCapExchange_Idle)
+   {
+        /*Start terminal capability exchange and master slave determination */
+        ret = ooSendTermCapMsg(call);
+        if(ret != OO_OK)
+        {
+           OOTRACEERR3("ERROR:Sending Terminal capability message (%s, %s)\n",
+                        call->callType, call->callToken);
+           return ret;
+        }
+   }
+
    call->callState = OO_CALL_CONNECTED;
    if (call->rtdrCount > 0 && call->rtdrInterval > 0) {
         return ooSendRoundTripDelayRequest(call);
@@ -1797,6 +1827,9 @@
    H225TransportAddress_ip6Address_ip *ip6 = NULL;
    OOTRACEDBGC3("Received Facility Message.(%s, %s)\n", call->callType, 
                                                         call->callToken);
+
+   ooHandleDisplayIE(call, pQ931Msg);
+
    /* Get Reference to H323_UU_PDU */
    if(!pQ931Msg->userInfo)
    {
@@ -1814,6 +1847,7 @@
    facility = pH323UUPdu->h323_message_body.u.facility;
    if(facility)
    {
+      ooHandleH2250ID(call, facility->protocolIdentifier);
       /* Depending on the reason of facility message handle the message */
       if(facility->reason.t == T_H225FacilityReason_transportedInformation)
       {
@@ -2026,6 +2060,7 @@
      OOTRACEINFO3("INFO: H.245 connection already established with remote"
                   " endpoint (%s, %s)\n", call->callType, call->callToken);
    }
+   ooSendTCSandMSD(call);
    return OO_OK;
 }
 

Modified: team/may/ooh323_ipv6/addons/ooh323c/src/ooq931.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323c/src/ooq931.c?view=diff&rev=307521&r1=307520&r2=307521
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323c/src/ooq931.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323c/src/ooq931.c Thu Feb 10 14:10:14 2011
@@ -55,6 +55,7 @@
    int offset, x;
    int rv = ASN_OK;
    char number[128];
+   char *display = NULL;
    /* OOCTXT *pctxt = &gH323ep.msgctxt; */
    OOCTXT *pctxt = call->msgctxt;
 
@@ -166,9 +167,15 @@
       }
       if(ie->discriminator == Q931DisplayIE)
       {
-         OOTRACEDBGB1("   Display IE = {\n");
-         OOTRACEDBGB2("      %s\n", ie->data);
-         OOTRACEDBGB1("   }\n");
+	 if (!(display = memAllocZ(pctxt, ie->length + 1))) {
+		OOTRACEERR4("Can't alloc DisplayIE buffer for %n bytes, (%s, %s)\n", ie->length,
+				call->callType, call->callToken);
+	 } else {
+            memcpy(display, ie->data,ie->length);
+            OOTRACEDBGB1("   Display IE = {\n");
+            OOTRACEDBGB2("      %s\n", display);
+            OOTRACEDBGB1("   }\n");
+	 }
       }
 
       if(ie->discriminator == Q931KeypadIE)
@@ -1453,7 +1460,9 @@
       OOTRACEERR3("Error: Failed to enqueue Alerting message to outbound queue. (%s, %s)\n", call->callType, call->callToken);
    }
 
-   ooSendTCSandMSD(call);
+   if (call->h225version >= 4) {
+	ooSendTCSandMSD(call);
+   }
    memReset (call->msgctxt);
 
    return ret;
@@ -1609,7 +1618,9 @@
    if (!OO_TESTFLAG(call->flags, OO_M_TUNNELING) && call->h245listener)
       ooSendStartH245Facility(call);
 
-   ooSendTCSandMSD(call);
+   if (call->h225version >= 4) {
+	ooSendTCSandMSD(call);
+   }
    memReset (call->msgctxt);
 
    return ret;
@@ -1996,12 +2007,16 @@
    }
 
 
-   /* Add h245 listener address. Do not add H245 listener address in case
-      of fast-start. */
+   /* Add h245 listener address. */
+   /* Do not add H245 listener address in case
+      of fast-start. why? */
+   /* May 20110205 */
+   /* Send h245 listener addr any case if H245 connection isn't established */
    if (/* (!OO_TESTFLAG(call->flags, OO_M_FASTSTART) || 
         call->remoteFastStartOLCs.count == 0) && */
        !OO_TESTFLAG (call->flags, OO_M_TUNNELING) &&
-       !call->h245listener && ooCreateH245Listener(call) == OO_OK)
+       ( (!call->h245listener && ooCreateH245Listener(call) == OO_OK) ||
+         !call->pH245Channel))
    {
       connect->m.h245AddressPresent = TRUE;
       if (call->versionIP == 6) {
@@ -2053,6 +2068,7 @@
       return OO_FAILED;
    }
    /* memReset(&gH323ep.msgctxt); */
+   ooSendTCSandMSD(call);
    memReset(call->msgctxt);
 
    call->callState = OO_CALL_CONNECTED;
@@ -2827,11 +2843,8 @@
 
    /* For H.323 version 4 and higher, if fast connect, tunneling should be 
       supported.
+      why?
    */
-   if(OO_TESTFLAG(call->flags, OO_M_FASTSTART)) {
-      q931msg->userInfo->h323_uu_pdu.h245Tunneling = TRUE;
-      OO_SETFLAG(call->flags, OO_M_TUNNELING);
-   }
 
    OOTRACEDBGA3("Built SETUP message (%s, %s)\n", call->callType, 
                  call->callToken);




More information about the asterisk-commits mailing list