- WARNING - Add STATUS ENQUIRY message handling to ozmod_isdn, this is a bad hack because the current OpenZAP isdn stack is not stateful (the experimental rewritten version is...) and so we have to try to map OpenZAP channel states to ISDN states, which is not possible in all cases. This patch (as long as it sends the right answer) prevents sudden disconnects of (active) calls, caused by not responding to a STATUS ENQUIRY message from the other side. - WARNING -
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@754 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
56f9cfccd3
commit
dbe8b148f4
|
@ -1013,6 +1013,61 @@ static L3INT zap_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen)
|
|||
}
|
||||
break;
|
||||
|
||||
case Q931mes_STATUS_ENQUIRY:
|
||||
{
|
||||
/*
|
||||
* !! HACK ALERT !!
|
||||
*
|
||||
* Map OpenZAP channel states to Q.931 states
|
||||
*/
|
||||
Q931ie_CallState state;
|
||||
Q931ie_Cause cause;
|
||||
|
||||
gen->MesType = Q931mes_STATUS;
|
||||
gen->CRVFlag = gen->CRVFlag ? 0 : 1;
|
||||
|
||||
state.CodStand = Q931_CODING_ITU; /* ITU-T */
|
||||
state.CallState = Q931_U0; /* Default: Null */
|
||||
|
||||
cause.IEId = Q931ie_CAUSE;
|
||||
cause.Size = sizeof(Q931ie_Cause);
|
||||
cause.CodStand = Q931_CODING_ITU; /* ITU */
|
||||
cause.Location = 1; /* private network */
|
||||
cause.Recom = 1; /* */
|
||||
*cause.Diag = '\0';
|
||||
|
||||
if(zchan) {
|
||||
switch(zchan->state) {
|
||||
case ZAP_CHANNEL_STATE_UP:
|
||||
state.CallState = Q931_U10; /* Active */
|
||||
break;
|
||||
case ZAP_CHANNEL_STATE_RING:
|
||||
state.CallState = Q931_U6; /* Call present */
|
||||
break;
|
||||
case ZAP_CHANNEL_STATE_DIALING:
|
||||
state.CallState = Q931_U1; /* Call initiated */
|
||||
break;
|
||||
case ZAP_CHANNEL_STATE_DIALTONE:
|
||||
state.CallState = Q931_U25; /* Overlap receiving */
|
||||
break;
|
||||
|
||||
/* TODO: map missing states */
|
||||
|
||||
default:
|
||||
state.CallState = Q931_U0;
|
||||
}
|
||||
|
||||
cause.Value = 30; /* response to STATUS ENQUIRY */
|
||||
} else {
|
||||
cause.Value = 98; /* */
|
||||
}
|
||||
|
||||
gen->CallState = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &state);
|
||||
gen->Cause = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &cause);
|
||||
Q931Rx43(&isdn_data->q931, (L3UCHAR *) gen, gen->Size);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
zap_log(ZAP_LOG_CRIT, "Received unhandled message %d (%#x)\n", (int)gen->MesType, (int)gen->MesType);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue