corrections in gk interface, small fixes in call clearing.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@255199 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Alexandr Anikin
2010-03-27 23:51:13 +00:00
parent b8aeb50b7b
commit 89e4c15783
6 changed files with 83 additions and 67 deletions

View File

@@ -609,6 +609,10 @@ static struct ast_channel *ooh323_request(const char *type, format_t format,
if (dest) {
peer = find_peer(dest, port);
} else{
ast_mutex_lock(&iflock);
ast_mutex_unlock(&p->lock);
ooh323_destroy(p);
ast_mutex_unlock(&iflock);
ast_log(LOG_ERROR, "Destination format is not supported\n");
return NULL;
}
@@ -642,6 +646,15 @@ static struct ast_channel *ooh323_request(const char *type, format_t format,
ast_copy_string(p->accountcode, peer->accountcode, sizeof(p->accountcode));
p->amaflags = peer->amaflags;
} else {
if (gRasGkMode == RasNoGatekeeper) {
/* no gk and no peer */
ast_log(LOG_ERROR, "Call to undefined peer %s", dest);
ast_mutex_lock(&iflock);
ast_mutex_unlock(&p->lock);
ooh323_destroy(p);
ast_mutex_unlock(&iflock);
return NULL;
}
p->dtmfmode = gDTMFMode;
p->dtmfcodec = gDTMFCodec;
p->t38support = gT38Support;
@@ -675,8 +688,7 @@ static struct ast_channel *ooh323_request(const char *type, format_t format,
} else {
ast_mutex_lock(&p->lock);
p->callToken = (char*)ast_malloc(AST_MAX_EXTENSION);
if(!p->callToken)
{
if(!p->callToken) {
ast_mutex_unlock(&p->lock);
ast_mutex_lock(&iflock);
ooh323_destroy(p);

View File

@@ -217,6 +217,11 @@ int ooEndCall(OOH323CallData *call)
if (call->callIdentifier.guid.numocts == 0) call->callState = OO_CALL_CLEARED;
if(!call->pH225Channel || call->pH225Channel->sock ==0)
{
call->callState = OO_CALL_CLEARED;
}
if(call->callState == OO_CALL_CLEARED || call->callState == OO_CALL_CLEAR_RELEASESENT)
{
ooCleanCall(call);
@@ -242,11 +247,6 @@ int ooEndCall(OOH323CallData *call)
}
if(!call->pH225Channel || call->pH225Channel->sock ==0)
{
call->callState = OO_CALL_CLEARED;
}
else{
if(!OO_TESTFLAG(call->flags, OO_M_RELEASE_BUILT))
{
if(call->callState == OO_CALL_CLEAR ||
@@ -256,7 +256,6 @@ int ooEndCall(OOH323CallData *call)
OO_SETFLAG(call->flags, OO_M_RELEASE_BUILT);
}
}
}
return OO_OK;
}

View File

@@ -686,7 +686,7 @@ int ooGkClientSendGRQ(ooGkClient *pGkClient)
pGkReq->m.endpointAliasPresent=TRUE;
if(OO_OK != ooPopulateAliasList(&pGkClient->msgCtxt, gH323ep.aliases,
&pGkReq->endpointAlias))
&pGkReq->endpointAlias, 0))
{
OOTRACEERR1("Error Failed to fill alias information for GRQ message\n");
memReset(&pGkClient->msgCtxt);
@@ -1010,7 +1010,7 @@ int ooGkClientSendRRQ(ooGkClient *pGkClient, ASN1BOOL keepAlive)
pRegReq->m.terminalAliasPresent=TRUE;
if(OO_OK != ooPopulateAliasList(pctxt, gH323ep.aliases,
&pRegReq->terminalAlias)) {
&pRegReq->terminalAlias, 0)) {
OOTRACEERR1("Error filling alias for RRQ\n");
memReset(pctxt);
pGkClient->state = GkClientFailed;
@@ -1457,7 +1457,7 @@ int ooGkClientSendURQ(ooGkClient *pGkClient, ooAliases *aliases)
if(aliases)
{
pUnregReq->m.endpointAliasPresent = TRUE;
ooPopulateAliasList(pctxt, aliases, &pUnregReq->endpointAlias);
ooPopulateAliasList(pctxt, aliases, &pUnregReq->endpointAlias, 0);
}
@@ -1716,7 +1716,7 @@ int ooGkClientSendAdmissionRequest
{
pAdmReq->m.destinationInfoPresent = 1;
if(OO_OK != ooPopulateAliasList(&pGkClient->msgCtxt, destAliases,
&pAdmReq->destinationInfo))
&pAdmReq->destinationInfo, T_H225AliasAddress_dialedDigits))
{
OOTRACEERR1("Error:Failed to populate destination aliases - "
"ARQ message\n");
@@ -1731,7 +1731,7 @@ int ooGkClientSendAdmissionRequest
if(srcAliases)
{
iRet = ooPopulateAliasList(&pGkClient->msgCtxt, srcAliases,
&pAdmReq->srcInfo);
&pAdmReq->srcInfo, 0);
if(OO_OK != iRet)
{
OOTRACEERR1("Error:Failed to populate source aliases -ARQ message\n");
@@ -2027,7 +2027,7 @@ int ooGkClientHandleAdmissionReject
"(%s, %s)\n", pAdmissionReject->rejectReason.t, call->callType,
call->callToken);
call->callState = OO_CALL_CLEAR;
call->callState = OO_CALL_CLEARED;
switch(pAdmissionReject->rejectReason.t)
{
@@ -2204,10 +2204,10 @@ int ooGkClientSendIRR
if(srcAliases)
{
iRet = ooPopulateAliasList(&pGkClient->msgCtxt, srcAliases,
&pIRR->endpointAlias);
&pIRR->endpointAlias, T_H225AliasAddress_h323_ID);
if(OO_OK != iRet)
{
OOTRACEERR1("Error:Failed to populate source aliases -ARQ message\n");
OOTRACEERR1("Error:Failed to populate source aliases -IRR message\n");
memReset(pctxt);
pGkClient->state = GkClientFailed;
ast_mutex_unlock(&pGkClient->Lock);

View File

@@ -2219,7 +2219,7 @@ int ooPopulatePrefixList(OOCTXT *pctxt, OOAliases *pAliases,
return OO_OK;
}
int ooPopulateAliasList(OOCTXT *pctxt, OOAliases *pAliases,
H225_SeqOfH225AliasAddress *pAliasList )
H225_SeqOfH225AliasAddress *pAliasList, int pAliasType)
{
H225AliasAddress *pAliasEntry=NULL;
OOAliases * pAlias=NULL;
@@ -2243,9 +2243,13 @@ int ooPopulateAliasList(OOCTXT *pctxt, OOAliases *pAliases,
OOTRACEERR1("ERROR:Memory - ooPopulateAliasList - pAliasEntry\n");
return OO_FAILED;
}
if (pAliasType && pAlias->type != pAliasType) {
pAlias = pAlias->next;
continue;
}
switch(pAlias->type)
{
/* Don't populate DialedDigits as alias they populate as prefixes
case T_H225AliasAddress_dialedDigits:
pAliasEntry->t = T_H225AliasAddress_dialedDigits;
pAliasEntry->u.dialedDigits = (ASN1IA5String)memAlloc(pctxt,
@@ -2259,7 +2263,7 @@ int ooPopulateAliasList(OOCTXT *pctxt, OOAliases *pAliases,
}
strcpy(*(char**)&pAliasEntry->u.dialedDigits, pAlias->value);
bValid = TRUE;
break; */
break;
case T_H225AliasAddress_h323_ID:
pAliasEntry->t = T_H225AliasAddress_h323_ID;
pAliasEntry->u.h323_ID.nchars = strlen(pAlias->value);

View File

@@ -136,7 +136,7 @@ EXTERN int ooPopulatePrefixList(OOCTXT *pctxt, OOAliases *pAliases,
* @return OO_OK, on success. OO_FAILED, otherwise.
*/
EXTERN int ooPopulateAliasList(OOCTXT *pctxt, OOAliases *pAliases,
H225_SeqOfH225AliasAddress *pAliasList);
H225_SeqOfH225AliasAddress *pAliasList, int pAliasType);
/**
* This function is used to search a particular alias in the alias list. The

View File

@@ -1383,10 +1383,10 @@ int ooSendAlerting(OOH323CallData *call)
alerting->m.alertingAddressPresent = TRUE;
if(call->ourAliases)
ret = ooPopulateAliasList(pctxt, call->ourAliases,
&alerting->alertingAddress);
&alerting->alertingAddress, 0);
else
ret = ooPopulateAliasList(pctxt, gH323ep.aliases,
&alerting->alertingAddress);
&alerting->alertingAddress, 0);
if(OO_OK != ret)
{
OOTRACEERR1("Error:Failed to populate alias list in Alert message\n");
@@ -1889,10 +1889,10 @@ int ooAcceptCall(OOH323CallData *call)
connect->m.connectedAddressPresent = TRUE;
if(call->ourAliases)
ret = ooPopulateAliasList(pctxt, call->ourAliases,
&connect->connectedAddress);
&connect->connectedAddress, 0);
else
ret = ooPopulateAliasList(pctxt, gH323ep.aliases,
&connect->connectedAddress);
&connect->connectedAddress, 0);
if(OO_OK != ret)
{
OOTRACEERR1("Error:Failed to populate alias list in Connect message\n");
@@ -2114,7 +2114,7 @@ int ooH323MakeCall(char *dest, char *callToken, ooCallOptions *opts)
{
OOCTXT *pctxt;
OOH323CallData *call;
int ret=0, i=0, irand=0;
int ret=OO_OK, i=0, irand=0;
char tmp[30]="\0";
char *ip=NULL, *port = NULL;
struct timeval tv;
@@ -2211,14 +2211,15 @@ int ooH323MakeCall(char *dest, char *callToken, ooCallOptions *opts)
/* Send as H225 message to calling endpoint */
ast_mutex_lock(&call->Lock);
if (call->callState < OO_CALL_CLEAR)
if (call->callState < OO_CALL_CLEAR) {
if ((ret = ooH323CallAdmitted (call)) != OO_OK) {
ast_mutex_unlock(&call->Lock);
return ret;
}
} else ret = OO_FAILED;
ast_mutex_unlock(&call->Lock);
return OO_OK;
return ret;
}
@@ -2376,10 +2377,10 @@ int ooH323MakeCall_helper(OOH323CallData *call)
setup->m.sourceAddressPresent = TRUE;
if(call->ourAliases)
ret = ooPopulateAliasList(pctxt, call->ourAliases,
&setup->sourceAddress);
&setup->sourceAddress, 0);
else if(gH323ep.aliases)
ret = ooPopulateAliasList(pctxt, gH323ep.aliases,
&setup->sourceAddress);
&setup->sourceAddress, 0);
if(OO_OK != ret)
{
OOTRACEERR1("Error:Failed to populate alias list in SETUP message\n");
@@ -2404,7 +2405,7 @@ int ooH323MakeCall_helper(OOH323CallData *call)
{
setup->m.destinationAddressPresent = TRUE;
ret = ooPopulateAliasList(pctxt, call->remoteAliases,
&setup->destinationAddress);
&setup->destinationAddress, 0);
if(OO_OK != ret)
{
OOTRACEERR1("Error:Failed to populate destination alias list in SETUP"
@@ -2953,7 +2954,7 @@ int ooH323ForwardCall(char* callToken, char *dest)
{
facility->m.alternativeAliasAddressPresent = TRUE;
ret = ooPopulateAliasList(pctxt, call->pCallFwdData->aliases,
&facility->alternativeAliasAddress);
&facility->alternativeAliasAddress, 0);
if(ret != OO_OK)
{
OOTRACEERR3("Error:Failed to populate alternate aliases in "