--- ./channels/ooh323c/src/oochannels.c 2009-07-29 03:07:43.000000000 +0400 +++ ../../asterisk-addons-1.6.1.0/./channels/ooh323c/src/oochannels.c 2009-07-31 00:30:57.000000000 +0400 @@ -959,7 +959,7 @@ ast_mutex_lock(&call->Lock); ast_mutex_unlock(&call->Lock); ast_mutex_destroy(&call->Lock); - ast_cond_destroy(&call->gkWait); + sem_destroy(&call->gkWait); pctxt = call->pctxt; freeContext(pctxt); free(pctxt); --- ./channels/ooh323c/src/ooCalls.c 2009-07-31 00:34:27.000000000 +0400 +++ ../../asterisk-addons-1.6.1.0/./channels/ooh323c/src/ooCalls.c 2009-07-31 00:30:57.000000000 +0400 @@ -62,7 +62,7 @@ return NULL; } memset(call, 0, sizeof(OOH323CallData)); - ast_cond_init(&call->gkWait, NULL); + sem_init(&call->gkWait, 0, 0); ast_mutex_init(&call->Lock); call->pctxt = pctxt; call->msgctxt = msgctxt; --- ./channels/ooh323c/src/ooCommon.h 2008-02-07 23:59:47.000000000 +0300 +++ ../../asterisk-addons-1.6.1.0/./channels/ooh323c/src/ooCommon.h 2009-07-31 00:30:57.000000000 +0400 @@ -41,6 +41,7 @@ #include #include #endif +#include /** * @ingroup cruntime C Runtime Common Constant and Type Definitions. --- ./channels/ooh323c/src/ooh323.c 2009-07-31 00:34:27.000000000 +0400 +++ ../../asterisk-addons-1.6.1.0/./channels/ooh323c/src/ooh323.c 2009-07-31 00:30:57.000000000 +0400 @@ -1322,7 +1322,6 @@ int type = q931Msg->messageType; struct timespec ts; int gkWaits; - ast_mutex_t gmutex; switch(type) { case Q931SetupMsg: /* SETUP message is received */ @@ -1354,17 +1353,13 @@ // ast_mutex_lock(&call->Lock); ret = ooGkClientSendAdmissionRequest(gH323ep.gkClient, call, FALSE); - ast_mutex_init(&gmutex); for (gkWaits = 0; gkWaits < 1000; gkWaits++) { clock_gettime(CLOCK_REALTIME, &ts); ts.tv_nsec += 24000000; - ast_mutex_lock(&gmutex); - ast_cond_timedwait(&call->gkWait, &gmutex, &ts); - ast_mutex_unlock(&gmutex); + sem_timedwait(&call->gkWait, &ts); if (call->callState != OO_CALL_WAITING_ADMISSION) break; } - ast_mutex_destroy(&gmutex); // ast_mutex_unlock(&call->Lock); } --- ./channels/ooh323c/src/ooCalls.h 2009-07-31 00:34:27.000000000 +0400 +++ ../../asterisk-addons-1.6.1.0/./channels/ooh323c/src/ooCalls.h 2009-07-31 00:30:57.000000000 +0400 @@ -143,7 +143,7 @@ OOCTXT *pctxt; OOCTXT *msgctxt; pthread_t callThread; - ast_cond_t gkWait; + sem_t gkWait; ast_mutex_t Lock; OOBOOL Monitor; OOSOCKET CmdChan; --- ./channels/ooh323c/src/ooq931.c 2009-07-31 00:34:27.000000000 +0400 +++ ../../asterisk-addons-1.6.1.0/./channels/ooh323c/src/ooq931.c 2009-07-31 00:30:57.000000000 +0400 @@ -1942,7 +1942,6 @@ OOCTXT *pctxt; ooAliases *pNewAlias=NULL, *alias=NULL; struct timespec ts; - ast_mutex_t gmutex; int i=0, irand=0, ret = OO_OK; /* Note: We keep same callToken, for new call which is going to replace an existing call, thus treating it as a single call.*/ @@ -2000,11 +1999,7 @@ ast_mutex_lock(&fwdedCall->Lock); clock_gettime(CLOCK_REALTIME, &ts); ts.tv_sec += 24; - ast_mutex_init(&gmutex); - ast_mutex_lock(&gmutex); - ast_cond_timedwait(&fwdedCall->gkWait, &gmutex, &ts); - ast_mutex_unlock(&gmutex); - ast_mutex_destroy(&gmutex); + sem_timedwait(&fwdedCall->gkWait, &ts); if (fwdedCall->callState == OO_CALL_WAITING_ADMISSION) /* GK is not responding */ fwdedCall->callState = OO_CALL_CLEAR; ast_mutex_unlock(&fwdedCall->Lock); @@ -2046,7 +2041,6 @@ char *ip=NULL, *port = NULL; struct timespec ts; int gkWaits; - ast_mutex_t gmutex; if(!dest) { @@ -2127,17 +2121,13 @@ call->callState = OO_CALL_WAITING_ADMISSION; // ast_mutex_lock(&call->Lock); ret = ooGkClientSendAdmissionRequest(gH323ep.gkClient, call, FALSE); - ast_mutex_init(&gmutex); for (gkWaits = 0; gkWaits < 1000; gkWaits++) { clock_gettime(CLOCK_REALTIME, &ts); ts.tv_nsec += 24000000; - ast_mutex_lock(&gmutex); - ast_cond_timedwait(&call->gkWait, &gmutex, &ts); - ast_mutex_unlock(&gmutex); + sem_timedwait(&call->gkWait, &ts); if (call->callState != OO_CALL_WAITING_ADMISSION) break; } - ast_mutex_destroy(&gmutex); // ast_mutex_unlock(&call->Lock); } --- ./channels/ooh323c/src/ooGkClient.c 2009-07-29 03:07:43.000000000 +0400 +++ ../../asterisk-addons-1.6.1.0/./channels/ooh323c/src/ooGkClient.c 2009-07-31 00:30:57.000000000 +0400 @@ -1950,7 +1950,7 @@ pCallAdmInfo->call->callToken); pCallAdmInfo->call->callState = OO_CALL_CONNECTING; - ast_cond_broadcast(&pCallAdmInfo->call->gkWait); + sem_post(&pCallAdmInfo->call->gkWait); /* ooH323CallAdmitted( pCallAdmInfo->call); */ dListRemove(&pGkClient->callsPendingList, pNode); @@ -2049,7 +2049,7 @@ break; } - ast_cond_broadcast(&pCallAdmInfo->call->gkWait); + sem_post(&pCallAdmInfo->call->gkWait); return OO_OK; }