diff options
author | Alexandr Anikin <may@telecom-service.ru> | 2010-03-27 23:51:13 +0000 |
---|---|---|
committer | Alexandr Anikin <may@telecom-service.ru> | 2010-03-27 23:51:13 +0000 |
commit | 89e4c15783ba99d59a365755db0ae3e2dca736bd (patch) | |
tree | 6d5fbaf4fe24aa97ede5aff7268ecf73b879286a /addons/ooh323c/src | |
parent | b8aeb50b7b8e5c321100b7f4a85db07d059736db (diff) |
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
Diffstat (limited to 'addons/ooh323c/src')
-rw-r--r-- | addons/ooh323c/src/ooCalls.c | 25 | ||||
-rw-r--r-- | addons/ooh323c/src/ooGkClient.c | 16 | ||||
-rw-r--r-- | addons/ooh323c/src/ooh323.c | 24 | ||||
-rw-r--r-- | addons/ooh323c/src/ooh323.h | 2 | ||||
-rw-r--r-- | addons/ooh323c/src/ooq931.c | 23 |
5 files changed, 47 insertions, 43 deletions
diff --git a/addons/ooh323c/src/ooCalls.c b/addons/ooh323c/src/ooCalls.c index 71d63092d..f92464852 100644 --- a/addons/ooh323c/src/ooCalls.c +++ b/addons/ooh323c/src/ooCalls.c @@ -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,20 +247,14 @@ int ooEndCall(OOH323CallData *call) } - if(!call->pH225Channel || call->pH225Channel->sock ==0) + if(!OO_TESTFLAG(call->flags, OO_M_RELEASE_BUILT)) { - call->callState = OO_CALL_CLEARED; - } - else{ - if(!OO_TESTFLAG(call->flags, OO_M_RELEASE_BUILT)) - { - if(call->callState == OO_CALL_CLEAR || - call->callState == OO_CALL_CLEAR_RELEASERECVD) - { - ooSendReleaseComplete(call); - OO_SETFLAG(call->flags, OO_M_RELEASE_BUILT); - } - } + if(call->callState == OO_CALL_CLEAR || + call->callState == OO_CALL_CLEAR_RELEASERECVD) + { + ooSendReleaseComplete(call); + OO_SETFLAG(call->flags, OO_M_RELEASE_BUILT); + } } return OO_OK; diff --git a/addons/ooh323c/src/ooGkClient.c b/addons/ooh323c/src/ooGkClient.c index e5c6361e4..efbf98385 100644 --- a/addons/ooh323c/src/ooGkClient.c +++ b/addons/ooh323c/src/ooGkClient.c @@ -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); diff --git a/addons/ooh323c/src/ooh323.c b/addons/ooh323c/src/ooh323.c index 8f6b4cb28..01cb7c794 100644 --- a/addons/ooh323c/src/ooh323.c +++ b/addons/ooh323c/src/ooh323.c @@ -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,23 +2243,27 @@ 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, + pAliasEntry->t = T_H225AliasAddress_dialedDigits; + pAliasEntry->u.dialedDigits = (ASN1IA5String)memAlloc(pctxt, strlen(pAlias->value)+1); - if(!pAliasEntry->u.dialedDigits) - { + if(!pAliasEntry->u.dialedDigits) + { OOTRACEERR1("ERROR:Memory - ooPopulateAliasList - " "dialedDigits\n"); memFreePtr(pctxt, pAliasEntry); return OO_FAILED; - } - strcpy(*(char**)&pAliasEntry->u.dialedDigits, pAlias->value); - bValid = TRUE; - break; */ + } + strcpy(*(char**)&pAliasEntry->u.dialedDigits, pAlias->value); + bValid = TRUE; + break; case T_H225AliasAddress_h323_ID: pAliasEntry->t = T_H225AliasAddress_h323_ID; pAliasEntry->u.h323_ID.nchars = strlen(pAlias->value); diff --git a/addons/ooh323c/src/ooh323.h b/addons/ooh323c/src/ooh323.h index 187b099f4..6b7edc21f 100644 --- a/addons/ooh323c/src/ooh323.h +++ b/addons/ooh323c/src/ooh323.h @@ -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 diff --git a/addons/ooh323c/src/ooq931.c b/addons/ooh323c/src/ooq931.c index 626f96939..7e42a22ad 100644 --- a/addons/ooh323c/src/ooq931.c +++ b/addons/ooh323c/src/ooq931.c @@ -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 " |