root/src/isdn/Q931StateNT.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. Q931CreateNT
  2. Q931ProcAlertingNT
  3. Q931ProcCallProceedingNT
  4. Q931ProcConnectNT
  5. Q931ProcConnectAckNT
  6. Q931ProcProgressNT
  7. Q931ProcSetupNT
  8. Q931ProcSetupAckNT
  9. Q931ProcResumeNT
  10. Q931ProcResumeAckNT
  11. Q931ProcResumeRejectNT
  12. Q931ProcSuspendNT
  13. Q931ProcSuspendAckNT
  14. Q931ProcSuspendRejectNT
  15. Q931ProcUserInformationNT
  16. Q931ProcDisconnectNT
  17. Q931ProcReleaseNT
  18. Q931ProcReleaseCompleteNT
  19. Q931ProcRestartNT
  20. Q931ProcRestartAckNT
  21. Q931ProcCongestionControlNT
  22. Q931ProcInformationNT
  23. Q931ProcNotifyNT
  24. Q931ProcStatusNT
  25. Q931ProcStatusEnquiryNT
  26. Q931ProcSegmentNT
  27. Q932ProcFacilityNT
  28. Q932ProcHoldNT
  29. Q932ProcHoldAckNT
  30. Q932ProcHoldRejectNT
  31. Q932ProcRegisterNT
  32. Q932ProcRetrieveNT
  33. Q932ProcRetrieveAckNT
  34. Q932ProcRetrieveRejectNT

   1 /*****************************************************************************
   2 
   3   FileName:             q931StateNT.c
   4 
   5   Contents:             Q.931 State Engine for NT (Network Mode).
   6 
   7                         The controlling state engine for Q.931 is the state engine
   8                         on the NT side. The state engine on the TE side is a slave 
   9                         of this. The TE side maintain it's own states as described in
  10                         ITU-T Q931, but will in raise conditions be overridden by 
  11                         the NT side.
  12 
  13   License/Copyright:
  14 
  15   Copyright (c) 2007, Jan Vidar Berger, Case Labs, Ltd. All rights reserved.
  16   email:janvb@caselaboratories.com  
  17 
  18   Redistribution and use in source and binary forms, with or without 
  19   modification, are permitted provided that the following conditions are 
  20   met:
  21 
  22         * Redistributions of source code must retain the above copyright notice, 
  23           this list of conditions and the following disclaimer.
  24         * Redistributions in binary form must reproduce the above copyright notice, 
  25           this list of conditions and the following disclaimer in the documentation 
  26           and/or other materials provided with the distribution.
  27         * Neither the name of the Case Labs, Ltd nor the names of its contributors 
  28           may be used to endorse or promote products derived from this software 
  29           without specific prior written permission.
  30 
  31   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
  32   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
  33   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
  34   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
  35   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
  36   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
  37   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
  38   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
  39   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
  40   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
  41   POSSIBILITY OF SUCH DAMAGE.
  42 *****************************************************************************/
  43 
  44 #include "Q931.h"
  45 
  46 extern L3INT Q931L4HeaderSpace;
  47 
  48 /*****************************************************************************
  49   Function:             Q931CreateNT
  50 
  51   Description:  Will create the Q931 NT as a Dialect in the stack. The first
  52                                 bulk set up the message handlers, the second bulk the IE
  53                                 encoders/coders, and the last bulk set up the state table.
  54 
  55   Parameters:   i               Dialect index
  56 *****************************************************************************/
  57 void Q931CreateNT(L3UCHAR i)
  58 {
  59         Q931SetMesProc(Q931mes_ALERTING,             i, Q931ProcAlertingNT,          Q931Umes_Alerting,          Q931Pmes_Alerting);
  60         Q931SetMesProc(Q931mes_CALL_PROCEEDING,      i, Q931ProcCallProceedingNT,    Q931Umes_CallProceeding,    Q931Pmes_CallProceeding);
  61         Q931SetMesProc(Q931mes_CONNECT,              i, Q931ProcConnectNT,           Q931Umes_Connect,           Q931Pmes_Connect);
  62         Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE,  i, Q931ProcConnectAckNT,        Q931Umes_ConnectAck,        Q931Pmes_ConnectAck);
  63         Q931SetMesProc(Q931mes_PROGRESS,             i, Q931ProcProgressNT,          Q931Umes_Progress,          Q931Pmes_Progress);
  64         Q931SetMesProc(Q931mes_SETUP,                i, Q931ProcSetupNT,             Q931Umes_Setup,             Q931Pmes_Setup);
  65         Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE,    i, Q931ProcSetupAckNT,          Q931Umes_SetupAck,          Q931Pmes_SetupAck);
  66         Q931SetMesProc(Q931mes_RESUME,               i, Q931ProcResumeNT,            Q931Umes_Resume,            Q931Pmes_Resume);
  67         Q931SetMesProc(Q931mes_RESUME_ACKNOWLEDGE,   i, Q931ProcResumeAckNT,         Q931Umes_ResumeAck,         Q931Pmes_ResumeAck);
  68         Q931SetMesProc(Q931mes_RESUME_REJECT,        i, Q931ProcResumeRejectNT,      Q931Umes_ResumeReject,      Q931Pmes_ResumeReject);
  69         Q931SetMesProc(Q931mes_SUSPEND,              i, Q931ProcSuspendNT,           Q931Umes_Suspend,           Q931Pmes_Suspend);
  70         Q931SetMesProc(Q931mes_SUSPEND_ACKNOWLEDGE,  i, Q931ProcSuspendAckNT,        Q931Umes_SuspendAck,        Q931Pmes_SuspendAck);
  71         Q931SetMesProc(Q931mes_SUSPEND_REJECT,       i, Q931ProcSuspendRejectNT,     Q931Umes_SuspendReject,     Q931Pmes_SuspendReject);
  72         Q931SetMesProc(Q931mes_USER_INFORMATION,     i, Q931ProcUserInformationNT,   Q931Umes_UserInformation,   Q931Pmes_UserInformation);
  73         Q931SetMesProc(Q931mes_DISCONNECT,           i, Q931ProcDisconnectNT,        Q931Umes_Disconnect,        Q931Pmes_Disconnect);
  74         Q931SetMesProc(Q931mes_RELEASE,              i, Q931ProcReleaseNT,           Q931Umes_Release,           Q931Pmes_Release);
  75         Q931SetMesProc(Q931mes_RELEASE_COMPLETE,     i, Q931ProcReleaseCompleteNT,   Q931Umes_ReleaseComplete,   Q931Pmes_ReleaseComplete);
  76         Q931SetMesProc(Q931mes_RESTART,              i, Q931ProcRestartNT,           Q931Umes_Restart,           Q931Pmes_Restart);
  77         Q931SetMesProc(Q931mes_RESTART_ACKNOWLEDGE,  i, Q931ProcRestartAckNT,        Q931Umes_RestartAck,        Q931Pmes_RestartAck);
  78         Q931SetMesProc(Q931mes_CONGESTION_CONTROL,   i, Q931ProcCongestionControlNT, Q931Umes_CongestionControl, Q931Pmes_CongestionControl);
  79         Q931SetMesProc(Q931mes_INFORMATION,          i, Q931ProcInformationNT,       Q931Umes_Information,       Q931Pmes_Information);
  80         Q931SetMesProc(Q931mes_NOTIFY,               i, Q931ProcNotifyNT,            Q931Umes_Notify,            Q931Pmes_Notify);
  81         Q931SetMesProc(Q931mes_STATUS,               i, Q931ProcStatusNT,            Q931Umes_Status,            Q931Pmes_Status);
  82         Q931SetMesProc(Q931mes_STATUS_ENQUIRY,       i, Q931ProcStatusEnquiryNT,     Q931Umes_StatusEnquiry,     Q931Pmes_StatusEnquiry);
  83         Q931SetMesProc(Q931mes_SEGMENT,              i, Q931ProcSegmentNT,           Q931Umes_Segment,           Q931Pmes_Segment);
  84 
  85         Q931SetMesProc(Q932mes_FACILITY,             i, Q932ProcFacilityNT,          Q932Umes_Facility,          Q932Pmes_Facility);
  86         Q931SetMesProc(Q932mes_HOLD,                 i, Q932ProcHoldNT,              Q932Umes_Hold,              Q932Pmes_Hold);
  87         Q931SetMesProc(Q932mes_HOLD_ACKNOWLEDGE,     i, Q932ProcHoldAckNT,           Q932Umes_HoldAck,           Q932Pmes_HoldAck);
  88         Q931SetMesProc(Q932mes_HOLD_REJECT,          i, Q932ProcHoldRejectNT,        Q932Umes_HoldReject,        Q932Pmes_HoldReject);
  89         Q931SetMesProc(Q932mes_REGISTER,             i, Q932ProcRegisterNT,          Q932Umes_Register,          Q932Pmes_Register);
  90         Q931SetMesProc(Q932mes_RETRIEVE,             i, Q932ProcRetrieveNT,          Q932Umes_Retrieve,          Q932Pmes_Retrieve);
  91         Q931SetMesProc(Q932mes_RETRIEVE_ACKNOWLEDGE, i, Q932ProcRetrieveAckNT,       Q932Umes_RetrieveAck,       Q932Pmes_RetrieveAck);
  92         Q931SetMesProc(Q932mes_RETRIEVE_REJECT,      i, Q932ProcRetrieveRejectNT,    Q932Umes_RetrieveReject,    Q932Pmes_RetrieveReject);
  93 
  94         /* Set up the IE encoder/decoder handle table.*/ 
  95         Q931SetIEProc(Q931ie_SEGMENTED_MESSAGE,                i, Q931Pie_Segment,     Q931Uie_Segment);
  96         Q931SetIEProc(Q931ie_BEARER_CAPABILITY,                i, Q931Pie_BearerCap,   Q931Uie_BearerCap);
  97         Q931SetIEProc(Q931ie_CAUSE,                            i, Q931Pie_Cause,       Q931Uie_Cause);
  98         Q931SetIEProc(Q931ie_CALL_IDENTITY,                    i, Q931Pie_CallID,      Q931Uie_CallID);
  99         Q931SetIEProc(Q931ie_CALL_STATE,                       i, Q931Pie_CallState,   Q931Uie_CallState);
 100         Q931SetIEProc(Q931ie_CHANNEL_IDENTIFICATION,           i, Q931Pie_ChanID,      Q931Uie_ChanID);
 101         Q931SetIEProc(Q931ie_PROGRESS_INDICATOR,               i, Q931Pie_ProgInd,     Q931Uie_ProgInd);
 102         Q931SetIEProc(Q931ie_NETWORK_SPECIFIC_FACILITIES,      i, Q931Pie_NetFac,      Q931Uie_NetFac);
 103         Q931SetIEProc(Q931ie_NOTIFICATION_INDICATOR,           i, Q931Pie_NotifInd,    Q931Uie_NotifInd);
 104         Q931SetIEProc(Q931ie_DISPLAY,                          i, Q931Pie_Display,     Q931Uie_Display);
 105         Q931SetIEProc(Q931ie_DATETIME,                         i, Q931Pie_DateTime,    Q931Uie_DateTime);
 106         Q931SetIEProc(Q931ie_KEYPAD_FACILITY,                  i, Q931Pie_KeypadFac,   Q931Uie_KeypadFac);
 107         Q931SetIEProc(Q931ie_SIGNAL,                           i, Q931Pie_Signal,      Q931Uie_Signal);
 108         Q931SetIEProc(Q931ie_TRANSIT_DELAY_SELECTION_AND_IND,  i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
 109         Q931SetIEProc(Q931ie_CALLING_PARTY_NUMBER,             i, Q931Pie_CallingNum,  Q931Uie_CallingNum);
 110         Q931SetIEProc(Q931ie_CALLING_PARTY_SUBADDRESS,         i, Q931Pie_CallingSub,  Q931Uie_CallingSub);
 111         Q931SetIEProc(Q931ie_CALLED_PARTY_NUMBER,              i, Q931Pie_CalledNum,   Q931Uie_CalledNum);
 112         Q931SetIEProc(Q931ie_CALLED_PARTY_SUBADDRESS,          i, Q931Pie_CalledSub,   Q931Uie_CalledSub);
 113         Q931SetIEProc(Q931ie_TRANSIT_NETWORK_SELECTION,        i, Q931Pie_TransNetSel, Q931Uie_TransNetSel);
 114         Q931SetIEProc(Q931ie_RESTART_INDICATOR,                i, Q931Pie_RestartInd,  Q931Uie_RestartInd);
 115         Q931SetIEProc(Q931ie_LOW_LAYER_COMPATIBILITY,          i, Q931Pie_LLComp,      Q931Uie_LLComp);
 116         Q931SetIEProc(Q931ie_HIGH_LAYER_COMPATIBILITY,         i, Q931Pie_HLComp,      Q931Uie_HLComp);
 117         Q931SetIEProc(Q931ie_USER_USER,                        i, Q931Pie_UserUser,    Q931Uie_UserUser);
 118 
 119         Q931SetIEProc(Q931ie_CONNECTED_NUMBER,   i, Q931Pie_Generic, Q931Uie_Generic);
 120         Q931SetIEProc(Q931ie_FACILITY,           i, Q931Pie_Generic, Q931Uie_Generic);
 121         Q931SetIEProc(Q931ie_REDIRECTING_NUMBER, i, Q931Pie_Generic, Q931Uie_Generic);
 122 
 123         /* The following define a state machine. The point is that the Message
 124          * procs can when search this to find out if the message/state
 125          * combination is legale. If not, the proc for unexpected message apply.
 126          */
 127 
 128         /* TODO define state table here */
 129 
 130         /* Timer default values */
 131         Q931SetTimerDefault(i, Q931_TIMER_T301, 180000);        /* T301: 180s */
 132         Q931SetTimerDefault(i, Q931_TIMER_T302,  15000);        /* T302:  15s */
 133         Q931SetTimerDefault(i, Q931_TIMER_T303,   4000);        /* T303:   4s */
 134         Q931SetTimerDefault(i, Q931_TIMER_T304,  20000);        /* T304:  20s */
 135         Q931SetTimerDefault(i, Q931_TIMER_T305,  30000);        /* T305:  30s */
 136         Q931SetTimerDefault(i, Q931_TIMER_T306,  30000);        /* T306:  30s */
 137         Q931SetTimerDefault(i, Q931_TIMER_T307, 180000);        /* T307: 180s */
 138         Q931SetTimerDefault(i, Q931_TIMER_T308,   4000);        /* T308:   4s */
 139         Q931SetTimerDefault(i, Q931_TIMER_T309,  60000);        /* T309:  60s */
 140         Q931SetTimerDefault(i, Q931_TIMER_T310,  10000);        /* T310:  10s */
 141         Q931SetTimerDefault(i, Q931_TIMER_T312,  12000);        /* T312:  12s */
 142         Q931SetTimerDefault(i, Q931_TIMER_T314,   4000);        /* T314:   4s */
 143         Q931SetTimerDefault(i, Q931_TIMER_T316, 120000);        /* T316: 120s */
 144         Q931SetTimerDefault(i, Q931_TIMER_T317,  90000);        /* T317:  90s */
 145         Q931SetTimerDefault(i, Q931_TIMER_T320,  30000);        /* T320:  30s */
 146         Q931SetTimerDefault(i, Q931_TIMER_T321,  30000);        /* T321:  30s */
 147         Q931SetTimerDefault(i, Q931_TIMER_T322,   4000);        /* T322:   4s */
 148 }
 149 
 150 /*****************************************************************************
 151 
 152   Function:             Q931ProcAlertingNT
 153 
 154 *****************************************************************************/
 155 L3INT Q931ProcAlertingNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 156 {
 157         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 158         L3INT callIndex;
 159         L3INT ret = Q931E_NO_ERROR;
 160 
 161         /* Find the call using CRV */
 162         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 163         if (ret != Q931E_NO_ERROR)
 164                 return ret;
 165 
 166         /* Reset 4 sec timer. */
 167         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 168         if (iFrom == 4) {
 169                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 170         }
 171         else if (iFrom == 2) {
 172                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 173         }
 174         return ret;
 175 }
 176 
 177 /*****************************************************************************
 178 
 179   Function:             Q931ProcCallProceedingNT
 180 
 181 *****************************************************************************/
 182 L3INT Q931ProcCallProceedingNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 183 {
 184         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 185         L3INT callIndex;
 186         L3INT ret = Q931E_NO_ERROR;
 187 
 188         /* Find the call using CRV */
 189         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 190         if (ret != Q931E_NO_ERROR)
 191                 return ret;
 192 
 193         /* TODO chack against state table for illegal or unexpected message here*/
 194 
 195         /* TODO - Set correct timer here */
 196         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 197         if (iFrom == 4) {
 198                 /* TODO Add proc here */
 199                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 200         }
 201         else if (iFrom == 2) {
 202                 /* TODO Add proc here */
 203                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 204         }
 205         return ret;
 206 }
 207 
 208 /*****************************************************************************
 209 
 210   Function:             Q931ProcConnectNT
 211 
 212 *****************************************************************************/
 213 L3INT Q931ProcConnectNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 214 {
 215         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 216         L3INT callIndex;
 217         L3INT ret = Q931E_NO_ERROR;
 218 
 219         /* Find the call using CRV */
 220         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 221         if (ret != Q931E_NO_ERROR)
 222                 return ret;
 223 
 224         /* TODO chack against state table for illegal or unexpected message here*/
 225 
 226         /* TODO - Set correct timer here */
 227         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 228         if (iFrom == 4) {
 229                 /* TODO Add proc here */
 230                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 231         }
 232         else if (iFrom == 2) {
 233                 /* TODO Add proc here */
 234                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 235         }
 236         return ret;
 237 }
 238 
 239 /*****************************************************************************
 240 
 241   Function:             Q931ProcConnectAckNT
 242 
 243 *****************************************************************************/
 244 L3INT Q931ProcConnectAckNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 245 {
 246         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 247         L3INT callIndex;
 248         L3INT ret = Q931E_NO_ERROR;
 249 
 250         /* Find the call using CRV */
 251         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 252         if (ret != Q931E_NO_ERROR)
 253                 return ret;
 254 
 255         /* TODO chack against state table for illegal or unexpected message here*/
 256 
 257         /* TODO - Set correct timer here */
 258         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 259         if (iFrom == 4) {
 260                 /* TODO Add proc here */
 261                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 262         }
 263         else if (iFrom == 2) {
 264                 /* TODO Add proc here */
 265                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 266         }
 267         return ret;
 268 }
 269 
 270 /*****************************************************************************
 271 
 272   Function:             Q931ProcProgressNT
 273 
 274 *****************************************************************************/
 275 L3INT Q931ProcProgressNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 276 {
 277         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 278         L3INT callIndex;
 279         L3INT ret = Q931E_NO_ERROR;
 280 
 281         /* Find the call using CRV */
 282         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 283         if (ret != Q931E_NO_ERROR)
 284                 return ret;
 285 
 286         /* TODO chack against state table for illegal or unexpected message here*/
 287 
 288         /* TODO - Set correct timer here */
 289         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 290         if (iFrom == 4) {
 291                 /* TODO Add proc here */
 292                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 293         }
 294         else if (iFrom == 2) {
 295                 /* TODO Add proc here */
 296                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 297         }
 298         return ret;
 299 }
 300 
 301 /*****************************************************************************
 302 
 303   Function:             Q931ProcSetupNT
 304 
 305   Description:  Process a SETUP message.
 306 
 307  *****************************************************************************/
 308 L3INT Q931ProcSetupNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 309 {
 310         Q931mes_Generic *pMes = (Q931mes_Generic *)&buf[Q931L4HeaderSpace];
 311         L3INT rc = 0;
 312         L3INT callIndex;
 313         L3INT ret = Q931E_NO_ERROR;
 314 
 315         /* Reject SETUP on existing calls */
 316         if (Q931GetCallState(pTrunk, pMes->CRV) != Q931_U0) {
 317                 Q931Disconnect(pTrunk, iFrom, pMes->CRV, 81);
 318                 return Q931E_UNEXPECTED_MESSAGE;
 319         }
 320 
 321         /* outgoing call */
 322         if (iFrom == 4) {
 323                 ret = Q931CreateCRV(pTrunk, &callIndex);
 324                 if (ret)
 325                         return ret;
 326 
 327                 pMes->CRV = pTrunk->call[callIndex].CRV;
 328 
 329                 /*
 330                  * Outgoing SETUP message will be broadcasted in PTMP mode
 331                  */
 332                 ret = Q931Tx32Data(pTrunk, Q931_IS_PTP(pTrunk) ? 0 : 1, buf, pMes->Size);
 333                 if (ret)
 334                         return ret;
 335 
 336                 Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 337                 Q931SetState(pTrunk, callIndex, Q931_U1);
 338         }
 339         /* incoming call */
 340         else {
 341                 /* Locate free CRV entry and store info */
 342                 ret = Q931AllocateCRV(pTrunk, pMes->CRV, &callIndex);
 343                 if (ret != Q931E_NO_ERROR) {
 344                         /* Not possible to allocate CRV entry, so must reject call */
 345                         Q931Disconnect(pTrunk, iFrom, pMes->CRV, 42);
 346                         return ret;
 347                 }
 348 
 349                 /* store TEI in call */
 350                 pTrunk->call[callIndex].Tei = pMes->Tei;
 351 
 352                 /* Send setup indication to user */
 353                 ret = Q931Tx34(pTrunk, (L3UCHAR*)pMes, pMes->Size);
 354                 if (ret != Q931E_NO_ERROR) {
 355                         return ret;
 356                 } else {
 357                         /* Must be full queue, meaning we can't process the call */
 358                         /* so we must disconnect */
 359                         Q931Disconnect(pTrunk, iFrom, pMes->CRV, 81);
 360                         return ret;
 361                 }
 362 #if 0
 363                 /* TODO: Unreachable code??? */
 364                 /* Set state U6 */
 365                 Q931SetState(pTrunk, callIndex, Q931_U6);
 366                 Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 367 #endif
 368         }
 369 
 370         return rc;
 371 }
 372 
 373 /*****************************************************************************
 374 
 375   Function:             Q931ProcSetupAckNT
 376 
 377   Description:  Used to acknowedge a SETUP. Usually the first initial
 378                                 response recevide back used to buy some time.
 379 
 380                                 Note that ChanID (B Channel Assignment) might come here from
 381                                 NT side.
 382 
 383 *****************************************************************************/
 384 L3INT Q931ProcSetupAckNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 385 {
 386         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 387         L3INT callIndex;
 388         L3INT ret = Q931E_NO_ERROR;
 389 
 390         /* Find the call using CRV */
 391         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 392         if (ret != Q931E_NO_ERROR)
 393                 return ret;
 394 
 395         /* TODO chack against state table for illegal or unexpected message here*/
 396 
 397         /* TODO - Set correct timer here */
 398         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 399         if (iFrom == 4) {
 400                 /* TODO Add proc here */
 401                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 402         }
 403         else if (iFrom == 2) {
 404                 /* TODO Add proc here */
 405                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 406         }
 407         return ret;
 408 }
 409 
 410 /*****************************************************************************
 411 
 412   Function:             Q931ProcResumeNT
 413 
 414 *****************************************************************************/
 415 L3INT Q931ProcResumeNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 416 {
 417         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 418         L3INT callIndex;
 419         L3INT ret = Q931E_NO_ERROR;
 420 
 421         /* Find the call using CRV */
 422         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 423         if (ret != Q931E_NO_ERROR)
 424                 return ret;
 425 
 426         /* TODO chack against state table for illegal or unexpected message here */
 427 
 428         /* TODO - Set correct timer here */
 429         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 430         if (iFrom == 4) {
 431                 /* TODO Add proc here */
 432                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 433         }
 434         else if (iFrom == 2) {
 435                 /* TODO Add proc here */
 436                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 437         }
 438         return ret;
 439 }
 440 
 441 /*****************************************************************************
 442 
 443   Function:             Q931ProcResumeAckNT
 444 
 445 *****************************************************************************/
 446 L3INT Q931ProcResumeAckNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 447 {
 448         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 449         L3INT callIndex;
 450         L3INT ret = Q931E_NO_ERROR;
 451 
 452         /* Find the call using CRV */
 453         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 454         if (ret != Q931E_NO_ERROR)
 455                 return ret;
 456 
 457         /* TODO chack against state table for illegal or unexpected message here*/
 458 
 459         /* TODO - Set correct timer here */
 460         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 461         if (iFrom == 4) {
 462                 /* TODO Add proc here */
 463                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 464         }
 465         else if (iFrom == 2) {
 466                 /* TODO Add proc here */
 467                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 468         }
 469         return ret;
 470 }
 471 
 472 /*****************************************************************************
 473 
 474   Function:             Q931ProcResumeRejectNT
 475 
 476 *****************************************************************************/
 477 L3INT Q931ProcResumeRejectNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 478 {
 479         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 480         L3INT callIndex;
 481         L3INT ret = Q931E_NO_ERROR;
 482 
 483         /* Find the call using CRV */
 484         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 485         if (ret != Q931E_NO_ERROR)
 486                 return ret;
 487 
 488         /* TODO chack against state table for illegal or unexpected message here*/
 489 
 490         /* TODO - Set correct timer here */
 491         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 492         if (iFrom == 4) {
 493                 /* TODO Add proc here */
 494                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 495         }
 496         else if (iFrom == 2) {
 497                 /* TODO Add proc here */
 498                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 499         }
 500         return ret;
 501 }
 502 
 503 /*****************************************************************************
 504 
 505   Function:             Q931ProcSuspendNT
 506 
 507 *****************************************************************************/
 508 L3INT Q931ProcSuspendNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 509 {
 510         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 511         L3INT callIndex;
 512         L3INT ret = Q931E_NO_ERROR;
 513 
 514         /* Find the call using CRV */
 515         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 516         if (ret != Q931E_NO_ERROR)
 517                 return ret;
 518 
 519         /* TODO chack against state table for illegal or unexpected message here*/
 520 
 521         /* TODO - Set correct timer here */
 522         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 523         if (iFrom == 4) {
 524                 /* TODO Add proc here */
 525                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 526         }
 527         else if (iFrom == 2) {
 528                 /* TODO Add proc here */
 529                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 530         }
 531         return ret;
 532 }
 533 
 534 /*****************************************************************************
 535 
 536   Function:             Q931ProcSuspendAckNT
 537 
 538 *****************************************************************************/
 539 L3INT Q931ProcSuspendAckNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 540 {
 541         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 542         L3INT callIndex;
 543         L3INT ret = Q931E_NO_ERROR;
 544 
 545         /* Find the call using CRV */
 546         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 547         if (ret != Q931E_NO_ERROR)
 548                 return ret;
 549 
 550         /* TODO chack against state table for illegal or unexpected message here*/
 551 
 552         /* TODO - Set correct timer here */
 553         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 554         if (iFrom == 4) {
 555                 /* TODO Add proc here */
 556                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 557         }
 558         else if (iFrom == 2) {
 559                 /* TODO Add proc here */
 560                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 561         }
 562         return ret;
 563 }
 564 
 565 /*****************************************************************************
 566 
 567   Function:             Q931ProcSuspendRejectNT
 568 
 569 *****************************************************************************/
 570 L3INT Q931ProcSuspendRejectNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 571 {
 572         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 573         L3INT callIndex;
 574         L3INT ret = Q931E_NO_ERROR;
 575 
 576         /* Find the call using CRV */
 577         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 578         if (ret != Q931E_NO_ERROR)
 579                 return ret;
 580 
 581         /* TODO chack against state table for illegal or unexpected message here*/
 582 
 583         /* TODO - Set correct timer here */
 584         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 585         if (iFrom == 4) {
 586                 /* TODO Add proc here */
 587                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 588         }
 589         else if (iFrom == 2) {
 590                 /* TODO Add proc here */
 591                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 592         }
 593         return ret;
 594 }
 595 
 596 /*****************************************************************************
 597 
 598   Function:             Q931ProcInformationNT
 599 
 600 *****************************************************************************/
 601 L3INT Q931ProcUserInformationNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 602 {
 603         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 604         L3INT callIndex;
 605         L3INT ret = Q931E_NO_ERROR;
 606 
 607         /* Find the call using CRV */
 608         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 609         if (ret != Q931E_NO_ERROR)
 610                 return ret;
 611 
 612         /* TODO chack against state table for illegal or unexpected message here*/
 613 
 614         /* TODO - Set correct timer here */
 615         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 616         if (iFrom == 4) {
 617                 /* TODO Add proc here */
 618                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 619         }
 620         else if (iFrom == 2) {
 621                 /* TODO Add proc here */
 622                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 623         }
 624         return ret;
 625 }
 626 
 627 /*****************************************************************************
 628 
 629   Function:             Q931ProcDisconnectNT
 630 
 631 *****************************************************************************/
 632 L3INT Q931ProcDisconnectNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 633 {
 634         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 635         L3INT callIndex;
 636         L3INT ret = Q931E_NO_ERROR;
 637 
 638         /* Find the call using CRV */
 639         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 640         if (ret != Q931E_NO_ERROR)
 641                 return ret;
 642 
 643         /* TODO chack against state table for illegal or unexpected message here*/
 644 
 645         /* TODO - Set correct timer here */
 646         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 647         if (iFrom == 4) {
 648                 /* TODO Add proc here */
 649                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 650         }
 651         else if (iFrom == 2) {
 652                 /* TODO Add proc here */
 653                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 654         }
 655         return ret;
 656 }
 657 
 658 /*****************************************************************************
 659 
 660   Function:             Q931ProcReleaseNT
 661 
 662 *****************************************************************************/
 663 L3INT Q931ProcReleaseNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 664 {
 665         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 666         L3INT callIndex;
 667         L3INT ret = Q931E_NO_ERROR;
 668 
 669         /* Find the call using CRV */
 670         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 671         if (ret != Q931E_NO_ERROR)
 672                 return ret;
 673 
 674         /* TODO chack against state table for illegal or unexpected message here*/
 675 
 676         /* TODO - Set correct timer here */
 677         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 678         if (iFrom == 4) {
 679                 /* TODO Add proc here */
 680                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 681         }
 682         else if (iFrom == 2) {
 683                 /* TODO Add proc here */
 684                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 685         }
 686         return ret;
 687 }
 688 
 689 /*****************************************************************************
 690 
 691   Function:             Q931ProcReleaseCompleteNT
 692 
 693 *****************************************************************************/
 694 L3INT Q931ProcReleaseCompleteNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 695 {
 696         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 697         L3INT callIndex;
 698         L3INT ret = Q931E_NO_ERROR;
 699 
 700         /* Find the call using CRV */
 701         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 702         if (ret != Q931E_NO_ERROR)
 703                 return ret;
 704 
 705         /* TODO chack against state table for illegal or unexpected message here*/
 706 
 707         /* TODO - Set correct timer here */
 708         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 709         if (iFrom == 4) {
 710                 /* TODO Add proc here */
 711                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 712         }
 713         else if (iFrom == 2) {
 714                 /* TODO Add proc here */
 715                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 716         }
 717         return ret;
 718 }
 719 
 720 /*****************************************************************************
 721 
 722   Function:             Q931ProcRestartNT
 723 
 724 *****************************************************************************/
 725 L3INT Q931ProcRestartNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 726 {
 727         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 728         L3INT callIndex;
 729         L3INT ret = Q931E_NO_ERROR;
 730 
 731         /* Find the call using CRV */
 732         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 733         if (ret != Q931E_NO_ERROR)
 734                 return ret;
 735 
 736         /* TODO chack against state table for illegal or unexpected message here*/
 737 
 738         /* TODO - Set correct timer here */
 739         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 740         if (iFrom == 4) {
 741                 /* TODO Add proc here */
 742                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 743         }
 744         else if (iFrom == 2) {
 745                 /* TODO Add proc here */
 746                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 747         }
 748         return ret;
 749 }
 750 
 751 /*****************************************************************************
 752 
 753   Function:             Q931ProcRestartAckNT
 754 
 755 *****************************************************************************/
 756 L3INT Q931ProcRestartAckNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 757 {
 758         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 759         L3INT callIndex;
 760         L3INT ret = Q931E_NO_ERROR;
 761 
 762         /* Find the call using CRV */
 763         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 764         if (ret != Q931E_NO_ERROR)
 765                 return ret;
 766 
 767         /* TODO chack against state table for illegal or unexpected message here*/
 768 
 769         /* TODO - Set correct timer here */
 770         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 771         if (iFrom == 4) {
 772                 /* TODO Add proc here */
 773                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 774         }
 775         else if (iFrom == 2) {
 776                 /* TODO Add proc here */
 777                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 778         }
 779         return ret;
 780 }
 781 
 782 /*****************************************************************************
 783 
 784   Function:             Q931ProcCongestionControlNT
 785 
 786 *****************************************************************************/
 787 L3INT Q931ProcCongestionControlNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 788 {
 789         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 790         L3INT callIndex;
 791         L3INT ret = Q931E_NO_ERROR;
 792 
 793         /* Find the call using CRV */
 794         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 795         if (ret != Q931E_NO_ERROR)
 796                 return ret;
 797 
 798         /* TODO chack against state table for illegal or unexpected message here*/
 799 
 800         /* TODO - Set correct timer here */
 801         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 802         if (iFrom == 4) {
 803                 /* TODO Add proc here */
 804                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 805         }
 806         else if (iFrom == 2) {
 807                 /* TODO Add proc here */
 808                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 809         }
 810         return ret;
 811 }
 812 
 813 /*****************************************************************************
 814 
 815   Function:             Q931ProcInformationNT
 816 
 817 *****************************************************************************/
 818 L3INT Q931ProcInformationNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 819 {
 820         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 821         L3INT callIndex;
 822         L3INT ret = Q931E_NO_ERROR;
 823 
 824         /* Find the call using CRV */
 825         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 826         if (ret != Q931E_NO_ERROR)
 827                 return ret;
 828 
 829         /* TODO chack against state table for illegal or unexpected message here*/
 830 
 831         /* TODO - Set correct timer here */
 832         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 833         if (iFrom == 4) {
 834                 /* TODO Add proc here */
 835                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 836         }
 837         else if (iFrom == 2) {
 838                 /* TODO Add proc here */
 839                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 840         }
 841         return ret;
 842 }
 843 
 844 /*****************************************************************************
 845 
 846   Function:             Q931ProcNotifyNT
 847 
 848 *****************************************************************************/
 849 L3INT Q931ProcNotifyNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 850 {
 851         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 852         L3INT callIndex;
 853         L3INT ret = Q931E_NO_ERROR;
 854 
 855         /* Find the call using CRV */
 856         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 857         if (ret != Q931E_NO_ERROR)
 858                 return ret;
 859 
 860         /* TODO chack against state table for illegal or unexpected message here*/
 861 
 862         /* TODO - Set correct timer here */
 863         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 864         if (iFrom == 4) {
 865                 /* TODO Add proc here */
 866                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 867         }
 868         else if (iFrom == 2) {
 869                 /* TODO Add proc here */
 870                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 871         }
 872         return ret;
 873 }
 874 
 875 /*****************************************************************************
 876 
 877   Function:             Q931ProcStatusNT
 878 
 879 *****************************************************************************/
 880 L3INT Q931ProcStatusNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 881 {
 882         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 883         L3INT callIndex;
 884         L3INT ret = Q931E_NO_ERROR;
 885 
 886         /* Find the call using CRV */
 887         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 888         if (ret != Q931E_NO_ERROR)
 889                 return ret;
 890 
 891         /* TODO chack against state table for illegal or unexpected message here*/
 892 
 893         /* TODO - Set correct timer here */
 894         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 895         if (iFrom == 4) {
 896                 /* TODO Add proc here */
 897                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 898         }
 899         else if (iFrom == 2) {
 900                 /* TODO Add proc here */
 901                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 902         }
 903         return ret;
 904 }
 905 
 906 /*****************************************************************************
 907 
 908   Function:             Q931ProcStatusEnquiryNT
 909 
 910 *****************************************************************************/
 911 L3INT Q931ProcStatusEnquiryNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 912 {
 913         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 914         L3INT callIndex;
 915         L3INT ret = Q931E_NO_ERROR;
 916 
 917         /* Find the call using CRV */
 918         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 919         if (ret != Q931E_NO_ERROR)
 920                 return ret;
 921 
 922         /* TODO chack against state table for illegal or unexpected message here*/
 923 
 924         /* TODO - Set correct timer here */
 925         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 926         if (iFrom == 4) {
 927                 /* TODO Add proc here */
 928                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 929         }
 930         else if (iFrom == 2) {
 931                 /* TODO Add proc here */
 932                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 933         }
 934         return ret;
 935 }
 936 
 937 /*****************************************************************************
 938 
 939   Function:             Q931ProcSegmentNT
 940 
 941 *****************************************************************************/
 942 L3INT Q931ProcSegmentNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 943 {
 944         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 945         L3INT callIndex;
 946         L3INT ret = Q931E_NO_ERROR;
 947 
 948         /* Find the call using CRV */
 949         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 950         if (ret != Q931E_NO_ERROR)
 951                 return ret;
 952 
 953         /* TODO chack against state table for illegal or unexpected message here*/
 954 
 955         /* TODO - Set correct timer here */
 956         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 957         if (iFrom == 4) {
 958                 /* TODO Add proc here */
 959                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 960         }
 961         else if (iFrom == 2) {
 962                 /* TODO Add proc here */
 963                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 964         }
 965         return ret;
 966 }
 967 
 968 /****************************************************************************/
 969 /******************* Q.932 - Supplementary Services *************************/
 970 /****************************************************************************/
 971 
 972 /*****************************************************************************
 973 
 974   Function:             Q932ProcFacilityNT
 975 
 976 *****************************************************************************/
 977 L3INT Q932ProcFacilityNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
 978 {
 979         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
 980         L3INT callIndex;
 981         L3INT ret = Q931E_NO_ERROR;
 982 
 983         /* Find the call using CRV */
 984         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
 985         if (ret != Q931E_NO_ERROR)
 986                 return ret;
 987 
 988         /* TODO chack against state table for illegal or unexpected message here*/
 989 
 990         /* TODO - Set correct timer here */
 991         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
 992         if (iFrom == 4) {
 993                 /* TODO Add proc here */
 994                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
 995         }
 996         else if (iFrom == 2) {
 997                 /* TODO Add proc here */
 998                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
 999         }
1000         return ret;
1001 }
1002 
1003 /*****************************************************************************
1004 
1005   Function:             Q932ProcHoldNT
1006 
1007 *****************************************************************************/
1008 L3INT Q932ProcHoldNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
1009 {
1010         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
1011         L3INT callIndex;
1012         L3INT ret = Q931E_NO_ERROR;
1013 
1014         /* Find the call using CRV */
1015         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
1016         if (ret != Q931E_NO_ERROR)
1017                 return ret;
1018 
1019         /* TODO chack against state table for illegal or unexpected message here*/
1020 
1021         /* TODO - Set correct timer here */
1022         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
1023         if (iFrom == 4) {
1024                 /* TODO Add proc here */
1025                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
1026         }
1027         else if (iFrom == 2) {
1028                 /* TODO Add proc here */
1029                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
1030         }
1031         return ret;
1032 }
1033 
1034 /*****************************************************************************
1035 
1036   Function:             Q932ProcHoldAckNT
1037 
1038 *****************************************************************************/
1039 L3INT Q932ProcHoldAckNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
1040 {
1041         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
1042         L3INT callIndex;
1043         L3INT ret = Q931E_NO_ERROR;
1044 
1045         /* Find the call using CRV */
1046         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
1047         if (ret != Q931E_NO_ERROR)
1048                 return ret;
1049 
1050         /* TODO chack against state table for illegal or unexpected message here*/
1051 
1052         /* TODO - Set correct timer here */
1053         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
1054         if (iFrom == 4) {
1055                 /* TODO Add proc here */
1056                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
1057         }
1058         else if (iFrom == 2) {
1059                 /* TODO Add proc here */
1060                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
1061         }
1062         return ret;
1063 }
1064 
1065 /*****************************************************************************
1066 
1067   Function:             Q932ProcHoldRejectNT
1068 
1069 *****************************************************************************/
1070 L3INT Q932ProcHoldRejectNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
1071 {
1072         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
1073         L3INT callIndex;
1074         L3INT ret = Q931E_NO_ERROR;
1075 
1076         /* Find the call using CRV */
1077         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
1078         if (ret != Q931E_NO_ERROR)
1079                 return ret;
1080 
1081         /* TODO chack against state table for illegal or unexpected message here*/
1082 
1083         /* TODO - Set correct timer here */
1084         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
1085         if (iFrom == 4) {
1086                 /* TODO Add proc here */
1087                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
1088         }
1089         else if (iFrom == 2) {
1090                 /* TODO Add proc here */
1091                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
1092         }
1093         return ret;
1094 }
1095 
1096 /*****************************************************************************
1097 
1098   Function:             Q932ProcRegisterTE
1099 
1100 *****************************************************************************/
1101 L3INT Q932ProcRegisterNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
1102 {
1103         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
1104         L3INT callIndex;
1105         L3INT ret = Q931E_NO_ERROR;
1106 
1107         /* Find the call using CRV */
1108         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
1109         if (ret != Q931E_NO_ERROR)
1110                 return ret;
1111 
1112         /* TODO chack against state table for illegal or unexpected message here*/
1113 
1114         /* TODO - Set correct timer here */
1115         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
1116         if (iFrom == 4) {
1117                 /* TODO Add proc here */
1118                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
1119         }
1120         else if (iFrom == 2) {
1121                 /* TODO Add proc here */
1122                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
1123         }
1124         return ret;
1125 }
1126 
1127 /*****************************************************************************
1128 
1129   Function:             Q932ProcRetrieveNT
1130 
1131 *****************************************************************************/
1132 L3INT Q932ProcRetrieveNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
1133 {
1134         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
1135         L3INT callIndex;
1136         L3INT ret = Q931E_NO_ERROR;
1137 
1138         /* Find the call using CRV */
1139         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
1140         if (ret != Q931E_NO_ERROR)
1141                 return ret;
1142 
1143         /* TODO chack against state table for illegal or unexpected message here*/
1144 
1145         /* TODO - Set correct timer here */
1146         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
1147         if (iFrom == 4) {
1148                 /* TODO Add proc here */
1149                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
1150         }
1151         else if (iFrom == 2) {
1152                 /* TODO Add proc here */
1153                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
1154         }
1155         return ret;
1156 }
1157 
1158 /*****************************************************************************
1159 
1160   Function:             Q931ProcRetrieveAckNT
1161 
1162 *****************************************************************************/
1163 L3INT Q932ProcRetrieveAckNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
1164 {
1165         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
1166         L3INT callIndex;
1167         L3INT ret = Q931E_NO_ERROR;
1168 
1169         /* Find the call using CRV */
1170         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
1171         if (ret != Q931E_NO_ERROR)
1172                 return ret;
1173 
1174         /* TODO chack against state table for illegal or unexpected message here*/
1175 
1176         /* TODO - Set correct timer here */
1177         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
1178         if (iFrom == 4) {
1179                 /* TODO Add proc here */
1180                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
1181         }
1182         else if (iFrom == 2) {
1183                 /* TODO Add proc here */
1184                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
1185         }
1186         return ret;
1187 }
1188 
1189 /*****************************************************************************
1190 
1191   Function:             Q931ProcRetrieveRejectNT
1192 
1193 *****************************************************************************/
1194 L3INT Q932ProcRetrieveRejectNT(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom)
1195 {
1196         Q931mes_Header *pMes = (Q931mes_Header *)&buf[Q931L4HeaderSpace];
1197         L3INT callIndex;
1198         L3INT ret = Q931E_NO_ERROR;
1199 
1200         /* Find the call using CRV */
1201         ret = Q931FindCRV(pTrunk, pMes->CRV, &callIndex);
1202         if (ret != Q931E_NO_ERROR)
1203                 return ret;
1204 
1205         /* TODO chack against state table for illegal or unexpected message here*/
1206 
1207         /* TODO - Set correct timer here */
1208         Q931StartTimer(pTrunk, callIndex, Q931_TIMER_T303);
1209         if (iFrom == 4) {
1210                 /* TODO Add proc here */
1211                 ret = Q931Tx32Data(pTrunk, 0, buf, pMes->Size);
1212         }
1213         else if (iFrom == 2) {
1214                 /* TODO Add proc here */
1215                 ret = Q931Tx34(pTrunk, buf, pMes->Size);
1216         }
1217         return ret;
1218 }

/* [<][>][^][v][top][bottom][index][help] */