[asterisk-addons-commits] may: branch 1.6.2 r1137 - /branches/1.6.2/channels/ooh323c/src/ooGkClient.c
SVN commits to the Asterisk addons project
asterisk-addons-commits at lists.digium.com
Sat Dec 11 21:45:12 UTC 2010
Author: may
Date: Sat Dec 11 15:45:06 2010
New Revision: 1137
URL: http://svnview.digium.com/svn/asterisk-addons?view=rev&rev=1137
Log:
Correction to work with gatekeeper which don't send GK ID
Don't use GK ID if it's not presented in GK replies
Extract GK ID not only in GK confirm but in GK register confirm also
(issue #18401)
Reported by: MrHanMan
Patches:
no-gkid-2.patch uploaded by may213 (license 454)
Tested by: may213, MrHanMan
Modified:
branches/1.6.2/channels/ooh323c/src/ooGkClient.c
Modified: branches/1.6.2/channels/ooh323c/src/ooGkClient.c
URL: http://svnview.digium.com/svn/asterisk-addons/branches/1.6.2/channels/ooh323c/src/ooGkClient.c?view=diff&rev=1137&r1=1136&r2=1137
==============================================================================
--- branches/1.6.2/channels/ooh323c/src/ooGkClient.c (original)
+++ branches/1.6.2/channels/ooh323c/src/ooGkClient.c Sat Dec 11 15:45:06 2010
@@ -796,10 +796,9 @@
sizeof(ASN116BITCHAR)* pGkClient->gkId.nchars);
}
else{
- OOTRACEERR1("ERROR:No Gatekeeper ID present in received GKConfirmed "
+ OOTRACEINFO1("ERROR:No Gatekeeper ID present in received GKConfirmed "
"message\n");
- OOTRACEINFO1("Ignoring message and will retransmit GRQ after timeout\n");
- return OO_FAILED;
+ pGkClient->gkId.nchars = 0;
}
/* Extract Gatekeeper's RAS address */
@@ -954,20 +953,22 @@
return OO_FAILED;
}
- pRegReq->m.gatekeeperIdentifierPresent=TRUE;
- pRegReq->gatekeeperIdentifier.nchars = pGkClient->gkId.nchars;
- pRegReq->gatekeeperIdentifier.data = (ASN116BITCHAR*)memAlloc
+ if (pGkClient->gkId.nchars) {
+ pRegReq->m.gatekeeperIdentifierPresent=TRUE;
+ pRegReq->gatekeeperIdentifier.nchars = pGkClient->gkId.nchars;
+ pRegReq->gatekeeperIdentifier.data = (ASN116BITCHAR*)memAlloc
(pctxt, pGkClient->gkId.nchars*sizeof(ASN116BITCHAR));
- if(!pRegReq->gatekeeperIdentifier.data)
- {
+ if(!pRegReq->gatekeeperIdentifier.data)
+ {
OOTRACEERR1("Error: Failed to allocate memory for GKIdentifier in RRQ "
"message.\n");
memReset(pctxt);
pGkClient->state = GkClientFailed;
return OO_FAILED;
- }
- memcpy(pRegReq->gatekeeperIdentifier.data, pGkClient->gkId.data,
+ }
+ memcpy(pRegReq->gatekeeperIdentifier.data, pGkClient->gkId.data,
pGkClient->gkId.nchars*sizeof(ASN116BITCHAR));
+ }
ooGkClientFillVendor(pGkClient, &pRegReq->endpointVendor);
@@ -1079,7 +1080,26 @@
memcpy(pGkClient->endpointId.data,
pRegistrationConfirm->endpointIdentifier.data,
sizeof(ASN116BITCHAR)*pGkClient->endpointId.nchars);
-
+
+ /* Extract GK Identifier */
+
+ if(pRegistrationConfirm->m.gatekeeperIdentifierPresent && pGkClient->gkId.nchars == 0)
+ {
+ pGkClient->gkId.nchars = pRegistrationConfirm->gatekeeperIdentifier.nchars;
+ pGkClient->gkId.data = (ASN116BITCHAR*)memAlloc(&pGkClient->ctxt,
+ sizeof(ASN116BITCHAR)*pGkClient->gkId.nchars);
+ if(!pGkClient->gkId.data)
+ {
+ OOTRACEERR1("Error:Failed to allocate memory for GK ID data\n");
+ pGkClient->state = GkClientFailed;
+ return OO_FAILED;
+ }
+
+ memcpy(pGkClient->gkId.data,
+ pRegistrationConfirm->gatekeeperIdentifier.data,
+ sizeof(ASN116BITCHAR)* pGkClient->gkId.nchars);
+ }
+
/* Extract CallSignalling Address */
for(i=0; i<(int)pRegistrationConfirm->callSignalAddress.count; i++)
{
@@ -1362,20 +1382,22 @@
sizeof(ASN116BITCHAR)*pGkClient->endpointId.nchars);
/* Populate gatekeeper identifier */
- pUnregReq->m.gatekeeperIdentifierPresent = TRUE;
- pUnregReq->gatekeeperIdentifier.nchars = pGkClient->gkId.nchars;
- pUnregReq->gatekeeperIdentifier.data = (ASN116BITCHAR*)memAlloc(pctxt,
+ if (pGkClient->gkId.nchars) {
+ pUnregReq->m.gatekeeperIdentifierPresent = TRUE;
+ pUnregReq->gatekeeperIdentifier.nchars = pGkClient->gkId.nchars;
+ pUnregReq->gatekeeperIdentifier.data = (ASN116BITCHAR*)memAlloc(pctxt,
sizeof(ASN116BITCHAR)*pGkClient->gkId.nchars);
- if(!pUnregReq->gatekeeperIdentifier.data)
- {
+ if(!pUnregReq->gatekeeperIdentifier.data)
+ {
OOTRACEERR1("Error:Failed to allocate memory for GKID of URQ message\n");
memReset(pctxt);
pGkClient->state = GkClientFailed;
return OO_FAILED;
- }
- memcpy((void*)pUnregReq->gatekeeperIdentifier.data,
+ }
+ memcpy((void*)pUnregReq->gatekeeperIdentifier.data,
(void*)pGkClient->gkId.data,
sizeof(ASN116BITCHAR)*pGkClient->gkId.nchars);
+ }
/* Check whether specific aliases are to be unregistered*/
if(aliases)
@@ -1675,20 +1697,22 @@
sizeof(H225CallIdentifier));
/* Populate Gatekeeper Id */
- pAdmReq->m.gatekeeperIdentifierPresent = TRUE;
- pAdmReq->gatekeeperIdentifier.nchars = pGkClient->gkId.nchars;
- pAdmReq->gatekeeperIdentifier.data = (ASN116BITCHAR*)memAlloc(pctxt,
+ if (pGkClient->gkId.nchars) {
+ pAdmReq->m.gatekeeperIdentifierPresent = TRUE;
+ pAdmReq->gatekeeperIdentifier.nchars = pGkClient->gkId.nchars;
+ pAdmReq->gatekeeperIdentifier.data = (ASN116BITCHAR*)memAlloc(pctxt,
sizeof(ASN116BITCHAR)*pGkClient->gkId.nchars);
- if(!pAdmReq->gatekeeperIdentifier.data)
- {
+ if(!pAdmReq->gatekeeperIdentifier.data)
+ {
OOTRACEERR1("Error:Failed to allocate memory for GKID of ARQ message\n");
memReset(pctxt);
pGkClient->state = GkClientFailed;
return OO_FAILED;
- }
- memcpy((void*)pAdmReq->gatekeeperIdentifier.data,
+ }
+ memcpy((void*)pAdmReq->gatekeeperIdentifier.data,
(void*)pGkClient->gkId.data,
sizeof(ASN116BITCHAR)*pGkClient->gkId.nchars);
+ }
pAdmReq->m.willSupplyUUIEsPresent = 1;
pAdmReq->willSupplyUUIEs = FALSE;
@@ -2031,19 +2055,22 @@
pDRQ->m.callIdentifierPresent = 1;
memcpy((void*)&pDRQ->callIdentifier, (void*)&call->callIdentifier,
sizeof(H225CallIdentifier));
- pDRQ->m.gatekeeperIdentifierPresent = 1;
- pDRQ->gatekeeperIdentifier.nchars = pGkClient->gkId.nchars;
- pDRQ->gatekeeperIdentifier.data = (ASN116BITCHAR*)memAlloc
+
+ if (pGkClient->gkId.nchars) {
+ pDRQ->m.gatekeeperIdentifierPresent = 1;
+ pDRQ->gatekeeperIdentifier.nchars = pGkClient->gkId.nchars;
+ pDRQ->gatekeeperIdentifier.data = (ASN116BITCHAR*)memAlloc
(pctxt, pGkClient->gkId.nchars*sizeof(ASN116BITCHAR));
- if(!pDRQ->gatekeeperIdentifier.data)
- {
+ if(!pDRQ->gatekeeperIdentifier.data)
+ {
OOTRACEERR1("Error:Failed to allocate memory for GKId in DRQ.\n");
memReset(pctxt);
pGkClient->state = GkClientFailed;
return OO_FAILED;
- }
- memcpy(pDRQ->gatekeeperIdentifier.data, pGkClient->gkId.data,
+ }
+ memcpy(pDRQ->gatekeeperIdentifier.data, pGkClient->gkId.data,
pGkClient->gkId.nchars*sizeof(ASN116BITCHAR));
+ }
pDRQ->m.terminationCausePresent = 1;
pDRQ->terminationCause.t = T_H225CallTerminationCause_releaseCompleteCauseIE;
More information about the asterisk-addons-commits
mailing list