[asterisk-commits] may: branch may/ooh323_ipv6_direct_rtp r302004 - /team/may/ooh323_ipv6_direct...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Jan 15 16:20:46 CST 2011


Author: may
Date: Sat Jan 15 16:20:40 2011
New Revision: 302004

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=302004
Log:
more correctly renegotiation logical channels procedure
send empty tcs, then close our transmit channels
(opposite side request close receive channels after receiving empty tcs)
after closing all channels restart tcs exchange proc and
reopen media channels

Modified:
    team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooCalls.h
    team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooLogChan.c
    team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooLogChan.h
    team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh245.c
    team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh245.h

Modified: team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooCalls.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooCalls.h?view=diff&rev=302004&r1=302003&r2=302004
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooCalls.h (original)
+++ team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooCalls.h Sat Jan 15 16:20:40 2011
@@ -197,6 +197,7 @@
    ASN1UINT             statusDeterminationNumber;
    OOCapExchangeState   localTermCapState;
    OOCapExchangeState   remoteTermCapState;
+   OOBOOL		TCSPending;
    struct ooH323EpCapability* ourCaps;
    struct ooH323EpCapability* remoteCaps; /* TODO: once we start using jointCaps, get rid of remoteCaps*/
    struct ooH323EpCapability* jointCaps;

Modified: team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooLogChan.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooLogChan.c?view=diff&rev=302004&r1=302003&r2=302004
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooLogChan.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooLogChan.c Sat Jan 15 16:20:40 2011
@@ -255,6 +255,26 @@
    return NULL;
 }
 
+
+OOLogicalChannel* ooGetReceiveLogicalChannel
+   (OOH323CallData *call)
+{
+   OOLogicalChannel * pChannel = NULL;
+   pChannel = call->logicalChans;
+   while(pChannel)
+   {
+      OOTRACEINFO6("Listing logical channel %d cap %d state %d for (%s, %s)\n",
+		pChannel->channelNo, pChannel->chanCap->cap, pChannel->state, 
+		call->callType, call->callToken);
+      if(!strcmp(pChannel->dir, "receive") && pChannel->state != OO_LOGICALCHAN_IDLE &&
+					       pChannel->state != OO_LOGICALCHAN_PROPOSEDFS)
+         return pChannel;
+      else
+         pChannel = pChannel->next;
+   }
+   return NULL;
+}
+
 int ooClearAllLogicalChannels(OOH323CallData *call)
 {
    OOLogicalChannel * temp = NULL, *prev = NULL;

Modified: team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooLogChan.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooLogChan.h?view=diff&rev=302004&r1=302003&r2=302004
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooLogChan.h (original)
+++ team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooLogChan.h Sat Jan 15 16:20:40 2011
@@ -42,7 +42,8 @@
    OO_LOGICALCHAN_IDLE, 
    OO_LOGICALCHAN_PROPOSED, 
    OO_LOGICALCHAN_ESTABLISHED,
-   OO_LOGICALCHAN_PROPOSEDFS
+   OO_LOGICALCHAN_PROPOSEDFS,
+   OO_LOGICALCHAN_CLOSEPENDING
 } OOLogicalChannelState;
 
 /**
@@ -181,6 +182,7 @@
 (struct OOH323CallData* call, int sessionID, char *dir, H245DataType* dataType);
 
 EXTERN OOLogicalChannel* ooGetTransmitLogicalChannel(struct OOH323CallData *call);
+EXTERN OOLogicalChannel* ooGetReceiveLogicalChannel(struct OOH323CallData *call);
 
 /** 
  * @} 

Modified: team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh245.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh245.c?view=diff&rev=302004&r1=302003&r2=302004
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh245.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh245.c Sat Jan 15 16:20:40 2011
@@ -812,6 +812,61 @@
       call->localTermCapState = OO_LocalTermCapSetSent;
    }
 
+   ooFreeH245Message(call,ph245msg);
+
+   return ret;
+}
+int ooSendEmptyTermCapMsg(OOH323CallData *call)
+{
+   int ret;
+   H245RequestMessage *request=NULL;
+   OOCTXT *pctxt=NULL;
+   H245TerminalCapabilitySet *termCap=NULL;
+   H245Message *ph245msg=NULL;
+
+   ret = ooCreateH245Message(call, &ph245msg,  
+                             T_H245MultimediaSystemControlMessage_request);
+ 
+   if(ret == OO_FAILED)
+   {
+      OOTRACEERR3("Error:Failed to create H245 message for Terminal "
+                  "CapabilitySet (%s, %s)\n", call->callType,call->callToken);
+      return OO_FAILED;
+   }
+
+  /* Set request type as TerminalCapabilitySet */
+   request = ph245msg->h245Msg.u.request;
+   pctxt = call->msgctxt;
+   ph245msg->msgType = OOTerminalCapabilitySet;
+   memset(request, 0, sizeof(H245RequestMessage));
+   if(request == NULL)
+   {
+      OOTRACEERR3("ERROR: No memory allocated for request message (%s, %s)\n",
+                   call->callType, call->callToken);
+      return OO_FAILED;
+   }
+   
+   request->t = T_H245RequestMessage_terminalCapabilitySet;
+   request->u.terminalCapabilitySet = (H245TerminalCapabilitySet*)
+                  memAlloc(pctxt, sizeof(H245TerminalCapabilitySet)); 
+   termCap = request->u.terminalCapabilitySet;
+   memset(termCap, 0, sizeof(H245TerminalCapabilitySet));
+   termCap->m.multiplexCapabilityPresent = 0;
+   termCap->m.capabilityTablePresent = 0;
+   termCap->m.capabilityDescriptorsPresent = 0;
+   termCap->sequenceNumber = ++(call->localTermCapSeqNo);  
+   termCap->protocolIdentifier = gh245ProtocolID; /* protocol id */
+
+   /* dListInit(&(termCap->capabilityDescriptors)); */
+
+   OOTRACEDBGA3("Built empty terminal capability set message (%s, %s)\n", 
+                 call->callType, call->callToken);
+   ret = ooSendH245Msg(call, ph245msg);
+   if(ret != OO_OK)
+   {
+      OOTRACEERR3("Error:Failed to enqueue empty TCS message to outbound queue. "
+                  "(%s, %s)\n", call->callType, call->callToken);
+   }
    ooFreeH245Message(call,ph245msg);
 
    return ret;
@@ -2223,6 +2278,8 @@
       lIP = call->localIP;
    }
 
+   ooSendEmptyTermCapMsg(call);
+
 /* close all log chans */
 
    temp = call->logicalChans;
@@ -2234,9 +2291,9 @@
          {
             ooSendCloseLogicalChannel(call, temp);
          }
-         else{
+         /* else{
             ooSendRequestCloseLogicalChannel(call, temp);
-         }
+         } */
       }
       temp = temp->next;
    }
@@ -2256,10 +2313,12 @@
       }
    }
 
+   call->TCSPending = TRUE;
+
 /* Restart TCS exchange proc - Paul Cadah do it in chan_h323_exts native bridge code */
-
-   call->localTermCapState = OO_LocalTermCapExchange_Idle;
-   ooSendTermCapMsg(call);
+/* We must do it after all log channels are closed */
+   /* call->localTermCapState = OO_LocalTermCapExchange_Idle;
+   ooSendTermCapMsg(call); */
 
    return OO_OK;
 }
@@ -2327,6 +2386,7 @@
          clc->forwardLogicalChannelNumber, call->callType, call->callToken);
       return OO_FAILED;
    } */
+   logicalChan->state = OO_LOGICALCHAN_CLOSEPENDING;
    if(error) return OO_FAILED;
    return ret;
 }
@@ -2505,15 +2565,16 @@
 
    ooFreeH245Message(call, ph245msg);
    
-   /* Send Close Logical Channel*/
-   ret = ooSendCloseLogicalChannel(call, lChannel);
-   if(ret != OO_OK)
-   {
+   /* Send Close Logical Channel if LogChan is established */
+   if (lChannel->state == OO_LOGICALCHAN_ESTABLISHED) {
+     ret = ooSendCloseLogicalChannel(call, lChannel);
+     if(ret != OO_OK)
+     {
       OOTRACEERR3("ERROR:Failed to build CloseLgicalChannel message(%s, %s)\n",
                    call->callType, call->callToken);
       return OO_FAILED;
-   }
-
+     }
+   }
    if(error) return OO_FAILED;
 
    return ret;
@@ -2846,7 +2907,13 @@
                   call->callType, call->callToken);
                if (ooOnReceivedCloseLogicalChannel(call, 
                                                request->u.closeLogicalChannel) == OO_OK) {
+		if (call->TCSPending && !ooGetTransmitLogicalChannel(call)) {
+			call->TCSPending = FALSE;
+   			call->localTermCapState = OO_LocalTermCapExchange_Idle;
+   			ooSendTermCapMsg(call);
+		} else if (!call->TCSPending) {
 			ooCloseAllLogicalChannels(call, NULL);
+		}
 	       }
                break;
             case T_H245RequestMessage_requestChannelClose:
@@ -3036,7 +3103,11 @@
                }
                ooOnReceivedCloseChannelAck(call, 
                                            response->u.closeLogicalChannelAck);
-		if(!ooGetTransmitLogicalChannel(call))
+	       if(call->TCSPending && !ooGetReceiveLogicalChannel(call)) {
+			call->TCSPending = FALSE;
+   			call->localTermCapState = OO_LocalTermCapExchange_Idle;
+   			ooSendTermCapMsg(call);
+	       } else if(!ooGetTransmitLogicalChannel(call))
 			ooOpenLogicalChannels(call);
                break;
             case T_H245ResponseMessage_requestChannelCloseAck:
@@ -3059,8 +3130,9 @@
                      break;
                   }
                 }
-                ooOnReceivedRequestChannelCloseAck(call, 
-                                             response->u.requestChannelCloseAck);
+		/* Do nothing by receive reqChanCloseAck */
+                /* ooOnReceivedRequestChannelCloseAck(call, 
+                                             response->u.requestChannelCloseAck); */
                 break;
             case T_H245ResponseMessage_requestChannelCloseReject:
                OOTRACEINFO4("RequestChannelCloseReject received - %d (%s, %s)\n",

Modified: team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh245.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh245.h?view=diff&rev=302004&r1=302003&r2=302004
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh245.h (original)
+++ team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh245.h Sat Jan 15 16:20:40 2011
@@ -116,6 +116,7 @@
  * @return          OO_OK, on success. OO_FAILED, on failure.  
  */
 EXTERN int ooSendTermCapMsg(struct OOH323CallData *call);
+EXTERN int ooSendEmptyTermCapMsg(struct OOH323CallData *call);
 
 /**
  * This function is used to generate a random status determination number




More information about the asterisk-commits mailing list