q931.c: Send STATUS messages when receiving messages in the wrong call state.

* Add checks to send STATUS messages when receiving SETUP ACKNOWLEDGE,
ALERTING, and CONNECT ACKNOWLEDGE messages when in the wrong call state.

LIBPRI-76 #close
Reported by: Richard Mudgett


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2331 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
Richard Mudgett 2014-11-17 20:07:53 +00:00
parent af8a550ff9
commit 5fda3d8c68

23
q931.c
View File

@ -8696,6 +8696,15 @@ static int post_handle_q931_message(struct pri *ctrl, struct q931_mh *mh, struct
q931_release_complete(ctrl, c, newcall_rel_comp_cause(c));
break;
}
switch (c->ourcallstate) {
default:
q931_status(ctrl, c, PRI_CAUSE_WRONG_CALL_STATE);
return 0;
case Q931_CALL_STATE_CALL_INITIATED:
case Q931_CALL_STATE_OVERLAP_SENDING:
case Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING:
break;
}
UPDATE_OURCALLSTATE(ctrl, c, Q931_CALL_STATE_CALL_DELIVERED);
c->peercallstate = Q931_CALL_STATE_CALL_RECEIVED;
ctrl->ev.e = PRI_EVENT_RINGING;
@ -8866,11 +8875,8 @@ static int post_handle_q931_message(struct pri *ctrl, struct q931_mh *mh, struct
}
switch (c->ourcallstate) {
default:
if (ctrl->localtype == PRI_NETWORK || ctrl->switchtype == PRI_SWITCH_QSIG) {
q931_status(ctrl, c, PRI_CAUSE_WRONG_MESSAGE);
break;
}
/* Fall through */
q931_status(ctrl, c, PRI_CAUSE_WRONG_CALL_STATE);
return 0;
case Q931_CALL_STATE_CONNECT_REQUEST:
case Q931_CALL_STATE_ACTIVE:
UPDATE_OURCALLSTATE(ctrl, c, Q931_CALL_STATE_ACTIVE);
@ -9208,6 +9214,13 @@ static int post_handle_q931_message(struct pri *ctrl, struct q931_mh *mh, struct
q931_release_complete(ctrl, c, newcall_rel_comp_cause(c));
break;
}
switch (c->ourcallstate) {
default:
q931_status(ctrl, c, PRI_CAUSE_WRONG_CALL_STATE);
return 0;
case Q931_CALL_STATE_CALL_INITIATED:
break;
}
UPDATE_OURCALLSTATE(ctrl, c, Q931_CALL_STATE_OVERLAP_SENDING);
c->peercallstate = Q931_CALL_STATE_OVERLAP_RECEIVING;
ctrl->ev.e = PRI_EVENT_SETUP_ACK;