]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Correct crv handling.
authorMichael Jerris <mike@jerris.com>
Tue, 29 May 2007 04:13:24 +0000 (04:13 +0000)
committerMichael Jerris <mike@jerris.com>
Tue, 29 May 2007 04:13:24 +0000 (04:13 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@176 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/freetdm/src/isdn/Q931.c
libs/freetdm/src/isdn/Q931StateTE.c

index 191797d01da278c79414b3d53d41c0270f4ffaa9..f57365ecda25d064f34258cb80ab4e7a54988edf 100644 (file)
@@ -337,6 +337,10 @@ L3INT Q931Rx23(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT Size)
     /* Starting Codeset */
        m->codeset = Q931_CODESET_0;
 
+       if (m->ProtDisc != 8) {
+               return Q931E_UNKNOWN_MESSAGE;
+       }
+
     /* Call table proc to unpack codec message */
        RetCode = Q931Umes[pTrunk->Dialect][m->MesType](pTrunk, Mes, (Q931mes_Generic *)pTrunk->L3Buf, Q931L4HeaderSpace + IOff , Size - Q931L4HeaderSpace - IOff + 1);
 
@@ -533,7 +537,7 @@ L3INT       Q931GetCallState(Q931_TrunkInfo_t *pTrunk, L3INT iCRV)
     L3INT x;
        for(x=0; x < Q931MAXCALLPERTRUNK; x++)
        {
-               if(!pTrunk->call[x].InUse)
+               if(pTrunk->call[x].InUse)
                {
             if(pTrunk->call[x].CRV == iCRV)
             {
@@ -601,7 +605,7 @@ L3INT Q931FindCRV(Q931_TrunkInfo_t *pTrunk, L3INT crv, L3INT *callindex)
     L3INT x;
        for(x=0; x < Q931MAXCALLPERTRUNK; x++)
        {
-               if(!pTrunk->call[x].InUse)
+               if(pTrunk->call[x].InUse)
                {
             if(pTrunk->call[x].CRV == crv)
             {
index eb9c2a38fb41591520d37ee93a897469318d7901..941d683710e03e830f00496fd071e8fcfbfdeab7 100644 (file)
@@ -793,15 +793,19 @@ L3INT Q931ProcRestartTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
     L3INT ret=Q931E_NO_ERROR;
        Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 
-       /* Find the call using CRV */
-       ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
-       if(ret != Q931E_NO_ERROR)
-               return ret;
+
+       if (pMes->CRV) {
+               /* Find the call using CRV */
+               ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
+               if(ret != Q931E_NO_ERROR)
+                       return ret;
+
+               /* TODO - Set correct timer here */
+               Q931StartTimer(pTrunk, callIndex, 303);
+       }
 
        /* TODO chack against state table for illegal or unexpected message here*/
 
-       /* TODO - Set correct timer here */
-    Q931StartTimer(pTrunk, callIndex, 303);
        if(iFrom == 4)
        {
                /* TODO Add proc here*/
@@ -826,15 +830,17 @@ L3INT Q931ProcRestartAckTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
     L3INT ret=Q931E_NO_ERROR;
        Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 
-       /* Find the call using CRV */
-       ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
-       if(ret != Q931E_NO_ERROR)
-               return ret;
+       if (pMes->CRV) {
+               /* Find the call using CRV */
+               ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
+               if(ret != Q931E_NO_ERROR)
+                       return ret;
+               /* TODO - Set correct timer here */
+               Q931StartTimer(pTrunk, callIndex, 303);
+       }
 
        /* TODO chack against state table for illegal or unexpected message here*/
 
-       /* TODO - Set correct timer here */
-    Q931StartTimer(pTrunk, callIndex, 303);
        if(iFrom == 4)
        {
                /* TODO Add proc here*/