first hack at crv lookup table for zchan
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@378 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
4f7223357e
commit
e4af9c444a
|
@ -425,6 +425,8 @@ struct zap_span {
|
|||
teletone_tone_map_t tone_detect_map[ZAP_TONEMAP_INVALID+1];
|
||||
teletone_multi_tone_t tone_finder[ZAP_TONEMAP_INVALID+1];
|
||||
zap_channel_t channels[ZAP_MAX_CHANNELS_SPAN];
|
||||
zap_channel_t *channels_local_crv[32768];
|
||||
zap_channel_t *channels_remote_crv[32768];
|
||||
zio_channel_outgoing_call_t outgoing_call;
|
||||
void *mod_data;
|
||||
char *type;
|
||||
|
|
|
@ -67,10 +67,21 @@ static L3INT zap_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen)
|
|||
zap_span_t *span = (zap_span_t *) pvt;
|
||||
zap_isdn_data_t *isdn_data = span->signal_data;
|
||||
Q931mes_Generic *gen = (Q931mes_Generic *) msg;
|
||||
Q931ie_ChanID *chanid = Q931GetIEPtr(gen->ChanID, gen->buf);
|
||||
int chan_id = chanid->ChanSlot;
|
||||
int chan_id = 0;
|
||||
zap_channel_t *zchan = NULL;
|
||||
|
||||
if (Q931IsIEPresent(gen->ChanID)) {
|
||||
Q931ie_ChanID *chanid = Q931GetIEPtr(gen->ChanID, gen->buf);
|
||||
chan_id = chanid->ChanSlot;
|
||||
zchan = &span->channels[chan_id];
|
||||
} else {
|
||||
if (gen->CRVFlag) {
|
||||
zchan = span->channels_local_crv[gen->CRV];
|
||||
} else {
|
||||
zchan = span->channels_remote_crv[gen->CRV];
|
||||
}
|
||||
}
|
||||
|
||||
assert(span != NULL);
|
||||
assert(isdn_data != NULL);
|
||||
|
||||
|
@ -129,6 +140,15 @@ static L3INT zap_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen)
|
|||
}
|
||||
} else {
|
||||
switch(gen->MesType) {
|
||||
case Q931mes_CALL_PROCEEDING:
|
||||
{
|
||||
if (zchan) {
|
||||
zchan->span->channels_local_crv[gen->CRV] = zchan;
|
||||
} else {
|
||||
zap_log(ZAP_LOG_CRIT, "Received Release Complete with no matching channel %d\n", chan_id);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Q931mes_RESTART:
|
||||
{
|
||||
if (zchan) {
|
||||
|
@ -198,6 +218,7 @@ static L3INT zap_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen)
|
|||
|
||||
if ((status = zap_channel_open(span->span_id, chan_id, &zchan) == ZAP_SUCCESS)) {
|
||||
if (zchan->state == ZAP_CHANNEL_STATE_DOWN) {
|
||||
zchan->span->channels_remote_crv[gen->CRV] = zchan;
|
||||
memset(&zchan->caller_data, 0, sizeof(zchan->caller_data));
|
||||
|
||||
zap_set_string(zchan->caller_data.cid_num, (char *)callingnum->Digit);
|
||||
|
|
Loading…
Reference in New Issue