[svn-commits] dvossel: branch dvossel/aoc_send r1565 - /team/dvossel/aoc_send/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Mar 22 14:38:37 CDT 2010


Author: dvossel
Date: Mon Mar 22 14:38:33 2010
New Revision: 1565

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1565
Log:
support for AOC request on call setup

Modified:
    team/dvossel/aoc_send/libpri.h
    team/dvossel/aoc_send/pri_aoc.c
    team/dvossel/aoc_send/pri_facility.c
    team/dvossel/aoc_send/pri_internal.h
    team/dvossel/aoc_send/q931.c

Modified: team/dvossel/aoc_send/libpri.h
URL: http://svnview.digium.com/svn/libpri/team/dvossel/aoc_send/libpri.h?view=diff&rev=1565&r1=1564&r2=1565
==============================================================================
--- team/dvossel/aoc_send/libpri.h (original)
+++ team/dvossel/aoc_send/libpri.h Mon Mar 22 14:38:33 2010
@@ -1483,6 +1483,9 @@
    (and maybe some timers) */
 void pri_enslave(struct pri *master, struct pri *slave);
 
+/* Request AOC on call setup */
+int pri_sr_set_aoc_charging_request(struct pri_sr *sr, int charging_request);
+
 /* Send AOC-Request message */
 int pri_aoc_charging_request_send(struct pri *ctrl, q931_call *c, const struct pri_subcmd_aoc_request *aoc_request);
 

Modified: team/dvossel/aoc_send/pri_aoc.c
URL: http://svnview.digium.com/svn/libpri/team/dvossel/aoc_send/pri_aoc.c?view=diff&rev=1565&r1=1564&r2=1565
==============================================================================
--- team/dvossel/aoc_send/pri_aoc.c (original)
+++ team/dvossel/aoc_send/pri_aoc.c Mon Mar 22 14:38:33 2010
@@ -1002,6 +1002,32 @@
 	return pos;
 }
 
+/*!
+ * \internal
+ * \brief Send the ETSI AOC Request invoke message.
+ *
+ * \param ctrl D channel controller for diagnostic messages or global options.
+ * \param call Call leg from which to encode AOC.
+ * \param aoc_request, the aoc charging request payload data to encode.
+ *
+ * \retval 0 on success.
+ * \retval -1 on error.
+ */
+static int aoc_charging_request_encode(struct pri *ctrl, q931_call *call, const struct pri_subcmd_aoc_request *aoc_request)
+{
+	unsigned char buffer[255];
+	unsigned char *end = 0;
+
+	end = enc_etsi_aoc_request(ctrl, buffer, buffer + sizeof(buffer), aoc_request);
+
+	if (!end) {
+		return -1;
+	}
+
+	/* in the case of an AOC request message, we queue this on a SETUP message and
+	 * do not have to send it ourselves in this function */
+	return pri_call_apdu_queue(call, Q931_FACILITY, buffer, end - buffer, NULL);
+}
 
 /*!
  * \internal
@@ -1089,39 +1115,6 @@
 	return 0;
 }
 
-/*!
- * \internal
- * \brief Send the ETSI AOC Request invoke message.
- *
- * \param ctrl D channel controller for diagnostic messages or global options.
- * \param call Call leg from which to encode AOC.
- * \param aoc_request, the aoc charging request payload data to encode.
- *
- * \retval 0 on success.
- * \retval -1 on error.
- */
-static int aoc_charging_request_encode(struct pri *ctrl, q931_call *call, const struct pri_subcmd_aoc_request *aoc_request)
-{
-	unsigned char buffer[255];
-	unsigned char *end = 0;
-
-	end = enc_etsi_aoc_request(ctrl, buffer, buffer + sizeof(buffer), aoc_request);
-
-	if (!end) {
-		return -1;
-	}
-
-	/* Remember that if we queue a facility IE for a facility message we
-	 * have to explicitly send the facility message ourselves */
-	if (pri_call_apdu_queue(call, Q931_FACILITY, buffer, end - buffer, NULL)
-		|| q931_facility(call->pri, call)) {
-		pri_message(ctrl, "Could not schedule aoc charging request facility message for call %d\n", call->cr);
-		return -1;
-	}
-
-	return 0;
-}
-
 int pri_aoc_charging_request_send(struct pri *ctrl, q931_call *call, const struct pri_subcmd_aoc_request *aoc_request)
 {
 	if (!ctrl || !call)
@@ -1174,5 +1167,27 @@
 
 	return 0;
 }
+
+int pri_sr_set_aoc_charging_request(struct pri_sr *sr, int charging_request)
+{
+
+	switch(charging_request) {
+	case PRI_AOC_REQUEST_S:
+		sr->aoc_charging_request_s = 1;
+		break;
+	case PRI_AOC_REQUEST_D:
+		sr->aoc_charging_request_d = 1;
+		break;
+	case PRI_AOC_REQUEST_E:
+		sr->aoc_charging_request_e = 1;
+		break;
+	default:
+		/* not a valid request type */
+		return -1;
+	}
+
+	return 0;
+
+}
 /* ------------------------------------------------------------------- */
 /* end pri_aoc.c */

Modified: team/dvossel/aoc_send/pri_facility.c
URL: http://svnview.digium.com/svn/libpri/team/dvossel/aoc_send/pri_facility.c?view=diff&rev=1565&r1=1564&r2=1565
==============================================================================
--- team/dvossel/aoc_send/pri_facility.c (original)
+++ team/dvossel/aoc_send/pri_facility.c Mon Mar 22 14:38:33 2010
@@ -3157,6 +3157,22 @@
 	switch (ctrl->switchtype) {
 	case PRI_SWITCH_EUROISDN_E1:
 	case PRI_SWITCH_EUROISDN_T1:
+		{
+			struct pri_subcmd_aoc_request aoc_request;
+			/* ETSI requires a separate facility for each request */
+			if (call->aoc_charging_request_s) {
+				aoc_request.charging_request = PRI_AOC_REQUEST_S;
+				pri_aoc_charging_request_send(ctrl, call, &aoc_request);
+			}
+			if (call->aoc_charging_request_d) {
+				aoc_request.charging_request = PRI_AOC_REQUEST_D;
+				pri_aoc_charging_request_send(ctrl, call, &aoc_request);
+			}
+			if (call->aoc_charging_request_e) {
+				aoc_request.charging_request = PRI_AOC_REQUEST_E;
+				pri_aoc_charging_request_send(ctrl, call, &aoc_request);
+			}
+		}
 		if (PTMP_MODE(ctrl)) {
 			/* PTMP mode */
 			break;

Modified: team/dvossel/aoc_send/pri_internal.h
URL: http://svnview.digium.com/svn/libpri/team/dvossel/aoc_send/pri_internal.h?view=diff&rev=1565&r1=1564&r2=1565
==============================================================================
--- team/dvossel/aoc_send/pri_internal.h (original)
+++ team/dvossel/aoc_send/pri_internal.h Mon Mar 22 14:38:33 2010
@@ -363,6 +363,9 @@
 	const char *keypad_digits;
 	int transferable;
 	int reversecharge;
+	int aoc_charging_request_s;
+	int aoc_charging_request_d;
+	int aoc_charging_request_e;
 };
 
 /* Internal switch types */
@@ -631,6 +634,12 @@
 		/*! TRUE if outgoing call was already redirected. */
 		unsigned char initially_redirected;
 	} cc;
+
+	/* AOC charge requesting on Setup */
+	int aoc_charging_request_s;
+	int aoc_charging_request_d;
+	int aoc_charging_request_e;
+
 };
 
 enum CC_STATES {

Modified: team/dvossel/aoc_send/q931.c
URL: http://svnview.digium.com/svn/libpri/team/dvossel/aoc_send/q931.c?view=diff&rev=1565&r1=1564&r2=1565
==============================================================================
--- team/dvossel/aoc_send/q931.c (original)
+++ team/dvossel/aoc_send/q931.c Mon Mar 22 14:38:33 2010
@@ -5009,6 +5009,10 @@
 
 	c->reversecharge = req->reversecharge;
 
+	c->aoc_charging_request_s = req->aoc_charging_request_s;
+	c->aoc_charging_request_d = req->aoc_charging_request_d;
+	c->aoc_charging_request_e = req->aoc_charging_request_e;
+
 	pri_call_add_standard_apdus(ctrl, c);
 
 	/* Save the initial cc-parties. */




More information about the svn-commits mailing list