[libpri-commits] dvossel: branch dvossel/aoc_send r1573 - /team/dvossel/aoc_send/

SVN commits to the libpri project libpri-commits at lists.digium.com
Mon Apr 5 12:13:23 CDT 2010


Author: dvossel
Date: Mon Apr  5 12:13:21 2010
New Revision: 1573

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1573
Log:
adds ability to request multiple AOC types in one subcmd

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=1573&r1=1572&r2=1573
==============================================================================
--- team/dvossel/aoc_send/libpri.h (original)
+++ team/dvossel/aoc_send/libpri.h Mon Apr  5 12:13:21 2010
@@ -669,9 +669,9 @@
 };
 
 enum PRI_AOC_REQUEST {
-	PRI_AOC_REQUEST_S,
-	PRI_AOC_REQUEST_D,
-	PRI_AOC_REQUEST_E,
+	PRI_AOC_REQUEST_S = (1 << 0),
+	PRI_AOC_REQUEST_D = (1 << 1),
+	PRI_AOC_REQUEST_E = (1 << 2),
 };
 
 struct pri_subcmd_aoc_request_response {

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=1573&r1=1572&r2=1573
==============================================================================
--- team/dvossel/aoc_send/pri_aoc.c (original)
+++ team/dvossel/aoc_send/pri_aoc.c Mon Apr  5 12:13:21 2010
@@ -1030,7 +1030,7 @@
  * \retval NULL on error.
  */
 static unsigned char *enc_etsi_aoc_request(struct pri *ctrl, unsigned char *pos,
-	unsigned char *end, const struct pri_subcmd_aoc_request *aoc_request)
+	unsigned char *end, const int request)
 {
 	struct rose_msg_invoke msg;
 
@@ -1043,7 +1043,7 @@
 	msg.operation = ROSE_ETSI_ChargingRequest;
 	msg.invoke_id = get_invokeid(ctrl);
 
-	switch (aoc_request->charging_request) {
+	switch (request) {
 		case PRI_AOC_REQUEST_S:
 			msg.args.etsi.ChargingRequest.charging_case = 0;
 			break;
@@ -1102,7 +1102,7 @@
 static int pri_aoc_request_get_response(enum APDU_CALLBACK_REASON reason, struct pri *ctrl, struct q931_call *call, struct apdu_event *apdu, const struct apdu_msg_data *msg)
 {
 	struct pri_subcommand *subcmd;
-	struct pri_subcmd_aoc_request *aoc_request;
+	int *request;
 	int errorcode;
 
 	if (!PRI_MASTER(ctrl)->aoc_support ||
@@ -1117,8 +1117,8 @@
 		return -1;
 	}
 
-	aoc_request = apdu->response.user.ptr;
-	subcmd->u.aoc_request_response.charging_request = aoc_request->charging_request;
+	request = apdu->response.user.ptr;
+	subcmd->u.aoc_request_response.charging_request = *request;
 	subcmd->cmd = PRI_SUBCMD_AOC_CHARGING_REQUEST_RESPONSE;
 
 	switch (reason) {
@@ -1174,13 +1174,13 @@
  * \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)
+static int aoc_charging_request_encode(struct pri *ctrl, q931_call *call, const int request)
 {
 	unsigned char buffer[255];
 	unsigned char *end = 0;
 	struct apdu_callback_data response;
 
-	end = enc_etsi_aoc_request(ctrl, buffer, buffer + sizeof(buffer), aoc_request);
+	end = enc_etsi_aoc_request(ctrl, buffer, buffer + sizeof(buffer), request);
 
 	if (!end) {
 		return -1;
@@ -1190,7 +1190,7 @@
 	response.invoke_id = ctrl->last_invoke;
 	response.timeout_time = ctrl->timers[PRI_TIMER_T_CCBS1];
 	response.callback = pri_aoc_request_get_response;
-	response.user.ptr = (void *) aoc_request;
+	response.user.ptr = (void *) &request;
 
 	/* 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 */
@@ -1309,7 +1309,19 @@
 	switch (ctrl->switchtype) {
 	case PRI_SWITCH_EUROISDN_E1:
 	case PRI_SWITCH_EUROISDN_T1:
-		return aoc_charging_request_encode(ctrl, call, aoc_request);
+	{
+		int res = 0;
+		if (aoc_request->charging_request & PRI_AOC_REQUEST_S) {
+			res |= aoc_charging_request_encode(ctrl, call, PRI_AOC_REQUEST_S);
+		}
+		if (aoc_request->charging_request & PRI_AOC_REQUEST_D) {
+			res |= aoc_charging_request_encode(ctrl, call, PRI_AOC_REQUEST_D);
+		}
+		if (aoc_request->charging_request & PRI_AOC_REQUEST_E) {
+			res |= aoc_charging_request_encode(ctrl, call, PRI_AOC_REQUEST_E);
+		}
+		return res;
+	}
 	case PRI_SWITCH_QSIG:
 		break;
 	default:
@@ -1357,19 +1369,14 @@
 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;
+	if (charging_request & PRI_AOC_REQUEST_S) {
+		sr->aoc_charging_request |= PRI_AOC_REQUEST_S;
+	}
+	if (charging_request & PRI_AOC_REQUEST_D) {
+		sr->aoc_charging_request |= PRI_AOC_REQUEST_D;
+	}
+	if (charging_request & PRI_AOC_REQUEST_E) {
+		sr->aoc_charging_request |= PRI_AOC_REQUEST_E;
 	}
 
 	return 0;

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=1573&r1=1572&r2=1573
==============================================================================
--- team/dvossel/aoc_send/pri_facility.c (original)
+++ team/dvossel/aoc_send/pri_facility.c Mon Apr  5 12:13:21 2010
@@ -3157,21 +3157,11 @@
 	switch (ctrl->switchtype) {
 	case PRI_SWITCH_EUROISDN_E1:
 	case PRI_SWITCH_EUROISDN_T1:
-		{
+		if (call->aoc_charging_request) {
 			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);
-			}
+
+			aoc_request.charging_request = call->aoc_charging_request;
+			pri_aoc_charging_request_send(ctrl, call, &aoc_request);
 		}
 		if (PTMP_MODE(ctrl)) {
 			/* PTMP mode */

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=1573&r1=1572&r2=1573
==============================================================================
--- team/dvossel/aoc_send/pri_internal.h (original)
+++ team/dvossel/aoc_send/pri_internal.h Mon Apr  5 12:13:21 2010
@@ -363,9 +363,7 @@
 	const char *keypad_digits;
 	int transferable;
 	int reversecharge;
-	int aoc_charging_request_s;
-	int aoc_charging_request_d;
-	int aoc_charging_request_e;
+	int aoc_charging_request;
 };
 
 /* Internal switch types */
@@ -636,10 +634,7 @@
 	} cc;
 
 	/* AOC charge requesting on Setup */
-	int aoc_charging_request_s;
-	int aoc_charging_request_d;
-	int aoc_charging_request_e;
-
+	int aoc_charging_request;
 };
 
 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=1573&r1=1572&r2=1573
==============================================================================
--- team/dvossel/aoc_send/q931.c (original)
+++ team/dvossel/aoc_send/q931.c Mon Apr  5 12:13:21 2010
@@ -5009,9 +5009,7 @@
 
 	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;
+	c->aoc_charging_request = req->aoc_charging_request;
 
 	pri_call_add_standard_apdus(ctrl, c);
 




More information about the libpri-commits mailing list