Improve call state handling code. (#7269)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@365 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
parent
f245f64a2e
commit
9037525b7b
15
q931.c
15
q931.c
@ -2693,18 +2693,17 @@ int q931_connect(struct pri *pri, q931_call *c, int channel, int nonisdn)
|
|||||||
c->progressmask = PRI_PROG_CALLED_NOT_ISDN;
|
c->progressmask = PRI_PROG_CALLED_NOT_ISDN;
|
||||||
} else
|
} else
|
||||||
c->progressmask = 0;
|
c->progressmask = 0;
|
||||||
if (pri->localtype == PRI_CPE) {
|
if(pri->localtype == PRI_NETWORK || pri->switchtype == PRI_SWITCH_QSIG)
|
||||||
UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_CONNECT_REQUEST);
|
|
||||||
} else {
|
|
||||||
UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_ACTIVE);
|
UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_ACTIVE);
|
||||||
}
|
else
|
||||||
|
UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_CONNECT_REQUEST);
|
||||||
c->peercallstate = Q931_CALL_STATE_ACTIVE;
|
c->peercallstate = Q931_CALL_STATE_ACTIVE;
|
||||||
c->alive = 1;
|
c->alive = 1;
|
||||||
/* Setup timer */
|
/* Connect request timer */
|
||||||
if (c->retranstimer)
|
if (c->retranstimer)
|
||||||
pri_schedule_del(pri, c->retranstimer);
|
pri_schedule_del(pri, c->retranstimer);
|
||||||
c->retranstimer = 0;
|
c->retranstimer = 0;
|
||||||
if ((pri->localtype == PRI_CPE) && (!pri->subchannel))
|
if ((c->ourcallstate == Q931_CALL_STATE_CONNECT_REQUEST) && (!pri->subchannel))
|
||||||
c->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T313], pri_connect_timeout, c);
|
c->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T313], pri_connect_timeout, c);
|
||||||
return send_message(pri, c, Q931_CONNECT, connect_ies);
|
return send_message(pri, c, Q931_CONNECT, connect_ies);
|
||||||
}
|
}
|
||||||
@ -3422,7 +3421,9 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
|
|||||||
q931_release_complete(pri,c,PRI_CAUSE_INVALID_CALL_REFERENCE);
|
q931_release_complete(pri,c,PRI_CAUSE_INVALID_CALL_REFERENCE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (c->ourcallstate != Q931_CALL_STATE_CONNECT_REQUEST) {
|
if (!(c->ourcallstate == Q931_CALL_STATE_CONNECT_REQUEST) &&
|
||||||
|
!(c->ourcallstate == Q931_CALL_STATE_ACTIVE &&
|
||||||
|
(pri->localtype == PRI_NETWORK || pri->switchtype == PRI_SWITCH_QSIG))) {
|
||||||
q931_status(pri,c,PRI_CAUSE_WRONG_MESSAGE);
|
q931_status(pri,c,PRI_CAUSE_WRONG_MESSAGE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user