From b041edc6053e1cbd458bd40cb75d35dade86b056 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Thu, 21 Jun 2007 04:28:28 +0000 Subject: [PATCH] hack in DMS service message support git-svn-id: http://svn.openzap.org/svn/openzap/trunk@284 a93c3328-9c30-0410-af19-c9cd2b2d52af --- libs/openzap/src/isdn/Q931ie.c | 1 + libs/openzap/src/isdn/include/Q931ie.h | 2 ++ libs/openzap/src/isdn/include/national.h | 2 ++ libs/openzap/src/isdn/nationalStateTE.c | 2 +- libs/openzap/src/isdn/nationalmes.c | 39 ++++++++++++++++++++++++ 5 files changed, 45 insertions(+), 1 deletion(-) diff --git a/libs/openzap/src/isdn/Q931ie.c b/libs/openzap/src/isdn/Q931ie.c index 70a7e228e4..8d1efe8b77 100644 --- a/libs/openzap/src/isdn/Q931ie.c +++ b/libs/openzap/src/isdn/Q931ie.c @@ -2533,6 +2533,7 @@ L3INT Q931Uie_RestartInd(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *pMsg, L3UCHA /* Octet 3 */ pie->Class = IBuf[Octet+Off] & 0x07; + pie->Spare = IBuf[Octet+Off] & 0x78; Off = Q931ReadExt(&IBuf[Octet], Off); Octet++; diff --git a/libs/openzap/src/isdn/include/Q931ie.h b/libs/openzap/src/isdn/include/Q931ie.h index f6f2870db0..dbca5b3990 100644 --- a/libs/openzap/src/isdn/include/Q931ie.h +++ b/libs/openzap/src/isdn/include/Q931ie.h @@ -63,6 +63,7 @@ typedef enum { /* Variable Length Information Elements */ #define Q931ie_SEGMENTED_MESSAGE 0x00 /* 0000 0000 */ +#define Q931ie_CHANGE_STATUS 0x01 /* 0000 0001 */ #define Q931ie_BEARER_CAPABILITY 0x04 /* 0000 0100 */ #define Q931ie_CAUSE 0x08 /* 0000 1000 */ #define Q931ie_CALL_IDENTITY 0x10 /* 0001 0000 */ @@ -1060,6 +1061,7 @@ typedef struct { L3UCHAR IEId; /* 01110100 */ L3UCHAR Size; /* Length of Information Element */ + L3UCHAR Spare; /* Spare */ L3UCHAR Class; /* Class */ /* 000 Indicate channels */ /* 110 Single interface */ diff --git a/libs/openzap/src/isdn/include/national.h b/libs/openzap/src/isdn/include/national.h index f6c79ed4c9..983a6de1dc 100644 --- a/libs/openzap/src/isdn/include/national.h +++ b/libs/openzap/src/isdn/include/national.h @@ -72,6 +72,8 @@ *****************************************************************************/ L3INT nationalUmes_Setup(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *OBuf, L3INT IOff, L3INT Size); L3INT nationalPmes_Setup(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize); +L3INT DMSUmes_0x0f(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size); + /***************************************************************************** diff --git a/libs/openzap/src/isdn/nationalStateTE.c b/libs/openzap/src/isdn/nationalStateTE.c index fb2e7139c2..955453111f 100644 --- a/libs/openzap/src/isdn/nationalStateTE.c +++ b/libs/openzap/src/isdn/nationalStateTE.c @@ -67,7 +67,7 @@ void nationalCreateTE(L3UCHAR i) Q931SetMesProc(Q931mes_ALERTING, i,Q931ProcAlertingTE, Q931Umes_Alerting, Q931Pmes_Alerting); Q931SetMesProc(Q931mes_CALL_PROCEEDING, i,Q931ProcCallProceedingTE, Q931Umes_CallProceeding, Q931Pmes_CallProceeding); Q931SetMesProc(Q931mes_CONNECT, i,Q931ProcConnectTE, Q931Umes_Connect, Q931Pmes_Connect); - Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i,Q931ProcConnectAckTE, Q931Umes_ConnectAck, Q931Pmes_ConnectAck); + Q931SetMesProc(Q931mes_CONNECT_ACKNOWLEDGE, i,Q931ProcConnectAckTE, DMSUmes_0x0f, Q931Pmes_ConnectAck); Q931SetMesProc(Q931mes_PROGRESS, i,Q931ProcProgressTE, Q931Umes_Progress, Q931Pmes_Progress); Q931SetMesProc(Q931mes_SETUP, i,Q931ProcSetupTE, nationalUmes_Setup, nationalPmes_Setup); Q931SetMesProc(Q931mes_SETUP_ACKNOWLEDGE, i,Q931ProcSetupAckTE, Q931Umes_SetupAck, Q931Pmes_SetupAck); diff --git a/libs/openzap/src/isdn/nationalmes.c b/libs/openzap/src/isdn/nationalmes.c index 7dc73989e4..2f8b04394e 100644 --- a/libs/openzap/src/isdn/nationalmes.c +++ b/libs/openzap/src/isdn/nationalmes.c @@ -259,3 +259,42 @@ L3INT nationalPmes_Setup(Q931_TrunkInfo_t *pTrunk, Q931mes_Generic *IBuf, L3INT return rc; } + + +/***************************************************************************** + + Function: DMSUmes_0x0f + +*****************************************************************************/ +L3INT DMSUmes_0x0f(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) +//L3INT Q931Umes_ConnectAck(Q931_TrunkInfo_t *pTrunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size) +{ + L3INT OOff=0; + L3INT rc=Q931E_NO_ERROR; + + if (mes->ProtDisc == 8) { + Q931Umes_ConnectAck(pTrunk, IBuf, mes, IOff, Size); + } + + while(IOff < Size) + { + switch(IBuf[IOff]) + { + case Q931ie_CHANNEL_IDENTIFICATION: + rc = Q931Uie[pTrunk->Dialect][Q931ie_RESTART_INDICATOR](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + if(rc != Q931E_NO_ERROR) + return rc; + break; + case Q931ie_CHANGE_STATUS: + rc = Q931Uie[pTrunk->Dialect][IBuf[IOff]](pTrunk, mes, &IBuf[IOff], &mes->buf[OOff], &IOff, &OOff); + if(rc != Q931E_NO_ERROR) + return rc; + break; + default: + return Q931E_ILLEGAL_IE; + break; + } + } + mes->Size = sizeof(Q931mes_Generic) - 1 + OOff; + return Q931E_NO_ERROR; +}