[asterisk-commits] may: branch 1.8 r333947 - /branches/1.8/addons/ooh323c/src/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Aug 30 16:16:33 CDT 2011
Author: may
Date: Tue Aug 30 16:16:30 2011
New Revision: 333947
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=333947
Log:
cleanups in ACF/ARJ GK replies processing
fixed long (24 sec) pause if acf/arj proccessed
before ast_cond_wait called to wait this
Modified:
branches/1.8/addons/ooh323c/src/ooCalls.c
branches/1.8/addons/ooh323c/src/ooCalls.h
branches/1.8/addons/ooh323c/src/ooGkClient.c
branches/1.8/addons/ooh323c/src/oochannels.c
branches/1.8/addons/ooh323c/src/ooh323.c
branches/1.8/addons/ooh323c/src/ooq931.c
Modified: branches/1.8/addons/ooh323c/src/ooCalls.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/addons/ooh323c/src/ooCalls.c?view=diff&rev=333947&r1=333946&r2=333947
==============================================================================
--- branches/1.8/addons/ooh323c/src/ooCalls.c (original)
+++ branches/1.8/addons/ooh323c/src/ooCalls.c Tue Aug 30 16:16:30 2011
@@ -63,6 +63,7 @@
}
memset(call, 0, sizeof(OOH323CallData));
ast_cond_init(&call->gkWait, NULL);
+ ast_mutex_init(&call->GkLock);
ast_mutex_init(&call->Lock);
call->pctxt = pctxt;
call->msgctxt = msgctxt;
Modified: branches/1.8/addons/ooh323c/src/ooCalls.h
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/addons/ooh323c/src/ooCalls.h?view=diff&rev=333947&r1=333946&r2=333947
==============================================================================
--- branches/1.8/addons/ooh323c/src/ooCalls.h (original)
+++ branches/1.8/addons/ooh323c/src/ooCalls.h Tue Aug 30 16:16:30 2011
@@ -151,6 +151,7 @@
OOCTXT *msgctxt;
pthread_t callThread;
ast_cond_t gkWait;
+ ast_mutex_t GkLock;
ast_mutex_t Lock;
OOBOOL Monitor;
OOBOOL fsSent;
Modified: branches/1.8/addons/ooh323c/src/ooGkClient.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/addons/ooh323c/src/ooGkClient.c?view=diff&rev=333947&r1=333946&r2=333947
==============================================================================
--- branches/1.8/addons/ooh323c/src/ooGkClient.c (original)
+++ branches/1.8/addons/ooh323c/src/ooGkClient.c Tue Aug 30 16:16:30 2011
@@ -430,7 +430,7 @@
if(iRet != OO_OK)
{
OOTRACEERR1("Error: Failed to handle received RAS message\n");
- //pGkClient->state = GkClientFailed;
+ pGkClient->state = GkClientFailed;
}
memReset(pctxt);
}
@@ -1920,6 +1920,8 @@
OOTimer *pTimer = NULL;
char ip[20];
+ ast_mutex_lock(&pGkClient->Lock);
+
/* Search call in pending calls list */
for(x=0 ; x<pGkClient->callsPendingList.count; x++)
{
@@ -1930,6 +1932,9 @@
OOTRACEDBGC3("Found Pending call(%s, %s)\n",
pCallAdmInfo->call->callType,
pCallAdmInfo->call->callToken);
+
+ ast_mutex_lock(&pCallAdmInfo->call->GkLock);
+
/* Populate Remote IP */
if(pAdmissionConfirm->destCallSignalAddress.t !=
T_H225TransportAddress_ipAddress)
@@ -1938,6 +1943,9 @@
"Gatekeeper is not an IPv4 address\n");
OOTRACEINFO1("Ignoring ACF, will wait for timeout and retransmit "
"ARQ\n");
+ ast_mutex_unlock(&pCallAdmInfo->call->GkLock);
+ ast_mutex_unlock(&pGkClient->Lock);
+ ast_cond_signal(&pCallAdmInfo->call->gkWait);
return OO_FAILED;
}
ipAddress = pAdmissionConfirm->destCallSignalAddress.u.ipAddress;
@@ -1996,15 +2004,15 @@
pCallAdmInfo->call->callToken);
pCallAdmInfo->call->callState = OO_CALL_CONNECTING;
- /* ooH323CallAdmitted( pCallAdmInfo->call); */
dListRemove(&pGkClient->callsPendingList, pNode);
dListAppend(&pGkClient->ctxt, &pGkClient->callsAdmittedList,
pNode->data);
memFreePtr(&pGkClient->ctxt, pNode);
+ ast_mutex_unlock(&pCallAdmInfo->call->GkLock);
+ ast_mutex_unlock(&pGkClient->Lock);
ast_cond_signal(&pCallAdmInfo->call->gkWait);
return OO_OK;
- break;
}
else
{
@@ -2013,6 +2021,7 @@
}
OOTRACEERR1("Error: Failed to process ACF as there is no corresponding "
"pending call\n");
+ ast_mutex_unlock(&pGkClient->Lock);
return OO_OK;
}
@@ -2025,6 +2034,8 @@
DListNode *pNode=NULL, *pNode1=NULL;
OOH323CallData *call=NULL;
OOTimer *pTimer = NULL;
+
+ ast_mutex_lock(&pGkClient->Lock);
/* Search call in pending calls list */
for(x=0 ; x<pGkClient->callsPendingList.count; x++)
@@ -2042,6 +2053,7 @@
OOTRACEWARN2("Received admission reject with request number %d can not"
" be matched with any pending call.\n",
pAdmissionReject->requestSeqNum);
+ ast_mutex_unlock(&pGkClient->Lock);
return OO_OK;
}
else{
@@ -2050,6 +2062,7 @@
memFreePtr(&pGkClient->ctxt, pCallAdmInfo);
memFreePtr(&pGkClient->ctxt, pNode);
}
+ ast_mutex_lock(&pCallAdmInfo->call->GkLock);
/* Delete ARQ timer */
for(y=0; y<pGkClient->timerList.count; y++)
@@ -2114,6 +2127,8 @@
break;
}
+ ast_mutex_unlock(&pCallAdmInfo->call->GkLock);
+ ast_mutex_unlock(&pGkClient->Lock);
ast_cond_signal(&pCallAdmInfo->call->gkWait);
return OO_OK;
}
Modified: branches/1.8/addons/ooh323c/src/oochannels.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/addons/ooh323c/src/oochannels.c?view=diff&rev=333947&r1=333946&r2=333947
==============================================================================
--- branches/1.8/addons/ooh323c/src/oochannels.c (original)
+++ branches/1.8/addons/ooh323c/src/oochannels.c Tue Aug 30 16:16:30 2011
@@ -949,6 +949,7 @@
ast_mutex_lock(&call->Lock);
ast_mutex_unlock(&call->Lock);
ast_mutex_destroy(&call->Lock);
+ ast_mutex_destroy(&call->GkLock);
ast_cond_destroy(&call->gkWait);
pctxt = call->pctxt;
freeContext(pctxt);
Modified: branches/1.8/addons/ooh323c/src/ooh323.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/addons/ooh323c/src/ooh323.c?view=diff&rev=333947&r1=333946&r2=333947
==============================================================================
--- branches/1.8/addons/ooh323c/src/ooh323.c (original)
+++ branches/1.8/addons/ooh323c/src/ooh323.c Tue Aug 30 16:16:30 2011
@@ -1628,12 +1628,15 @@
case Q931SetupMsg: /* SETUP message is received */
OOTRACEINFO3("Received SETUP message (%s, %s)\n", call->callType,
call->callToken);
- ooOnReceivedSetup(call, q931Msg);
-
+ ret = ooOnReceivedSetup(call, q931Msg);
+ if (ret != OO_OK) {
+ call->callState = OO_CALL_CLEAR;
+ } else {
+
/* H225 message callback */
- if(gH323ep.h225Callbacks.onReceivedSetup)
- ret = gH323ep.h225Callbacks.onReceivedSetup(call, q931Msg);
-
+ if(gH323ep.h225Callbacks.onReceivedSetup)
+ ret = gH323ep.h225Callbacks.onReceivedSetup(call, q931Msg);
+ }
/* Free up the mem used by the received message, as it's processing
is done.
*/
@@ -1651,23 +1654,24 @@
if(gH323ep.gkClient->state == GkClientRegistered)
{
call->callState = OO_CALL_WAITING_ADMISSION;
- ast_mutex_lock(&call->Lock);
ret = ooGkClientSendAdmissionRequest(gH323ep.gkClient, call,
FALSE);
- tv = ast_tvnow();
+ tv = ast_tvnow();
ts.tv_sec = tv.tv_sec + 24;
- ts.tv_nsec = tv.tv_usec * 1000;
- ast_cond_timedwait(&call->gkWait, &call->Lock, &ts);
+ 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)
call->callState = OO_CALL_CLEAR;
- ast_mutex_unlock(&call->Lock);
+ ast_mutex_unlock(&call->GkLock);
}
else {
- /* TODO: Should send Release complete with reject reason */
OOTRACEERR1("Error:Ignoring incoming call as not yet"
"registered with Gk\n");
call->callState = OO_CALL_CLEAR;
+ call->callEndReason = OO_REASON_GK_UNREACHABLE;
}
}
if (call->callState < OO_CALL_CLEAR) {
Modified: branches/1.8/addons/ooh323c/src/ooq931.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/addons/ooh323c/src/ooq931.c?view=diff&rev=333947&r1=333946&r2=333947
==============================================================================
--- branches/1.8/addons/ooh323c/src/ooq931.c (original)
+++ branches/1.8/addons/ooh323c/src/ooq931.c Tue Aug 30 16:16:30 2011
@@ -2204,19 +2204,24 @@
if(gH323ep.gkClient && !OO_TESTFLAG(call->flags, OO_M_DISABLEGK))
{
- /* No need to check registration status here as it is already checked for
- MakeCall command */
-
- call->callState = OO_CALL_WAITING_ADMISSION;
- ast_mutex_lock(&call->Lock);
- ret = ooGkClientSendAdmissionRequest(gH323ep.gkClient, call, FALSE);
- tv = ast_tvnow();
- ts.tv_sec = tv.tv_sec + 24;
- ts.tv_nsec = tv.tv_usec * 1000;
- ast_cond_timedwait(&call->gkWait, &call->Lock, &ts);
- if (call->callState == OO_CALL_WAITING_ADMISSION)
+ if(gH323ep.gkClient->state == GkClientRegistered) {
+ call->callState = OO_CALL_WAITING_ADMISSION;
+ 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)
call->callState = OO_CALL_CLEAR;
- ast_mutex_unlock(&call->Lock);
+ ast_mutex_unlock(&call->GkLock);
+ } else {
+ OOTRACEERR1("Error:Aborting outgoing call as not yet"
+ "registered with Gk\n");
+ call->callState = OO_CALL_CLEAR;
+ call->callEndReason = OO_REASON_GK_UNREACHABLE;
+ }
}
More information about the asterisk-commits
mailing list