diff --git a/libs/freetdm/src/isdn/Q931StateTE.c b/libs/freetdm/src/isdn/Q931StateTE.c index 941d683710..fbdd9f08a7 100644 --- a/libs/freetdm/src/isdn/Q931StateTE.c +++ b/libs/freetdm/src/isdn/Q931StateTE.c @@ -813,6 +813,9 @@ L3INT Q931ProcRestartTE(Q931_TrunkInfo_t *pTrunk, L3UCHAR * buf, L3INT iFrom) } else if (iFrom ==2) { + if (pTrunk->autoRestartAck) { + Q931AckRestart(pTrunk, buf); + } /* TODO Add proc here*/ ret = Q931Tx34(pTrunk,buf,pMes->Size); } diff --git a/libs/freetdm/src/isdn/Q931api.c b/libs/freetdm/src/isdn/Q931api.c index 36764e95a0..7930fa53db 100644 --- a/libs/freetdm/src/isdn/Q931api.c +++ b/libs/freetdm/src/isdn/Q931api.c @@ -39,6 +39,8 @@ #include "Q931.h" #include "memory.h" +extern L3INT Q931L4HeaderSpace; + /* L3INT Q931CreateMesIndex(L3INT mc) { @@ -109,12 +111,13 @@ L3INT Q931Api_InitTrunk(Q931_TrunkInfo_t *pTrunk, pTrunk->PrivateData32 = PrivateData32; pTrunk->PrivateData34 = PrivateData34; - pTrunk->LastCRV = 0; - pTrunk->Dialect = Dialect + NetUser; - pTrunk->Enabled = 0; - pTrunk->TrunkType = TrunkType; - pTrunk->NetUser = NetUser; - pTrunk->TrunkState = 0; + pTrunk->LastCRV = 0; + pTrunk->Dialect = Dialect + NetUser; + pTrunk->Enabled = 0; + pTrunk->TrunkType = TrunkType; + pTrunk->NetUser = NetUser; + pTrunk->TrunkState = 0; + pTrunk->autoRestartAck = 0; for(y=0; y < Q931MAXCHPERTRUNK; y++) { pTrunk->ch[y].Available = 1; @@ -541,3 +544,15 @@ L3INT Q931ReleaseComplete(Q931_TrunkInfo_t *pTrunk, L3INT iTo) return 0; } + +L3INT Q931AckRestart(Q931_TrunkInfo_t *pTrunk, L3UCHAR *buf) +{ + L3INT RetCode; + + Q931mes_Header *ptr = (Q931mes_Header*)&buf[Q931L4HeaderSpace]; + ptr->MesType = Q931mes_RESTART_ACKNOWLEDGE; + + RetCode = Q931Proc[pTrunk->Dialect][ptr->MesType](pTrunk, buf, 4); + + return RetCode; +} diff --git a/libs/freetdm/src/isdn/include/Q931.h b/libs/freetdm/src/isdn/include/Q931.h index 4e16a2a555..10a2e6e5dd 100644 --- a/libs/freetdm/src/isdn/include/Q931.h +++ b/libs/freetdm/src/isdn/include/Q931.h @@ -900,6 +900,7 @@ L3INT Q931InitIEHLComp(Q931ie_HLComp * pIE); L3INT Q931Disconnect(Q931_TrunkInfo_t *pTrunk, L3INT iTo, L3INT iCRV, L3INT iCause); L3INT Q931ReleaseComplete(Q931_TrunkInfo_t *pTrunk, L3INT iTo); +L3INT Q931AckRestart(Q931_TrunkInfo_t *pTrunk, L3UCHAR *buf); L3INT Q931Api_InitTrunk(Q931_TrunkInfo_t *pTrunk, Q931Dialect_t Dialect, diff --git a/libs/freetdm/src/zap_isdn.c b/libs/freetdm/src/zap_isdn.c index 2076419ba8..55b58e890f 100644 --- a/libs/freetdm/src/zap_isdn.c +++ b/libs/freetdm/src/zap_isdn.c @@ -72,9 +72,6 @@ static L3INT zap_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) zap_log(ZAP_LOG_DEBUG, "Yay I got an event! Type:[%d] Size:[%d]\n", gen->MesType, gen->Size); - gen->MesType = Q931mes_RESTART_ACKNOWLEDGE; - Q931Rx43(&data->q931, msg, gen->Size); - return 0; } @@ -246,7 +243,8 @@ zap_status_t zap_isdn_configure_span(zap_span_t *span, Q921NetUser_t mode, Q931D zap_isdn_931_err, &span->isdn_data->q921, span); - + + span->isdn_data->q931.autoRestartAck = 1; span->signal_type = ZAP_SIGTYPE_ISDN;