Author: rmudgett
Date: Mon Nov 17 14:07:53 2014
New Revision: 2331

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=2331
Log:
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

Modified:
    branches/1.4/q931.c

Modified: branches/1.4/q931.c
URL: 
http://svnview.digium.com/svn/libpri/branches/1.4/q931.c?view=diff&rev=2331&r1=2330&r2=2331
==============================================================================
--- branches/1.4/q931.c (original)
+++ branches/1.4/q931.c Mon Nov 17 14:07:53 2014
@@ -8696,6 +8696,15 @@
                        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 @@
                }
                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);
@@ -9206,6 +9212,13 @@
                stop_t303(c->master_call);
                if (c->newcall) {
                        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);


-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

svn-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/svn-commits

Reply via email to