[svn-commits] dvossel: branch group/aoc r251412 - in /team/group/aoc: include/asterisk/ mai...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Mar 9 13:34:55 CST 2010


Author: dvossel
Date: Tue Mar  9 13:34:51 2010
New Revision: 251412

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=251412
Log:
fixes bug in billing id information element parsing

Modified:
    team/group/aoc/include/asterisk/aoc.h
    team/group/aoc/main/aoc.c
    team/group/aoc/tests/test_aoc.c

Modified: team/group/aoc/include/asterisk/aoc.h
URL: http://svnview.digium.com/svn/asterisk/team/group/aoc/include/asterisk/aoc.h?view=diff&rev=251412&r1=251411&r2=251412
==============================================================================
--- team/group/aoc/include/asterisk/aoc.h (original)
+++ team/group/aoc/include/asterisk/aoc.h Tue Mar  9 13:34:51 2010
@@ -38,7 +38,7 @@
 };
 
 enum ast_aoc_billing_id {
-	AOC_BILLING_NA,
+	AOC_BILLING_NA = 0,
 	AOC_BILLING_NORMAL,
 	AOC_BILLING_REVERSE_CHARGE,
 	AOC_BILLING_CREDIT_CARD,

Modified: team/group/aoc/main/aoc.c
URL: http://svnview.digium.com/svn/asterisk/team/group/aoc/main/aoc.c?view=diff&rev=251412&r1=251411&r2=251412
==============================================================================
--- team/group/aoc/main/aoc.c (original)
+++ team/group/aoc/main/aoc.c Tue Mar  9 13:34:51 2010
@@ -151,7 +151,6 @@
 
 static int aoc_parse_ie(struct ast_aoc_decoded *decoded, unsigned char *data, unsigned int datalen)
 {
-/* TODO XXX parse the ie */
 	int ie;
 	int len;
 
@@ -315,7 +314,7 @@
 
 	if (decoded->billing_id) {
 		struct aoc_ie_billing ie;
-		ie.id = htons(decoded->billing_id); /* only one byte */
+		ie.id = decoded->billing_id; /* only one byte */
 		aoc_append_ie(ied, AOC_IE_BILLING, (const void *) &ie, sizeof(ie));
 	}
 

Modified: team/group/aoc/tests/test_aoc.c
URL: http://svnview.digium.com/svn/asterisk/team/group/aoc/tests/test_aoc.c?view=diff&rev=251412&r1=251411&r2=251412
==============================================================================
--- team/group/aoc/tests/test_aoc.c (original)
+++ team/group/aoc/tests/test_aoc.c Tue Mar  9 13:34:51 2010
@@ -66,6 +66,16 @@
 		goto cleanup_aoc_test;
 	}
 
+	/* Add billing id information */
+	if ((ast_aoc_set_billing_id(decoded, AOC_BILLING_NORMAL) ||
+		(ast_aoc_get_billing_id(decoded) != AOC_BILLING_NORMAL))) {
+
+		ast_test_status_update(test, "TEST 1, could not set billing id correctly\n");
+		res = AST_TEST_FAIL;
+		goto cleanup_aoc_test;
+
+	}
+
 	/* Set currency information, verify results*/
 	if ((ast_aoc_set_currency_info(decoded, 100, AOC_MULT_ONE, "usd")) ||
 		(ast_aoc_set_total_type(decoded, AOC_SUBTOTAL)) ||
@@ -102,7 +112,7 @@
 	decoded = ast_aoc_destroy_decoded(decoded);
 
 	/* ---- Test 2 ---- create AOC-E message with charge type == unit */
-	/* create AOC-D message */
+	/* create AOC-E message */
 	if (!(decoded = ast_aoc_create(AOC_E, AOC_CHARGE_UNIT, 0)) ||
 		(ast_aoc_get_msg_type(decoded) != AOC_E) ||
 		(ast_aoc_get_charge_type(decoded) != AOC_CHARGE_UNIT)) {
@@ -146,6 +156,27 @@
 		goto cleanup_aoc_test;
 	}
 
+	/* Add charging association information */
+	if ((ast_aoc_set_association_id(decoded, 1234) ||
+		(ast_aoc_get_association_id(decoded) != 1234)) ||
+		(ast_aoc_set_association_number(decoded, "5-555-555-555-555-5555")) ||
+		(strcmp(ast_aoc_get_association_number(decoded), "5-555-555-555-555-5555"))) {
+
+		ast_test_status_update(test, "TEST 2, could not set charging association info correctly\n");
+		res = AST_TEST_FAIL;
+		goto cleanup_aoc_test;
+
+	}
+
+	/* Add billing id information */
+	if ((ast_aoc_set_billing_id(decoded, AOC_BILLING_CALL_FWD_NO_REPLY) ||
+		(ast_aoc_get_billing_id(decoded) != AOC_BILLING_CALL_FWD_NO_REPLY))) {
+
+		ast_test_status_update(test, "TEST 2, could not set billing id correctly\n");
+		res = AST_TEST_FAIL;
+		goto cleanup_aoc_test;
+
+	}
 	/* Encode the message */
 	if (ast_aoc_test_encode_decode_match(decoded)) {
 		ast_test_status_update(test, "Test2: encode decode routine did not match expected results \n");




More information about the svn-commits mailing list