[asterisk-commits] dvossel: branch dvossel/generic_aoc r258303 - in /team/dvossel/generic_aoc: c...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 21 11:02:34 CDT 2010


Author: dvossel
Date: Wed Apr 21 11:02:32 2010
New Revision: 258303

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=258303
Log:
fixes reviewboard comments

Modified:
    team/dvossel/generic_aoc/channels/chan_sip.c
    team/dvossel/generic_aoc/channels/sig_pri.c
    team/dvossel/generic_aoc/channels/sig_pri.h
    team/dvossel/generic_aoc/doc/advice_of_charge.txt
    team/dvossel/generic_aoc/main/aoc.c
    team/dvossel/generic_aoc/main/manager.c

Modified: team/dvossel/generic_aoc/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/channels/chan_sip.c?view=diff&rev=258303&r1=258302&r2=258303
==============================================================================
--- team/dvossel/generic_aoc/channels/chan_sip.c (original)
+++ team/dvossel/generic_aoc/channels/chan_sip.c Wed Apr 21 11:02:32 2010
@@ -6250,6 +6250,7 @@
 					ast_log(LOG_DEBUG, "AOC-E termination request received on %s. This is not yet supported on sip. Continue with hangup \n", p->owner->name);
 					ast_softhangup_nolock(p->owner, AST_SOFTHANGUP_DEV);
 				}
+				break;
 			case AST_AOC_D:
 			case AST_AOC_E:
 				if (ast_test_flag(&p->flags[2], SIP_PAGE3_SNOM_AOC)) {

Modified: team/dvossel/generic_aoc/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/channels/sig_pri.c?view=diff&rev=258303&r1=258302&r2=258303
==============================================================================
--- team/dvossel/generic_aoc/channels/sig_pri.c (original)
+++ team/dvossel/generic_aoc/channels/sig_pri.c Wed Apr 21 11:02:32 2010
@@ -1034,10 +1034,9 @@
 		new_chan->aoc_s_request_invoke_id_valid = old_chan->aoc_s_request_invoke_id_valid;
 		new_chan->holding_aoce = old_chan->holding_aoce;
 		new_chan->waiting_for_aoce = old_chan->waiting_for_aoce;
-		memcpy(&new_chan->aoc_e, &old_chan->aoc_e, sizeof(new_chan->aoc_e));
+		new_chan->aoc_e = old_chan->aoc_e;
 
 		old_chan->holding_aoce = 0;
-		old_chan->aoc_s_request_invoke_id = 0;
 		old_chan->aoc_s_request_invoke_id_valid = 0;
 		old_chan->waiting_for_aoce = 0;
 		memset(&old_chan->aoc_e, 0, sizeof(&old_chan->aoc_e));
@@ -2604,7 +2603,6 @@
 	 * have an aoc_s_request_invoke_id associated with this pvt */
 	if (pvt->aoc_s_request_invoke_id_valid) {
 		pri_aoc_s_request_response_send(pvt->pri->pri, pvt->call, pvt->aoc_s_request_invoke_id, &aoc_s);
-		pvt->aoc_s_request_invoke_id = 0;
 		pvt->aoc_s_request_invoke_id_valid = 0;
 	} else {
 		pri_aoc_s_send(pvt->pri->pri, pvt->call, &aoc_s);
@@ -4697,10 +4695,8 @@
 
 								if (do_hangup) {
 #if defined(HAVE_PRI_AOC_EVENTS)
-									if (!pri->pvts[chanpos]->holding_aoce && pri->aoce_delayhangup && ast_bridged_channel(pri->pvts[chanpos]->owner)) {
-										sig_pri_send_aoce_termination_request(pri->pvts[chanpos], pri_get_timer(pri->pri, PRI_TIMER_T305) / 2);
-									} else if (detect_aoc_e_subcmd(e->hangup.subcmds)) {
-										/* If a AOC-E msg was sent during the Disconnect, we must use a
+									if (detect_aoc_e_subcmd(e->hangup.subcmds)) {
+										/* If a AOC-E msg was sent during the release, we must use a
 										 * AST_CONTROL_HANGUP frame to guarantee that frame gets read before hangup */
 										ast_queue_control(pri->pvts[chanpos]->owner, AST_CONTROL_HANGUP);
 									} else {
@@ -5164,7 +5160,6 @@
 	}
 
 #if defined(HAVE_PRI_AOC_EVENTS)
-	p->aoc_s_request_invoke_id = 0;
 	p->aoc_s_request_invoke_id_valid = 0;
 	p->holding_aoce = 0;
 	p->waiting_for_aoce = 0;
@@ -5863,11 +5858,10 @@
 	if (!pri_grab(p, p->pri)) {
 #if defined(HAVE_PRI_AOC_EVENTS)
 		if (p->aoc_s_request_invoke_id_valid) {
-			/* if AOC-S was requested and the invoke id is still present on hangup.  That means
+			/* if AOC-S was requested and the invoke id is still present on answer.  That means
 			 * no AOC-S rate list was provided, so send a NULL response which will indicate that
 			 * AOC-S is not available */
 			pri_aoc_s_request_response_send(p->pri->pri, p->call, p->aoc_s_request_invoke_id, NULL);
-			p->aoc_s_request_invoke_id = 0;
 			p->aoc_s_request_invoke_id_valid = 0;
 		}
 #endif

Modified: team/dvossel/generic_aoc/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/channels/sig_pri.h?view=diff&rev=258303&r1=258302&r2=258303
==============================================================================
--- team/dvossel/generic_aoc/channels/sig_pri.h (original)
+++ team/dvossel/generic_aoc/channels/sig_pri.h Wed Apr 21 11:02:32 2010
@@ -200,9 +200,9 @@
 #endif	/* defined(HAVE_PRI_SETUP_KEYPAD) */
 
 #if defined(HAVE_PRI_AOC_EVENTS)
+	struct pri_subcmd_aoc_e aoc_e;
 	int aoc_s_request_invoke_id;     /*!< If an AOC-S request was present for the call, this is the invoke_id to use for the response */
-	int aoc_s_request_invoke_id_valid; /*!< This is set when the AOC-S invoke id is present */
-	struct pri_subcmd_aoc_e aoc_e;
+	int aoc_s_request_invoke_id_valid:1; /*!< This is set when the AOC-S invoke id is present */
 	unsigned int waiting_for_aoce:1; /*!< Delaying hangup for AOC-E msg. If this is set and AOC-E is recieved, continue with hangup before timeout period. */
 	unsigned int holding_aoce:1;     /*!< received AOC-E msg from asterisk. holding for disconnect/release */
 #endif

Modified: team/dvossel/generic_aoc/doc/advice_of_charge.txt
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/doc/advice_of_charge.txt?view=diff&rev=258303&r1=258302&r2=258303
==============================================================================
--- team/dvossel/generic_aoc/doc/advice_of_charge.txt (original)
+++ team/dvossel/generic_aoc/doc/advice_of_charge.txt Wed Apr 21 11:02:32 2010
@@ -7,7 +7,7 @@
 
 This document is designed to give an overview of how to configure and
 generate Advice of Charge along with a detailed explanation of how each
-option works. 
+option works.
 
 --------------------------------------
 |           Terminology              |
@@ -126,7 +126,7 @@
 ----- AOC-D Message Generation
 AOC-D message generation can happen anytime throughout the call.  This
 message type is very straight forward.
- 
+
 Example: AOCMessage action generating AOC-D currency message with Success
 response.
 
@@ -146,7 +146,7 @@
 
 ----- AOC-E Message Generation
 AOC-E messages are sent during call termination and represent the final charge
-total for the call.  Since in Asterisk call termination results in the channel
+total for the call.  Since Asterisk call termination results in the channel
 being destroyed, it is currently not possible for the AOCMessage AMI action to
 be used to send the final AOC-E message on call hangup.  There is however a
 work around for this issue that can be used for Dahdi channels.  By default
@@ -172,7 +172,7 @@
 UnitAmount(2): 333
 UnitType(3): 4
 UnitAmount(4): 444
-AOCBillingId: CallTransfer
+AOCBillingId: Normal
 ActionID: 1234
 
 Response: Success

Modified: team/dvossel/generic_aoc/main/aoc.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/main/aoc.c?view=diff&rev=258303&r1=258302&r2=258303
==============================================================================
--- team/dvossel/generic_aoc/main/aoc.c (original)
+++ team/dvossel/generic_aoc/main/aoc.c Wed Apr 21 11:02:32 2010
@@ -382,7 +382,7 @@
 /*
  * \internal
  * \brief append an AOC information element
- *  \note data is expecte to already be in network byte order at this point
+ *  \note data is expected to already be in network byte order at this point
  */
 static int aoc_append_ie(struct aoc_ie_data *ied, unsigned short ie_id, const void *data, unsigned short datalen)
 {
@@ -609,7 +609,7 @@
 		return -1;
 	}
 
-	memcpy(&decoded->aoc_s_entries[decoded->aoc_s_count], entry, sizeof(decoded->aoc_s_entries[decoded->aoc_s_count]));
+	decoded->aoc_s_entries[decoded->aoc_s_count] = *entry;
 	decoded->aoc_s_count++;
 
 	return 0;
@@ -1140,7 +1140,7 @@
 	case AST_AOC_BILLING_NORMAL:
 		return "Normal";
 	case AST_AOC_BILLING_REVERSE_CHARGE:
-		return "Reverse Charge";
+		return "Reverse";
 	case AST_AOC_BILLING_CREDIT_CARD:
 		return "CreditCard";
 	case AST_AOC_BILLING_CALL_FWD_UNCONDITIONAL:
@@ -1164,7 +1164,7 @@
 
 int ast_aoc_test_encode_decode_match(struct ast_aoc_decoded *decoded)
 {
-	struct ast_aoc_decoded *new = NULL;
+	struct ast_aoc_decoded *new_decoded = NULL;
 	struct ast_aoc_encoded *encoded = NULL;
 	size_t size;
 	int res = 0;
@@ -1173,16 +1173,16 @@
 		return -1;
 	}
 
-	if (!(new = ast_aoc_decode(encoded, size, NULL))) {
+	if (!(new_decoded = ast_aoc_decode(encoded, size, NULL))) {
 		ast_free(encoded);
 		return -1;
 	}
 
-	if (memcmp(new, decoded, sizeof(struct ast_aoc_decoded))) {
+	if (memcmp(new_decoded, decoded, sizeof(struct ast_aoc_decoded))) {
 		res = -1;
 	}
 
-	ast_aoc_destroy_decoded(new);
+	ast_aoc_destroy_decoded(new_decoded);
 	ast_aoc_destroy_encoded(encoded);
 	return res;
 }

Modified: team/dvossel/generic_aoc/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/main/manager.c?view=diff&rev=258303&r1=258302&r2=258303
==============================================================================
--- team/dvossel/generic_aoc/main/manager.c (original)
+++ team/dvossel/generic_aoc/main/manager.c Wed Apr 21 11:02:32 2010
@@ -3517,15 +3517,11 @@
 	ast_str_set(&str, 0, "UnitType(%u)", entry_num);
 	unittype = astman_get_header(m, ast_str_buffer(str));
 
-	if (ast_strlen_zero(unitamount) || (sscanf(unitamount, "%30u", &entry->amount) != 1)) {
-		entry->valid_amount = 0;
-	} else {
+	if (!ast_strlen_zero(unitamount) && (sscanf(unitamount, "%30u", &entry->amount) == 1)) {
 		entry->valid_amount = 1;
 	}
 
-	if (ast_strlen_zero(unittype) || sscanf(unittype, "%30u", &entry->type) != 1) {
-		entry->valid_type = 0;
-	} else {
+	if (!ast_strlen_zero(unittype) && sscanf(unittype, "%30u", &entry->type) == 1) {
 		entry->valid_type = 1;
 	}
 
@@ -3604,6 +3600,7 @@
 
 		if (ast_strlen_zero(currencyamount) || (sscanf(currencyamount, "%30u", &_currencyamount) != 1)) {
 			astman_send_error(s, m, "Invalid CurrencyAmount, CurrencyAmount is a required when ChargeType is Currency");
+			goto aocmessage_cleanup;
 		}
 
 		if (ast_strlen_zero(mult)) {
@@ -3678,9 +3675,11 @@
 
 		if (!ast_strlen_zero(association_id) && (sscanf(association_id, "%30d", &_association_id) != 1)) {
 			astman_send_error(s, m, "Invalid ChargingAssociationId");
+			goto aocmessage_cleanup;
 		}
 		if (!ast_strlen_zero(association_plan) && (sscanf(association_plan, "%30u", &_association_plan) != 1)) {
 			astman_send_error(s, m, "Invalid ChargingAssociationPlan");
+			goto aocmessage_cleanup;
 		}
 
 		if (_association_id) {




More information about the asterisk-commits mailing list