Send re-register packets by GRQ (gatekeeper request) interval
authorAlexandr Anikin <may@telecom-service.ru>
Fri, 10 Aug 2012 15:24:03 +0000 (15:24 +0000)
committerAlexandr Anikin <may@telecom-service.ru>
Fri, 10 Aug 2012 15:24:03 +0000 (15:24 +0000)
(close issue ASTERISK-20094)

Patches:
   ASTERISK-20094-2.patch
........

Merged revisions 371060 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 371061 from http://svn.asterisk.org/svn/asterisk/branches/10

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

addons/ooh323c/src/ooGkClient.c

index e149aba..3aaaba7 100644 (file)
@@ -1285,6 +1285,8 @@ int ooGkClientHandleRegistrationReject
    unsigned int x=0;
    DListNode *pNode = NULL;
    OOTimer *pTimer = NULL;
+   ooGkClientTimerCb *cbData=NULL;
+
    /* First delete the corresponding RRQ timer */
    for(x=0; x<pGkClient->timerList.count; x++)
    {
@@ -1381,14 +1383,33 @@ int ooGkClientHandleRegistrationReject
    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");
+   cbData = (ooGkClientTimerCb*) memAlloc
+                               (&pGkClient->ctxt, sizeof(ooGkClientTimerCb));
+   if(!cbData)
+   {
+      OOTRACEERR1("Error:Failed to allocate memory to GRQ timer callback\n");
+      pGkClient->state = GkClientFailed;
+      ast_mutex_unlock(&pGkClient->Lock);
       return OO_FAILED;
    }
+   cbData->timerType = OO_GRQ_TIMER;
+   cbData->pGkClient = pGkClient;
+   if(!ooTimerCreate(&pGkClient->ctxt, &pGkClient->timerList,
+                     &ooGkClientGRQTimerExpired, pGkClient->grqTimeout,
+                     cbData, FALSE))
+   {
+      OOTRACEERR1("Error:Unable to create GRQ timer.\n ");
+      memFreePtr(&pGkClient->ctxt, cbData);
+      pGkClient->state = GkClientFailed;
+      ast_mutex_unlock(&pGkClient->Lock);
+      return OO_FAILED;
+   }
+
+   ast_mutex_unlock(&pGkClient->Lock);
+
    return OO_OK;
+
 }