[libpri-commits] rmudgett: branch rmudgett/aoc_event r1658 - /team/rmudgett/aoc_event/

SVN commits to the libpri project libpri-commits at lists.digium.com
Thu Apr 22 18:27:49 CDT 2010


Author: rmudgett
Date: Thu Apr 22 18:27:45 2010
New Revision: 1658

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1658
Log:
* Change PRI_SUBCMD_AOC_S definition to allow an empty rate list.
* Make encoding AOC-S currency rate list handle an empty list.

Modified:
    team/rmudgett/aoc_event/libpri.h
    team/rmudgett/aoc_event/pri_aoc.c
    team/rmudgett/aoc_event/rose_etsi_aoc.c

Modified: team/rmudgett/aoc_event/libpri.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/aoc_event/libpri.h?view=diff&rev=1658&r1=1657&r2=1658
==============================================================================
--- team/rmudgett/aoc_event/libpri.h (original)
+++ team/rmudgett/aoc_event/libpri.h Thu Apr 22 18:27:45 2010
@@ -661,6 +661,7 @@
 	PRI_AOC_CHARGED_ITEM_USER_USER_INFO,
 	PRI_AOC_CHARGED_ITEM_SUPPLEMENTARY_SERVICE,
 };
+
 /*! \brief Rate method being used. */
 enum PRI_AOC_RATE_TYPE {
 	PRI_AOC_RATE_TYPE_NOT_AVAILABLE,
@@ -671,6 +672,7 @@
 	PRI_AOC_RATE_TYPE_VOLUME,
 	PRI_AOC_RATE_TYPE_SPECIAL_CODE,
 };
+
 enum PRI_AOC_TIME_SCALE {
 	PRI_AOC_TIME_SCALE_HUNDREDTH_SECOND,
 	PRI_AOC_TIME_SCALE_TENTH_SECOND,
@@ -680,12 +682,14 @@
 	PRI_AOC_TIME_SCALE_HOUR,
 	PRI_AOC_TIME_SCALE_DAY,
 };
+
 struct pri_aoc_time {
 	/*! LengthOfTimeUnit (Not valid if length is zero.) */
 	long length;
 	/*! \see enum PRI_AOC_TIME_SCALE */
 	int scale;
 };
+
 enum PRI_AOC_MULTIPLIER {
 	PRI_AOC_MULTIPLIER_THOUSANDTH,
 	PRI_AOC_MULTIPLIER_HUNDREDTH,
@@ -695,11 +699,13 @@
 	PRI_AOC_MULTIPLIER_HUNDRED,
 	PRI_AOC_MULTIPLIER_THOUSAND,
 };
+
 struct pri_aoc_amount {
 	long cost;
 	/*! \see enum PRI_AOC_MULTIPLIER */
 	int multiplier;
 };
+
 struct pri_aoc_duration {
 	struct pri_aoc_amount amount;
 	struct pri_aoc_time time;
@@ -715,16 +721,19 @@
 	/*! Name of currency involved.  Null terminated. */
 	char currency[10 + 1];
 };
+
 struct pri_aoc_flat {
 	struct pri_aoc_amount amount;
 	/*! Name of currency involved.  Null terminated. */
 	char currency[10 + 1];
 };
+
 enum PRI_AOC_VOLUME_UNIT {
 	PRI_AOC_VOLUME_UNIT_OCTET,
 	PRI_AOC_VOLUME_UNIT_SEGMENT,
 	PRI_AOC_VOLUME_UNIT_MESSAGE,
 };
+
 struct pri_aoc_volume {
 	struct pri_aoc_amount amount;
 	/*! \see enum PRI_AOC_VOLUME_UNIT */
@@ -752,7 +761,12 @@
 		int special;
 	} rate;
 };
+
 struct pri_subcmd_aoc_s {
+	/*!
+	 * \brief Number of items in the rate list.
+	 * \note If the list is empty then the charging information is not available.
+	 */
 	int num_items;
 	struct pri_aoc_s_element item[10];
 };
@@ -763,17 +777,20 @@
 	PRI_AOC_DE_CHARGE_CURRENCY,
 	PRI_AOC_DE_CHARGE_UNITS,
 };
+
 struct pri_aoc_recorded_currency {
 	struct pri_aoc_amount amount;
 	/*! Name of currency involved.  Null terminated. */
 	char currency[10 + 1];
 };
+
 struct pri_aoc_units_element {
 	/*! Number of units recorded. -1 if not available. */
 	long number;
 	/*! Type of unit recorded. -1 if not available. */
 	int type;
 };
+
 struct pri_aoc_recorded_units {
 	int num_items;
 	struct pri_aoc_units_element item[32];
@@ -819,11 +836,13 @@
 	PRI_AOC_E_BILLING_ID_CALL_DEFLECTION,
 	PRI_AOC_E_BILLING_ID_CALL_TRANSFER,
 };
+
 enum PRI_AOC_E_CHARGING_ASSOCIATION {
 	PRI_AOC_E_CHARGING_ASSOCIATION_NOT_AVAILABLE,
 	PRI_AOC_E_CHARGING_ASSOCIATION_NUMBER,
 	PRI_AOC_E_CHARGING_ASSOCIATION_ID,
 };
+
 struct pri_aoc_e_charging_association {
 	union {
 		/*! Charged number */
@@ -834,6 +853,7 @@
 	/*! \see enum PRI_AOC_E_CHARGING_ASSOCIATION */
 	int charging_type;
 };
+
 struct pri_subcmd_aoc_e {
 	/*!
 	 * \brief What is being charged.

Modified: team/rmudgett/aoc_event/pri_aoc.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/aoc_event/pri_aoc.c?view=diff&rev=1658&r1=1657&r2=1658
==============================================================================
--- team/rmudgett/aoc_event/pri_aoc.c (original)
+++ team/rmudgett/aoc_event/pri_aoc.c Thu Apr 22 18:27:45 2010
@@ -230,9 +230,7 @@
 
 	subcmd->cmd = PRI_SUBCMD_AOC_S;
 	if (!invoke->args.etsi.AOCSCurrency.type) {
-		subcmd->u.aoc_s.num_items = 1;
-		subcmd->u.aoc_s.item[0].chargeable = PRI_AOC_CHARGED_ITEM_NOT_AVAILABLE;
-		subcmd->u.aoc_s.item[0].rate_type = PRI_AOC_RATE_TYPE_NOT_AVAILABLE;
+		subcmd->u.aoc_s.num_items = 0;
 		return;
 	}
 
@@ -261,12 +259,11 @@
 		return;
 	}
 	subcmd->cmd = PRI_SUBCMD_AOC_S;
+	if (!invoke->args.etsi.AOCSSpecialArr.type) {
+		subcmd->u.aoc_s.num_items = 0;
+		return;
+	}
 	subcmd->u.aoc_s.num_items = 1;
-	if (!invoke->args.etsi.AOCSSpecialArr.type) {
-		subcmd->u.aoc_s.item[0].chargeable = PRI_AOC_CHARGED_ITEM_NOT_AVAILABLE;
-		subcmd->u.aoc_s.item[0].rate_type = PRI_AOC_RATE_TYPE_NOT_AVAILABLE;
-		return;
-	}
 	subcmd->u.aoc_s.item[0].chargeable = PRI_AOC_CHARGED_ITEM_SPECIAL_ARRANGEMENT;
 	subcmd->u.aoc_s.item[0].rate_type = PRI_AOC_RATE_TYPE_SPECIAL_CODE;
 	subcmd->u.aoc_s.item[0].rate.special =

Modified: team/rmudgett/aoc_event/rose_etsi_aoc.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/aoc_event/rose_etsi_aoc.c?view=diff&rev=1658&r1=1657&r2=1658
==============================================================================
--- team/rmudgett/aoc_event/rose_etsi_aoc.c (original)
+++ team/rmudgett/aoc_event/rose_etsi_aoc.c Thu Apr 22 18:27:45 2010
@@ -623,8 +623,13 @@
 		ASN1_CALL(pos, asn1_enc_null(pos, end, ASN1_TYPE_NULL));
 		break;
 	case 1:	/* currency_info_list */
-		ASN1_CALL(pos, rose_enc_etsi_AOCSCurrencyInfoList(ctrl, pos, end,
-			ASN1_TAG_SEQUENCE, &args->etsi.AOCSCurrency.currency_info));
+		if (args->etsi.AOCSCurrency.currency_info.num_records) {
+			ASN1_CALL(pos, rose_enc_etsi_AOCSCurrencyInfoList(ctrl, pos, end,
+				ASN1_TAG_SEQUENCE, &args->etsi.AOCSCurrency.currency_info));
+		} else {
+			/* There were no records so encode as charge_not_available */
+			ASN1_CALL(pos, asn1_enc_null(pos, end, ASN1_TYPE_NULL));
+		}
 		break;
 	default:
 		ASN1_ENC_ERROR(ctrl, "Unknown AOCSCurrency type");




More information about the libpri-commits mailing list