mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-25 15:08:53 +00:00
Merged revisions 333961-333962 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10 ................ r333961 | may | 2011-08-31 01:21:53 +0400 (Wed, 31 Aug 2011) | 11 lines Merged revisions 333947 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r333947 | may | 2011-08-31 01:16:30 +0400 (Wed, 31 Aug 2011) | 5 lines cleanups in ACF/ARJ GK replies processing fixed long (24 sec) pause if acf/arj proccessed before ast_cond_wait called to wait this ........ ................ r333962 | may | 2011-08-31 01:53:42 +0400 (Wed, 31 Aug 2011) | 3 lines security fix. really drop call if signalling addr is not same as socket addr ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@333963 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -63,6 +63,7 @@ OOH323CallData* ooCreateCall(char* type, char*callToken)
|
|||||||
}
|
}
|
||||||
memset(call, 0, sizeof(OOH323CallData));
|
memset(call, 0, sizeof(OOH323CallData));
|
||||||
ast_cond_init(&call->gkWait, NULL);
|
ast_cond_init(&call->gkWait, NULL);
|
||||||
|
ast_mutex_init(&call->GkLock);
|
||||||
ast_mutex_init(&call->Lock);
|
ast_mutex_init(&call->Lock);
|
||||||
call->pctxt = pctxt;
|
call->pctxt = pctxt;
|
||||||
call->msgctxt = msgctxt;
|
call->msgctxt = msgctxt;
|
||||||
|
@@ -151,6 +151,7 @@ typedef struct OOH323CallData {
|
|||||||
OOCTXT *msgctxt;
|
OOCTXT *msgctxt;
|
||||||
pthread_t callThread;
|
pthread_t callThread;
|
||||||
ast_cond_t gkWait;
|
ast_cond_t gkWait;
|
||||||
|
ast_mutex_t GkLock;
|
||||||
ast_mutex_t Lock;
|
ast_mutex_t Lock;
|
||||||
OOBOOL Monitor;
|
OOBOOL Monitor;
|
||||||
OOBOOL fsSent;
|
OOBOOL fsSent;
|
||||||
|
@@ -431,7 +431,7 @@ int ooGkClientReceive(ooGkClient *pGkClient)
|
|||||||
if(iRet != OO_OK)
|
if(iRet != OO_OK)
|
||||||
{
|
{
|
||||||
OOTRACEERR1("Error: Failed to handle received RAS message\n");
|
OOTRACEERR1("Error: Failed to handle received RAS message\n");
|
||||||
//pGkClient->state = GkClientFailed;
|
pGkClient->state = GkClientFailed;
|
||||||
}
|
}
|
||||||
memReset(pctxt);
|
memReset(pctxt);
|
||||||
}
|
}
|
||||||
@@ -1921,6 +1921,8 @@ int ooGkClientHandleAdmissionConfirm
|
|||||||
OOTimer *pTimer = NULL;
|
OOTimer *pTimer = NULL;
|
||||||
char ip[20];
|
char ip[20];
|
||||||
|
|
||||||
|
ast_mutex_lock(&pGkClient->Lock);
|
||||||
|
|
||||||
/* Search call in pending calls list */
|
/* Search call in pending calls list */
|
||||||
for(x=0 ; x<pGkClient->callsPendingList.count; x++)
|
for(x=0 ; x<pGkClient->callsPendingList.count; x++)
|
||||||
{
|
{
|
||||||
@@ -1931,6 +1933,9 @@ int ooGkClientHandleAdmissionConfirm
|
|||||||
OOTRACEDBGC3("Found Pending call(%s, %s)\n",
|
OOTRACEDBGC3("Found Pending call(%s, %s)\n",
|
||||||
pCallAdmInfo->call->callType,
|
pCallAdmInfo->call->callType,
|
||||||
pCallAdmInfo->call->callToken);
|
pCallAdmInfo->call->callToken);
|
||||||
|
|
||||||
|
ast_mutex_lock(&pCallAdmInfo->call->GkLock);
|
||||||
|
|
||||||
/* Populate Remote IP */
|
/* Populate Remote IP */
|
||||||
if(pAdmissionConfirm->destCallSignalAddress.t !=
|
if(pAdmissionConfirm->destCallSignalAddress.t !=
|
||||||
T_H225TransportAddress_ipAddress)
|
T_H225TransportAddress_ipAddress)
|
||||||
@@ -1939,6 +1944,9 @@ int ooGkClientHandleAdmissionConfirm
|
|||||||
"Gatekeeper is not an IPv4 address\n");
|
"Gatekeeper is not an IPv4 address\n");
|
||||||
OOTRACEINFO1("Ignoring ACF, will wait for timeout and retransmit "
|
OOTRACEINFO1("Ignoring ACF, will wait for timeout and retransmit "
|
||||||
"ARQ\n");
|
"ARQ\n");
|
||||||
|
ast_mutex_unlock(&pCallAdmInfo->call->GkLock);
|
||||||
|
ast_mutex_unlock(&pGkClient->Lock);
|
||||||
|
ast_cond_signal(&pCallAdmInfo->call->gkWait);
|
||||||
return OO_FAILED;
|
return OO_FAILED;
|
||||||
}
|
}
|
||||||
ipAddress = pAdmissionConfirm->destCallSignalAddress.u.ipAddress;
|
ipAddress = pAdmissionConfirm->destCallSignalAddress.u.ipAddress;
|
||||||
@@ -2000,15 +2008,15 @@ int ooGkClientHandleAdmissionConfirm
|
|||||||
pCallAdmInfo->call->callToken);
|
pCallAdmInfo->call->callToken);
|
||||||
|
|
||||||
pCallAdmInfo->call->callState = OO_CALL_CONNECTING;
|
pCallAdmInfo->call->callState = OO_CALL_CONNECTING;
|
||||||
/* ooH323CallAdmitted( pCallAdmInfo->call); */
|
|
||||||
|
|
||||||
dListRemove(&pGkClient->callsPendingList, pNode);
|
dListRemove(&pGkClient->callsPendingList, pNode);
|
||||||
dListAppend(&pGkClient->ctxt, &pGkClient->callsAdmittedList,
|
dListAppend(&pGkClient->ctxt, &pGkClient->callsAdmittedList,
|
||||||
pNode->data);
|
pNode->data);
|
||||||
memFreePtr(&pGkClient->ctxt, pNode);
|
memFreePtr(&pGkClient->ctxt, pNode);
|
||||||
|
ast_mutex_unlock(&pCallAdmInfo->call->GkLock);
|
||||||
|
ast_mutex_unlock(&pGkClient->Lock);
|
||||||
ast_cond_signal(&pCallAdmInfo->call->gkWait);
|
ast_cond_signal(&pCallAdmInfo->call->gkWait);
|
||||||
return OO_OK;
|
return OO_OK;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2017,6 +2025,7 @@ int ooGkClientHandleAdmissionConfirm
|
|||||||
}
|
}
|
||||||
OOTRACEERR1("Error: Failed to process ACF as there is no corresponding "
|
OOTRACEERR1("Error: Failed to process ACF as there is no corresponding "
|
||||||
"pending call\n");
|
"pending call\n");
|
||||||
|
ast_mutex_unlock(&pGkClient->Lock);
|
||||||
return OO_OK;
|
return OO_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2030,6 +2039,8 @@ int ooGkClientHandleAdmissionReject
|
|||||||
OOH323CallData *call=NULL;
|
OOH323CallData *call=NULL;
|
||||||
OOTimer *pTimer = NULL;
|
OOTimer *pTimer = NULL;
|
||||||
|
|
||||||
|
ast_mutex_lock(&pGkClient->Lock);
|
||||||
|
|
||||||
/* Search call in pending calls list */
|
/* Search call in pending calls list */
|
||||||
for(x=0 ; x<pGkClient->callsPendingList.count; x++)
|
for(x=0 ; x<pGkClient->callsPendingList.count; x++)
|
||||||
{
|
{
|
||||||
@@ -2046,6 +2057,7 @@ int ooGkClientHandleAdmissionReject
|
|||||||
OOTRACEWARN2("Received admission reject with request number %d can not"
|
OOTRACEWARN2("Received admission reject with request number %d can not"
|
||||||
" be matched with any pending call.\n",
|
" be matched with any pending call.\n",
|
||||||
pAdmissionReject->requestSeqNum);
|
pAdmissionReject->requestSeqNum);
|
||||||
|
ast_mutex_unlock(&pGkClient->Lock);
|
||||||
return OO_OK;
|
return OO_OK;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -2054,6 +2066,7 @@ int ooGkClientHandleAdmissionReject
|
|||||||
memFreePtr(&pGkClient->ctxt, pCallAdmInfo);
|
memFreePtr(&pGkClient->ctxt, pCallAdmInfo);
|
||||||
memFreePtr(&pGkClient->ctxt, pNode);
|
memFreePtr(&pGkClient->ctxt, pNode);
|
||||||
}
|
}
|
||||||
|
ast_mutex_lock(&pCallAdmInfo->call->GkLock);
|
||||||
|
|
||||||
/* Delete ARQ timer */
|
/* Delete ARQ timer */
|
||||||
for(y=0; y<pGkClient->timerList.count; y++)
|
for(y=0; y<pGkClient->timerList.count; y++)
|
||||||
@@ -2118,6 +2131,8 @@ int ooGkClientHandleAdmissionReject
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ast_mutex_unlock(&pCallAdmInfo->call->GkLock);
|
||||||
|
ast_mutex_unlock(&pGkClient->Lock);
|
||||||
ast_cond_signal(&pCallAdmInfo->call->gkWait);
|
ast_cond_signal(&pCallAdmInfo->call->gkWait);
|
||||||
return OO_OK;
|
return OO_OK;
|
||||||
}
|
}
|
||||||
|
@@ -960,6 +960,7 @@ int ooMonitorCallChannels(OOH323CallData *call)
|
|||||||
ast_mutex_lock(&call->Lock);
|
ast_mutex_lock(&call->Lock);
|
||||||
ast_mutex_unlock(&call->Lock);
|
ast_mutex_unlock(&call->Lock);
|
||||||
ast_mutex_destroy(&call->Lock);
|
ast_mutex_destroy(&call->Lock);
|
||||||
|
ast_mutex_destroy(&call->GkLock);
|
||||||
ast_cond_destroy(&call->gkWait);
|
ast_cond_destroy(&call->gkWait);
|
||||||
pctxt = call->pctxt;
|
pctxt = call->pctxt;
|
||||||
freeContext(pctxt);
|
freeContext(pctxt);
|
||||||
|
@@ -371,7 +371,7 @@ int ooOnReceivedSetup(OOH323CallData *call, Q931Message *q931Msg)
|
|||||||
H225TransportAddress_ip6Address_ip *ip6 = NULL;
|
H225TransportAddress_ip6Address_ip *ip6 = NULL;
|
||||||
Q931InformationElement* pDisplayIE=NULL;
|
Q931InformationElement* pDisplayIE=NULL;
|
||||||
OOAliases *pAlias=NULL;
|
OOAliases *pAlias=NULL;
|
||||||
char remoteIP[2+8*4+7];
|
char remoteIP[2+8*4+7] = "";
|
||||||
|
|
||||||
call->callReference = q931Msg->callReference;
|
call->callReference = q931Msg->callReference;
|
||||||
|
|
||||||
@@ -529,6 +529,7 @@ int ooOnReceivedSetup(OOH323CallData *call, Q931Message *q931Msg)
|
|||||||
OOTRACEERR5("ERROR: Security denial remote sig IP isn't a socket ip, %s not %s "
|
OOTRACEERR5("ERROR: Security denial remote sig IP isn't a socket ip, %s not %s "
|
||||||
"(%s, %s)\n", remoteIP, call->remoteIP, call->callType,
|
"(%s, %s)\n", remoteIP, call->remoteIP, call->callType,
|
||||||
call->callToken);
|
call->callToken);
|
||||||
|
return OO_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for fast start */
|
/* check for fast start */
|
||||||
@@ -1638,12 +1639,15 @@ int ooHandleH2250Message(OOH323CallData *call, Q931Message *q931Msg)
|
|||||||
case Q931SetupMsg: /* SETUP message is received */
|
case Q931SetupMsg: /* SETUP message is received */
|
||||||
OOTRACEINFO3("Received SETUP message (%s, %s)\n", call->callType,
|
OOTRACEINFO3("Received SETUP message (%s, %s)\n", call->callType,
|
||||||
call->callToken);
|
call->callToken);
|
||||||
ooOnReceivedSetup(call, q931Msg);
|
ret = ooOnReceivedSetup(call, q931Msg);
|
||||||
|
if (ret != OO_OK) {
|
||||||
|
call->callState = OO_CALL_CLEAR;
|
||||||
|
} else {
|
||||||
|
|
||||||
/* H225 message callback */
|
/* H225 message callback */
|
||||||
if(gH323ep.h225Callbacks.onReceivedSetup)
|
if(gH323ep.h225Callbacks.onReceivedSetup)
|
||||||
ret = gH323ep.h225Callbacks.onReceivedSetup(call, q931Msg);
|
ret = gH323ep.h225Callbacks.onReceivedSetup(call, q931Msg);
|
||||||
|
}
|
||||||
/* Free up the mem used by the received message, as it's processing
|
/* Free up the mem used by the received message, as it's processing
|
||||||
is done.
|
is done.
|
||||||
*/
|
*/
|
||||||
@@ -1661,23 +1665,24 @@ int ooHandleH2250Message(OOH323CallData *call, Q931Message *q931Msg)
|
|||||||
if(gH323ep.gkClient->state == GkClientRegistered)
|
if(gH323ep.gkClient->state == GkClientRegistered)
|
||||||
{
|
{
|
||||||
call->callState = OO_CALL_WAITING_ADMISSION;
|
call->callState = OO_CALL_WAITING_ADMISSION;
|
||||||
ast_mutex_lock(&call->Lock);
|
|
||||||
ret = ooGkClientSendAdmissionRequest(gH323ep.gkClient, call,
|
ret = ooGkClientSendAdmissionRequest(gH323ep.gkClient, call,
|
||||||
FALSE);
|
FALSE);
|
||||||
tv = ast_tvnow();
|
tv = ast_tvnow();
|
||||||
ts.tv_sec = tv.tv_sec + 24;
|
ts.tv_sec = tv.tv_sec + 24;
|
||||||
ts.tv_nsec = tv.tv_usec * 1000;
|
ts.tv_nsec = tv.tv_usec * 1000;
|
||||||
ast_cond_timedwait(&call->gkWait, &call->Lock, &ts);
|
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)
|
if (call->callState == OO_CALL_WAITING_ADMISSION)
|
||||||
call->callState = OO_CALL_CLEAR;
|
call->callState = OO_CALL_CLEAR;
|
||||||
ast_mutex_unlock(&call->Lock);
|
ast_mutex_unlock(&call->GkLock);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* TODO: Should send Release complete with reject reason */
|
|
||||||
OOTRACEERR1("Error:Ignoring incoming call as not yet"
|
OOTRACEERR1("Error:Ignoring incoming call as not yet"
|
||||||
"registered with Gk\n");
|
"registered with Gk\n");
|
||||||
call->callState = OO_CALL_CLEAR;
|
call->callState = OO_CALL_CLEAR;
|
||||||
|
call->callEndReason = OO_REASON_GK_UNREACHABLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (call->callState < OO_CALL_CLEAR) {
|
if (call->callState < OO_CALL_CLEAR) {
|
||||||
|
@@ -2266,19 +2266,24 @@ int ooH323MakeCall(char *dest, char *callToken, ooCallOptions *opts)
|
|||||||
|
|
||||||
if(gH323ep.gkClient && !OO_TESTFLAG(call->flags, OO_M_DISABLEGK))
|
if(gH323ep.gkClient && !OO_TESTFLAG(call->flags, OO_M_DISABLEGK))
|
||||||
{
|
{
|
||||||
/* No need to check registration status here as it is already checked for
|
if(gH323ep.gkClient->state == GkClientRegistered) {
|
||||||
MakeCall command */
|
call->callState = OO_CALL_WAITING_ADMISSION;
|
||||||
|
ret = ooGkClientSendAdmissionRequest(gH323ep.gkClient, call, FALSE);
|
||||||
call->callState = OO_CALL_WAITING_ADMISSION;
|
tv = ast_tvnow();
|
||||||
ast_mutex_lock(&call->Lock);
|
ts.tv_sec = tv.tv_sec + 24;
|
||||||
ret = ooGkClientSendAdmissionRequest(gH323ep.gkClient, call, FALSE);
|
ts.tv_nsec = tv.tv_usec * 1000;
|
||||||
tv = ast_tvnow();
|
ast_mutex_lock(&call->GkLock);
|
||||||
ts.tv_sec = tv.tv_sec + 24;
|
if (call->callState == OO_CALL_WAITING_ADMISSION)
|
||||||
ts.tv_nsec = tv.tv_usec * 1000;
|
ast_cond_timedwait(&call->gkWait, &call->GkLock, &ts);
|
||||||
ast_cond_timedwait(&call->gkWait, &call->Lock, &ts);
|
if (call->callState == OO_CALL_WAITING_ADMISSION)
|
||||||
if (call->callState == OO_CALL_WAITING_ADMISSION)
|
|
||||||
call->callState = OO_CALL_CLEAR;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user