[asterisk-commits] may: branch may/chan_ooh323_rework r209665 - /team/may/chan_ooh323_rework/add...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 31 08:47:43 CDT 2009


Author: may
Date: Fri Jul 31 08:47:32 2009
New Revision: 209665

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=209665
Log:
correct synchronisation between main stack thread and call thread in
processing gatekeeper request/reply
faststartrespone is sent one time per call only

Modified:
    team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.c
    team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.h
    team/may/chan_ooh323_rework/addons/ooh323c/src/ooh323.c
    team/may/chan_ooh323_rework/addons/ooh323c/src/ooq931.c

Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.c?view=diff&rev=209665&r1=209664&r2=209665
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.c (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.c Fri Jul 31 08:47:32 2009
@@ -98,6 +98,8 @@
 
    if (OO_TESTFLAG(gH323ep.flags, OO_M_MEDIAWAITFORCONN))
       OO_SETFLAG (call->flags, OO_M_MEDIAWAITFORCONN);
+
+   call->fsSent = FALSE;
 
 // May 20090713. Fix it for Video session
 

Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.h?view=diff&rev=209665&r1=209664&r2=209665
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.h (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooCalls.h Fri Jul 31 08:47:32 2009
@@ -146,6 +146,7 @@
    sem_t		gkWait;
    ast_mutex_t		Lock;
    OOBOOL 		Monitor;
+   OOBOOL		fsSent;
    OOSOCKET		CmdChan;
    OOSOCKET		cmdSock;
    void*		CmdChanLock;

Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooh323.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooh323.c?view=diff&rev=209665&r1=209664&r2=209665
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooh323.c (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooh323.c Fri Jul 31 08:47:32 2009
@@ -1321,7 +1321,6 @@
    OOTimer *pTimer=NULL;
    int type = q931Msg->messageType;
    struct timespec ts;
-   int gkWaits;
    switch(type)
    {
       case Q931SetupMsg: /* SETUP message is received */
@@ -1353,13 +1352,11 @@
 	       // ast_mutex_lock(&call->Lock);
                ret = ooGkClientSendAdmissionRequest(gH323ep.gkClient, call, 
                                                     FALSE);
-               for (gkWaits = 0; gkWaits < 1000; gkWaits++) {
-                 clock_gettime(CLOCK_REALTIME, &ts);
-                 ts.tv_nsec += 24000000;
-                 sem_timedwait(&call->gkWait, &ts);
-                 if (call->callState != OO_CALL_WAITING_ADMISSION)
-			break;
-               }
+                clock_gettime(CLOCK_REALTIME, &ts);
+                ts.tv_sec += 24;
+                sem_timedwait(&call->gkWait, &ts);
+                if (call->callState == OO_CALL_WAITING_ADMISSION)
+			call->callState = OO_CALL_CLEAR;
                // ast_mutex_unlock(&call->Lock);
 
             }

Modified: team/may/chan_ooh323_rework/addons/ooh323c/src/ooq931.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/may/chan_ooh323_rework/addons/ooh323c/src/ooq931.c?view=diff&rev=209665&r1=209664&r2=209665
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323c/src/ooq931.c (original)
+++ team/may/chan_ooh323_rework/addons/ooh323c/src/ooq931.c Fri Jul 31 08:47:32 2009
@@ -871,16 +871,6 @@
          (*fsElem)[k].data = pData;
       }
 
-      /* free the stored fast start response */
-      if(pQ931msg->messageType == Q931ConnectMsg) {
-         for(k = 0; k < pCall->pFastStartRes->n; k ++) {
-            memFreePtr(pCall->pctxt, pCall->pFastStartRes->elem[k].data);
-         }
-         memFreePtr(pCall->pctxt, pCall->pFastStartRes->elem);
-         memFreePtr(pCall->pctxt, pCall->pFastStartRes);
-         pCall->pFastStartRes = NULL;
-      }
-
       return ASN_OK;
    }
    
@@ -1415,13 +1405,16 @@
    vendor->vendor.t35Extension = gH323ep.t35Extension;
    vendor->vendor.manufacturerCode = gH323ep.manufacturerCode;
    
-   ret = ooSetFastStartResponse(call, q931msg, 
-      &alerting->fastStart.n, &alerting->fastStart.elem);
-   if(ret != ASN_OK) { return ret; }
-   if(alerting->fastStart.n > 0) {
-      alerting->m.fastStartPresent = TRUE;
-   }
-   else {
+   if (!call->fsSent) {
+    ret = ooSetFastStartResponse(call, q931msg, 
+       &alerting->fastStart.n, &alerting->fastStart.elem);
+    if(ret != ASN_OK) { return ret; }
+    if(alerting->fastStart.n > 0) {
+       alerting->m.fastStartPresent = TRUE;
+       call->fsSent = TRUE;
+    } else
+      alerting->m.fastStartPresent = FALSE;
+   } else {
       alerting->m.fastStartPresent = FALSE;
    }
 
@@ -1522,17 +1515,19 @@
    vendor->vendor.t35Extension = gH323ep.t35Extension;
    vendor->vendor.manufacturerCode = gH323ep.manufacturerCode;
    
-   ret = ooSetFastStartResponse(call, q931msg, 
-      &progress->fastStart.n, &progress->fastStart.elem);
-   if(ret != ASN_OK) { return ret; }
-   if(progress->fastStart.n > 0) {
-      progress->m.fastStartPresent = TRUE;
-   }
-   else {
+   if (!call->fsSent) {
+    ret = ooSetFastStartResponse(call, q931msg, 
+       &progress->fastStart.n, &progress->fastStart.elem);
+    if(ret != ASN_OK) { return ret; }
+    if(progress->fastStart.n > 0) {
+       progress->m.fastStartPresent = TRUE;
+       call->fsSent = TRUE;
+    } else
       progress->m.fastStartPresent = FALSE;
-   }
-
-   OOTRACEDBGA3("Built Alerting (%s, %s)\n", call->callType, call->callToken);
+   } else {
+      progress->m.fastStartPresent = FALSE;
+   }
+   OOTRACEDBGA3("Built Progress (%s, %s)\n", call->callType, call->callToken);
    
    ret = ooSendH225Msg(call, q931msg);
    if(ret != OO_OK)
@@ -1868,15 +1863,30 @@
                                                    vendor->versionId.numocts); 
    }
 
-   ret = ooSetFastStartResponse(call, q931msg, 
-      &connect->fastStart.n, &connect->fastStart.elem);
-   if(ret != ASN_OK) { return ret; }
-   if(connect->fastStart.n > 0) {
-      connect->m.fastStartPresent = TRUE;
-   }
-   else {
+   if (!call->fsSent) {
+    ret = ooSetFastStartResponse(call, q931msg, 
+       &connect->fastStart.n, &connect->fastStart.elem);
+    if(ret != ASN_OK) { return ret; }
+    if(connect->fastStart.n > 0) {
+       connect->m.fastStartPresent = TRUE;
+       call->fsSent = TRUE;
+    } else
       connect->m.fastStartPresent = FALSE;
-   }
+   } else {
+      connect->m.fastStartPresent = FALSE;
+   }
+
+   /* free the stored fast start response */
+   if(call->pFastStartRes) {
+      int k;
+      for(k = 0; k < call->pFastStartRes->n; k ++) {
+         memFreePtr(call->pctxt, call->pFastStartRes->elem[k].data);
+      }
+      memFreePtr(call->pctxt, call->pFastStartRes->elem);
+      memFreePtr(call->pctxt, call->pFastStartRes);
+      call->pFastStartRes = NULL;
+   }
+
 
    /* Add h245 listener address. Do not add H245 listener address in case
       of fast-start. */
@@ -2047,7 +2057,6 @@
    char tmp[30]="\0";
    char *ip=NULL, *port = NULL;
    struct timespec ts;
-   int gkWaits;
 
    if(!dest)
    {
@@ -2128,13 +2137,11 @@
      call->callState = OO_CALL_WAITING_ADMISSION;
      // ast_mutex_lock(&call->Lock);
      ret = ooGkClientSendAdmissionRequest(gH323ep.gkClient, call, FALSE);
-     for (gkWaits = 0; gkWaits < 1000; gkWaits++) {
-       clock_gettime(CLOCK_REALTIME, &ts);
-       ts.tv_nsec += 24000000;
-       sem_timedwait(&call->gkWait, &ts);
-       if (call->callState != OO_CALL_WAITING_ADMISSION)
-                        break;
-     }
+     clock_gettime(CLOCK_REALTIME, &ts);
+     ts.tv_sec += 24;
+     sem_timedwait(&call->gkWait, &ts);
+     if (call->callState == OO_CALL_WAITING_ADMISSION)
+		call->callState = OO_CALL_CLEAR;
      // ast_mutex_unlock(&call->Lock);
 
    }




More information about the asterisk-commits mailing list