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

SVN commits to the libpri project libpri-commits at lists.digium.com
Fri Feb 26 18:01:21 CST 2010


Author: rmudgett
Date: Fri Feb 26 18:01:17 2010
New Revision: 1510

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1510
Log:
Initial changes necessary for call waiting support.

Modified:
    team/rmudgett/call_waiting/libpri.h
    team/rmudgett/call_waiting/pri.c
    team/rmudgett/call_waiting/pri_internal.h
    team/rmudgett/call_waiting/pri_q931.h
    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=1510&r1=1509&r2=1510
==============================================================================
--- team/rmudgett/call_waiting/libpri.h (original)
+++ team/rmudgett/call_waiting/libpri.h Fri Feb 26 18:01:17 2010
@@ -1262,9 +1262,32 @@
    Set non-isdn to non-zero if you are not connecting to ISDN equipment */
 int pri_need_more_info(struct pri *pri, q931_call *call, int channel, int nonisdn);
 
-/* Answer the call on the given channel (ignored if you called acknowledge already).
+/* Answer(CONNECT) the call on the given channel.
    Set non-isdn to non-zero if you are not connecting to ISDN equipment */
 int pri_answer(struct pri *pri, q931_call *call, int channel, int nonisdn);
+
+/*!
+ * \brief Send the manual CONNECT_ACKNOWLEDGE message.
+ *
+ * \param ctrl D channel controller.
+ * \param call Q.931 call leg.
+ * \param channel Selected channel to assign to the call waiting call.
+ * Zero if do not include the channel id ie in the CONNECT_ACKNOWLEDGE message.
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+int pri_connect_ack(struct pri *ctrl, q931_call *call, int channel);
+
+/*!
+ * \brief Set the manual CONNECT_ACKNOWLEDGE message enable flag.
+ *
+ * \param ctrl D channel controller.
+ * \param enable TRUE to enable manual CONNECT_ACKNOWLEDGE message feature.
+ *
+ * \return Nothing
+ */
+void pri_connect_ack_enable(struct pri *ctrl, int enable);
 
 /*!
  * \brief Give connected line information to a call

Modified: team/rmudgett/call_waiting/pri.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/call_waiting/pri.c?view=diff&rev=1510&r1=1509&r2=1510
==============================================================================
--- team/rmudgett/call_waiting/pri.c (original)
+++ team/rmudgett/call_waiting/pri.c Fri Feb 26 18:01:17 2010
@@ -694,6 +694,22 @@
 	return q931_connect(pri, call, channel, nonisdn);
 }
 
+int pri_connect_ack(struct pri *ctrl, q931_call *call, int channel)
+{
+	if (!ctrl || !call) {
+		return -1;
+	}
+	return q931_connect_acknowledge(ctrl, call, channel);
+}
+
+void pri_connect_ack_enable(struct pri *ctrl, int enable)
+{
+	if (ctrl) {
+		ctrl = PRI_MASTER(ctrl);
+		ctrl->manual_connect_ack = enable ? 1 : 0;
+	}
+}
+
 /*!
  * \internal
  * \brief Copy the PRI party name to the Q.931 party name structure.

Modified: team/rmudgett/call_waiting/pri_internal.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/call_waiting/pri_internal.h?view=diff&rev=1510&r1=1509&r2=1510
==============================================================================
--- team/rmudgett/call_waiting/pri_internal.h (original)
+++ team/rmudgett/call_waiting/pri_internal.h Fri Feb 26 18:01:17 2010
@@ -104,6 +104,7 @@
 	unsigned int cc_support:1;/* TRUE if upper layer supports call completion. */
 	unsigned int transfer_support:1;/* TRUE if the upper layer supports ECT */
 	unsigned int aoc_support:1;/* TRUE if can send AOC events to the upper layer. */
+	unsigned int manual_connect_ack:1;/* TRUE if the CONNECT_ACKNOWLEDGE is sent with API call */
 
 	/* MDL variables */
 	int mdl_error;

Modified: team/rmudgett/call_waiting/pri_q931.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/call_waiting/pri_q931.h?view=diff&rev=1510&r1=1509&r2=1510
==============================================================================
--- team/rmudgett/call_waiting/pri_q931.h (original)
+++ team/rmudgett/call_waiting/pri_q931.h Fri Feb 26 18:01:17 2010
@@ -475,6 +475,7 @@
 extern int q931_keypad_facility(struct pri *pri, q931_call *call, const char *digits);
 
 extern int q931_connect(struct pri *pri, q931_call *call, int channel, int nonisdn);
+int q931_connect_acknowledge(struct pri *ctrl, q931_call *call, int channel);
 
 extern int q931_release(struct pri *pri, q931_call *call, int cause);
 

Modified: team/rmudgett/call_waiting/q931.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/call_waiting/q931.c?view=diff&rev=1510&r1=1509&r2=1510
==============================================================================
--- team/rmudgett/call_waiting/q931.c (original)
+++ team/rmudgett/call_waiting/q931.c Fri Feb 26 18:01:17 2010
@@ -5100,17 +5100,32 @@
 	return res;
 }
 
-static int connect_acknowledge_ies[] = { -1 };
-
-static int gr303_connect_acknowledge_ies[] = { Q931_CHANNEL_IDENT, -1 };
-
-static int q931_connect_acknowledge(struct pri *ctrl, q931_call *c)
-{
+static int connect_ack_ies[] = { -1 };
+static int connect_ack_w_chan_id_ies[] = { Q931_CHANNEL_IDENT, -1 };
+static int gr303_connect_ack_ies[] = { Q931_CHANNEL_IDENT, -1 };
+
+int q931_connect_acknowledge(struct pri *ctrl, q931_call *call, int channel)
+{
+	int *use_ies;
+
+	if (channel) {
+		call->ds1no = (channel & 0xff00) >> 8;
+		call->ds1explicit = (channel & 0x10000) >> 16;
+		call->channelno = channel & 0xff;
+	}
+	use_ies = NULL;
 	if (ctrl->subchannel && !ctrl->bri) {
-		if (ctrl->localtype == PRI_CPE)
-			return send_message(ctrl, c, Q931_CONNECT_ACKNOWLEDGE, gr303_connect_acknowledge_ies);
-	} else
-		return send_message(ctrl, c, Q931_CONNECT_ACKNOWLEDGE, connect_acknowledge_ies);
+		if (ctrl->localtype == PRI_CPE) {
+			use_ies = gr303_connect_ack_ies;
+		}
+	} else if (channel) {
+		use_ies = connect_ack_w_chan_id_ies;
+	} else {
+		use_ies = connect_ack_ies;
+	}
+	if (use_ies) {
+		return send_message(ctrl, call, Q931_CONNECT_ACKNOWLEDGE, use_ies);
+	}
 	return 0;
 }
 
@@ -7188,7 +7203,9 @@
 		libpri_copy_string(ctrl->ev.answer.useruserinfo, c->useruserinfo, sizeof(ctrl->ev.answer.useruserinfo));
 		c->useruserinfo[0] = '\0';
 
-		q931_connect_acknowledge(ctrl, c);
+		if (!PRI_MASTER(ctrl)->manual_connect_ack) {
+			q931_connect_acknowledge(ctrl, c, 0);
+		}
 
 		if (c->cis_auto_disconnect && c->cis_call) {
 			/* Make sure WE release when we initiate a signalling only connection */




More information about the libpri-commits mailing list