]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix to resend GRQ/RRQ if RRJ (registration reject) is received
authorAlexandr Anikin <may@telecom-service.ru>
Thu, 9 Aug 2012 18:58:08 +0000 (18:58 +0000)
committerAlexandr Anikin <may@telecom-service.ru>
Thu, 9 Aug 2012 18:58:08 +0000 (18:58 +0000)
(close issue ASTERISK-20094)

Patches:
   ASTERISK-20094.patch

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

addons/ooh323c/src/ooGkClient.c

index 3abf4e445ba48ef752cac856b8d4ea2528a60b15..fde3bc355422555d1b94a0ea766bfbc22cb64fe3 100644 (file)
@@ -809,6 +809,9 @@ int ooGkClientHandleGatekeeperConfirm
    if(pGatekeeperConfirm->m.gatekeeperIdentifierPresent) 
    {
       pGkClient->gkId.nchars = pGatekeeperConfirm->gatekeeperIdentifier.nchars;
+      if (pGkClient->gkId.data) {
+         memFreePtr(&pGkClient->ctxt, pGkClient->gkId.data);
+      }
       pGkClient->gkId.data = (ASN116BITCHAR*)memAlloc(&pGkClient->ctxt,
                               sizeof(ASN116BITCHAR)*pGkClient->gkId.nchars);
       if(!pGkClient->gkId.data)
@@ -1368,7 +1371,20 @@ int ooGkClientHandleRegistrationReject
    default:
       OOTRACEINFO1("RRQ Rejected - Invalid Reason\n");
    }
-   pGkClient->state = GkClientGkErr;
+
+   /* send again GRQ/RRQ's */
+   ast_mutex_lock(&pGkClient->Lock);
+   pGkClient->state = GkClientUnregistered;
+   pGkClient->rrqRetries = 0;
+   pGkClient->grqRetries = 0;
+   pGkClient->discoveryComplete = FALSE;
+   ast_mutex_unlock(&pGkClient->Lock);
+
+   iRet = ooGkClientSendGRQ(pGkClient);
+   if(iRet != OO_OK){
+      OOTRACEERR1("\nError: Transmission of rediscovery of GK failed\n");
+      return OO_FAILED;
+   }
    return OO_OK;
 }