[libpri-commits] rmudgett: branch rmudgett/call_waiting r1523 - /team/rmudgett/call_waiting/

SVN commits to the libpri project libpri-commits at lists.digium.com
Wed Mar 10 12:20:01 CST 2010


Author: rmudgett
Date: Wed Mar 10 12:19:56 2010
New Revision: 1523

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1523
Log:
Bring up CONNECT_ACKNOLEDGE message event.

Bring up CONNECT_ACKNOLEDGE message event so upper layer can receive
normal no B channel calls to find out what B channel got assigned.

Modified:
    team/rmudgett/call_waiting/libpri.h
    team/rmudgett/call_waiting/pri.c
    team/rmudgett/call_waiting/q931.c

Modified: team/rmudgett/call_waiting/libpri.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/call_waiting/libpri.h?view=diff&rev=1523&r1=1522&r2=1523
==============================================================================
--- team/rmudgett/call_waiting/libpri.h (original)
+++ team/rmudgett/call_waiting/libpri.h Wed Mar 10 12:19:56 2010
@@ -98,6 +98,7 @@
 #define PRI_EVENT_RETRIEVE		24	/* RETRIEVE request received */
 #define PRI_EVENT_RETRIEVE_ACK	25	/* RETRIEVE_ACKNOWLEDGE received */
 #define PRI_EVENT_RETRIEVE_REJ	26	/* RETRIEVE_REJECT received */
+#define PRI_EVENT_CONNECT_ACK	27	/* CONNECT_ACKNOWLEDGE received */
 
 /* Simple states */
 #define PRI_STATE_DOWN		0
@@ -1138,6 +1139,13 @@
 	struct pri_subcommands *subcmds;
 };
 
+struct pri_event_connect_ack {
+	int e;
+	int channel;
+	q931_call *call;
+	struct pri_subcommands *subcmds;
+};
+
 typedef union {
 	int e;
 	pri_event_generic gen;		/* Generic view */
@@ -1162,6 +1170,7 @@
 	struct pri_event_retrieve retrieve;
 	struct pri_event_retrieve_ack retrieve_ack;
 	struct pri_event_retrieve_rej retrieve_rej;
+	struct pri_event_connect_ack connect_ack;
 } pri_event;
 
 struct pri;

Modified: team/rmudgett/call_waiting/pri.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/call_waiting/pri.c?view=diff&rev=1523&r1=1522&r2=1523
==============================================================================
--- team/rmudgett/call_waiting/pri.c (original)
+++ team/rmudgett/call_waiting/pri.c Wed Mar 10 12:19:56 2010
@@ -507,6 +507,7 @@
 		{ PRI_EVENT_RETRIEVE,       "Retrieve" },
 		{ PRI_EVENT_RETRIEVE_ACK,   "Retrieve ACK" },
 		{ PRI_EVENT_RETRIEVE_REJ,   "Retrieve Rej" },
+		{ PRI_EVENT_CONNECT_ACK,    "Connect ACK" },
 /* *INDENT-ON* */
 	};
 

Modified: team/rmudgett/call_waiting/q931.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/call_waiting/q931.c?view=diff&rev=1523&r1=1522&r2=1523
==============================================================================
--- team/rmudgett/call_waiting/q931.c (original)
+++ team/rmudgett/call_waiting/q931.c Wed Mar 10 12:19:56 2010
@@ -7313,14 +7313,26 @@
 			q931_release_complete(ctrl,c,PRI_CAUSE_INVALID_CALL_REFERENCE);
 			break;
 		}
-		if (!(c->ourcallstate == Q931_CALL_STATE_CONNECT_REQUEST) &&
-		    !(c->ourcallstate == Q931_CALL_STATE_ACTIVE &&
-		      (ctrl->localtype == PRI_NETWORK || ctrl->switchtype == PRI_SWITCH_QSIG))) {
-			q931_status(ctrl,c,PRI_CAUSE_WRONG_MESSAGE);
-			break;
-		}
-		UPDATE_OURCALLSTATE(ctrl, c, Q931_CALL_STATE_ACTIVE);
-		c->peercallstate = Q931_CALL_STATE_ACTIVE;
+		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 */
+		case Q931_CALL_STATE_CONNECT_REQUEST:
+		case Q931_CALL_STATE_ACTIVE:
+			UPDATE_OURCALLSTATE(ctrl, c, Q931_CALL_STATE_ACTIVE);
+			c->peercallstate = Q931_CALL_STATE_ACTIVE;
+			if (PRI_MASTER(ctrl)->manual_connect_ack) {
+				ctrl->ev.e = PRI_EVENT_CONNECT_ACK;
+				ctrl->ev.connect_ack.subcmds = &ctrl->subcmds;
+				ctrl->ev.connect_ack.channel = q931_encode_channel(c);
+				ctrl->ev.connect_ack.call = c->master_call;
+				return Q931_RES_HAVEEVENT;
+			}
+			break;
+		}
 		break;
 	case Q931_STATUS:
 		if (missingmand) {




More information about the libpri-commits mailing list