]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
process stack command even if gatekeeper client isn't register
authorAlexandr Anikin <may@telecom-service.ru>
Fri, 28 Mar 2014 18:00:18 +0000 (18:00 +0000)
committerAlexandr Anikin <may@telecom-service.ru>
Fri, 28 Mar 2014 18:00:18 +0000 (18:00 +0000)
don't destroy gatekeeper client if it is not started
don't destroy gatekeeper client in some sort of gatekeeper errors
signal rtp create condition when call cleared before rtp structure created

(closes issue ASTERISK-23460)

Reported by: Dmitry Melekhov
Patches:
ASTERISK-23460-2.patch

Tested by: Dmitry Melekhov
........

Merged revisions 411531 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 411532 from http://svn.asterisk.org/svn/asterisk/branches/12

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411533 65c4cc65-6c06-0410-ace0-fbb531ad65f3

addons/chan_ooh323.c
addons/ooh323c/src/ooCmdChannel.c
addons/ooh323c/src/ooGkClient.c
addons/ooh323c/src/oochannels.c
addons/ooh323c/src/ooh323.c
addons/ooh323c/src/ooq931.c

index bf465e20e60954c474109352e81bf746dbab68f9..fd22cd49717a225b22b29783858f9baaec066cb9 100644 (file)
@@ -2204,6 +2204,10 @@ int onCallCleared(ooCallData *call)
                ast_module_unref(myself);
        }
 
+       if (!p->rtp) {
+               ast_cond_signal(&p->rtpcond);
+       }
+
        ast_set_flag(p, H323_NEEDDESTROY);
 
        ooh323c_stop_call_thread(call);
index 245fba5b9df4024252d99b24ac91eeff1bcf4012..50a75c2cf28465ccabbb9861cb6925fa47381da2 100644 (file)
@@ -172,11 +172,6 @@ int ooReadAndProcessStackCommand()
       if(cmd.type == OO_CMD_NOOP)
          continue;
 
-      if(gH323ep.gkClient && gH323ep.gkClient->state != GkClientRegistered && cmd.type != OO_CMD_STOPMONITOR)
-      {
-         OOTRACEINFO1("Ignoring stack command as Gk Client is not registered"
-                      " yet\n");
-      }
       else {
          switch(cmd.type) {
             case OO_CMD_MAKECALL: 
@@ -336,11 +331,6 @@ int ooReadAndProcessCallStackCommand(OOH323CallData* call)
       if(cmd.type == OO_CMD_NOOP)
          continue;
 
-      if(gH323ep.gkClient && gH323ep.gkClient->state != GkClientRegistered)
-      {
-         OOTRACEINFO1("Ignoring stack command as Gk Client is not registered"
-                      " yet\n");
-      }
       else {
          switch(cmd.type) {
             case OO_CMD_MAKECALL: 
index af6a10bbd37c30dfbb3e682fd9cc84c52bb0d6b7..c090796b66790425560ab07c6487ca58314c1274 100644 (file)
@@ -210,7 +210,7 @@ int ooGkClientStart(ooGkClient *pGkClient)
    if(iRet != OO_OK)
    {
       OOTRACEERR1("Error:Failed to send GRQ message\n");
-      pGkClient->state = GkClientFailed;
+      pGkClient->state = GkClientGkErr;
       ast_mutex_unlock(&pGkClient->Lock);
       return OO_FAILED;
    }
@@ -433,7 +433,7 @@ int ooGkClientReceive(ooGkClient *pGkClient)
       if(iRet != OO_OK)
       {
          OOTRACEERR1("Error: Failed to handle received RAS message\n");
-         pGkClient->state = GkClientFailed;
+         pGkClient->state = GkClientGkErr;
       }
       memReset(pctxt);
    }
@@ -702,7 +702,7 @@ int ooGkClientSendGRQ(ooGkClient *pGkClient)
    {
       OOTRACEERR1("Error: Failed to send GRQ message\n");
       memReset(&pGkClient->msgCtxt);
-      pGkClient->state = GkClientFailed;
+      pGkClient->state = GkClientGkErr;
       ast_mutex_unlock(&pGkClient->Lock);
       return OO_FAILED;
    }
@@ -1530,7 +1530,7 @@ int ooGkClientSendURQ(ooGkClient *pGkClient, ooAliases *aliases)
    {
       OOTRACEERR1("Error:Failed to send UnregistrationRequest message\n");
       memReset(pctxt);
-      pGkClient->state = GkClientFailed;
+      pGkClient->state = GkClientGkErr;
       ast_mutex_unlock(&pGkClient->Lock);
       return OO_FAILED;
    }
@@ -1909,7 +1909,7 @@ int ooGkClientSendAdmissionRequest
    {
       OOTRACEERR1("Error:Failed to send AdmissionRequest message\n");
       memReset(pctxt);
-      pGkClient->state = GkClientFailed;
+      pGkClient->state = GkClientGkErr;
       ast_mutex_unlock(&pGkClient->Lock);
       return OO_FAILED;
    }
@@ -2423,7 +2423,7 @@ int ooGkClientSendIRR
    {
       OOTRACEERR1("Error:Failed to send IRR message\n");
       memReset(pctxt);
-      pGkClient->state = GkClientFailed;
+      pGkClient->state = GkClientGkErr;
       ast_mutex_unlock(&pGkClient->Lock);
       return OO_FAILED;
    }
@@ -2576,7 +2576,7 @@ int ooGkClientSendDisengageRequest(ooGkClient *pGkClient, OOH323CallData *call)
    if(iRet != OO_OK)
    {
       OOTRACEERR1("Error: Failed to send DRQ message\n");
-      pGkClient->state = GkClientFailed;
+      pGkClient->state = GkClientGkErr;
    }
    
 
@@ -2736,7 +2736,7 @@ int ooGkClientREGTimerExpired(void *pdata)
    if(ret != OO_OK)
    {
       OOTRACEERR1("Error:Failed to send Additive RRQ message\n");
-      pGkClient->state = GkClientFailed;
+      pGkClient->state = GkClientGkErr;
       return OO_FAILED;
    }
    return OO_OK;
index de85389100985e3bb72f4f9ae1f79f553ad5b0e3..ddc6bf622a37739c048664677a8409336b921f1f 100644 (file)
@@ -822,7 +822,8 @@ int ooMonitorChannels()
       if(OO_OK != ooGkClientStart(gH323ep.gkClient))
       {
          OOTRACEERR1("Error:Failed to start Gatekeeper client\n");
-         ooGkClientDestroy();
+        // not need more, now it can be restarted correctly
+         // ooGkClientDestroy();
       }
    }
    
index d91c64942c7b9191d254bddbdf7beb69b9e19f59..b04a954edffa9967f55a892ceb1c987b33c44ac0 100644 (file)
@@ -1719,12 +1719,12 @@ int ooHandleH2250Message(OOH323CallData *call, Q931Message *q931Msg)
             if(gH323ep.gkClient->state == GkClientRegistered)
             {
                call->callState = OO_CALL_WAITING_ADMISSION;
+               ast_mutex_lock(&call->GkLock);
                ret = ooGkClientSendAdmissionRequest(gH323ep.gkClient, call, 
                                                     FALSE);
                tv = ast_tvnow();
                 ts.tv_sec = tv.tv_sec + 24;
                ts.tv_nsec = tv.tv_usec * 1000;
-               ast_mutex_lock(&call->GkLock);
                if (call->callState == OO_CALL_WAITING_ADMISSION)
                    ast_cond_timedwait(&call->gkWait, &call->GkLock, &ts);
                 if (call->callState == OO_CALL_WAITING_ADMISSION)
index 69d1414a0d8ac517a9dd358aec88df177e577cb8..a6bdea431b449a9333f74ff1b317280d9e182a93 100644 (file)
@@ -2604,11 +2604,11 @@ int ooH323MakeCall(char *dest, char *callToken, ooCallOptions *opts)
    {
      if(gH323ep.gkClient->state == GkClientRegistered) {
        call->callState = OO_CALL_WAITING_ADMISSION;
+       ast_mutex_lock(&call->GkLock);
        ret = ooGkClientSendAdmissionRequest(gH323ep.gkClient, call, FALSE);
        tv = ast_tvnow();
        ts.tv_sec = tv.tv_sec + 24;
        ts.tv_nsec = tv.tv_usec * 1000;
-       ast_mutex_lock(&call->GkLock);
        if (call->callState == OO_CALL_WAITING_ADMISSION)
           ast_cond_timedwait(&call->gkWait, &call->GkLock, &ts);
        if (call->callState == OO_CALL_WAITING_ADMISSION)