[asterisk-commits] dvossel: branch dvossel/generic_aoc r256480 - /team/dvossel/generic_aoc/chann...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Apr 8 16:17:40 CDT 2010
Author: dvossel
Date: Thu Apr 8 16:17:37 2010
New Revision: 256480
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=256480
Log:
store aoc_e messages to be sent over pri on either disconnect or release
Modified:
team/dvossel/generic_aoc/channels/sig_pri.c
team/dvossel/generic_aoc/channels/sig_pri.h
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=256480&r1=256479&r2=256480
==============================================================================
--- team/dvossel/generic_aoc/channels/sig_pri.c (original)
+++ team/dvossel/generic_aoc/channels/sig_pri.c Thu Apr 8 16:17:37 2010
@@ -2647,62 +2647,64 @@
*/
static void sig_pri_aoc_e_from_ast(struct sig_pri_chan *pvt, struct ast_channel *ast, struct ast_aoc_decoded *decoded)
{
- struct pri_subcmd_aoc_e aoc_e = { 0, };
-
+ struct pri_subcmd_aoc_e *aoc_e = &pvt->aoc_e;
+
+ memset(aoc_e, 0, sizeof(*aoc_e));
+ pvt->holding_aoce = 1;
if (ast_aoc_get_association_id(decoded)) {
- aoc_e.associated.charge.id = ast_aoc_get_association_id(decoded);
- aoc_e.associated.charging_type = PRI_AOC_E_CHARGING_ASSOCIATION_ID;
+ aoc_e->associated.charge.id = ast_aoc_get_association_id(decoded);
+ aoc_e->associated.charging_type = PRI_AOC_E_CHARGING_ASSOCIATION_ID;
} else if (!ast_strlen_zero(ast_aoc_get_association_number(decoded))) {
- ast_copy_string(aoc_e.associated.charge.number.str, ast_aoc_get_association_number(decoded), sizeof(aoc_e.associated.charge.number.str));
- aoc_e.associated.charge.number.plan = ast_aoc_get_association_plan(decoded);
- aoc_e.associated.charging_type = PRI_AOC_E_CHARGING_ASSOCIATION_NUMBER;
+ ast_copy_string(aoc_e->associated.charge.number.str, ast_aoc_get_association_number(decoded), sizeof(aoc_e->associated.charge.number.str));
+ aoc_e->associated.charge.number.plan = ast_aoc_get_association_plan(decoded);
+ aoc_e->associated.charging_type = PRI_AOC_E_CHARGING_ASSOCIATION_NUMBER;
} else {
- aoc_e.associated.charging_type = PRI_AOC_E_CHARGING_ASSOCIATION_NOT_AVAILABLE;
+ aoc_e->associated.charging_type = PRI_AOC_E_CHARGING_ASSOCIATION_NOT_AVAILABLE;
}
switch (ast_aoc_get_billing_id(decoded)) {
case AST_AOC_BILLING_NORMAL:
- aoc_e.billing_id = PRI_AOC_E_BILLING_ID_NORMAL;
+ aoc_e->billing_id = PRI_AOC_E_BILLING_ID_NORMAL;
break;
case AST_AOC_BILLING_REVERSE_CHARGE:
- aoc_e.billing_id = PRI_AOC_E_BILLING_ID_REVERSE;
+ aoc_e->billing_id = PRI_AOC_E_BILLING_ID_REVERSE;
break;
case AST_AOC_BILLING_CREDIT_CARD:
- aoc_e.billing_id = PRI_AOC_E_BILLING_ID_CREDIT_CARD;
+ aoc_e->billing_id = PRI_AOC_E_BILLING_ID_CREDIT_CARD;
break;
case AST_AOC_BILLING_CALL_FWD_UNCONDITIONAL:
- aoc_e.billing_id = PRI_AOC_E_BILLING_ID_CALL_FORWARDING_UNCONDITIONAL;
+ aoc_e->billing_id = PRI_AOC_E_BILLING_ID_CALL_FORWARDING_UNCONDITIONAL;
break;
case AST_AOC_BILLING_CALL_FWD_BUSY:
- aoc_e.billing_id = PRI_AOC_E_BILLING_ID_CALL_FORWARDING_BUSY;
+ aoc_e->billing_id = PRI_AOC_E_BILLING_ID_CALL_FORWARDING_BUSY;
break;
case AST_AOC_BILLING_CALL_FWD_NO_REPLY:
- aoc_e.billing_id = PRI_AOC_E_BILLING_ID_CALL_FORWARDING_NO_REPLY;
+ aoc_e->billing_id = PRI_AOC_E_BILLING_ID_CALL_FORWARDING_NO_REPLY;
break;
case AST_AOC_BILLING_CALL_DEFLECTION:
- aoc_e.billing_id = PRI_AOC_E_BILLING_ID_CALL_DEFLECTION;
+ aoc_e->billing_id = PRI_AOC_E_BILLING_ID_CALL_DEFLECTION;
break;
case AST_AOC_BILLING_CALL_TRANSFER:
- aoc_e.billing_id = PRI_AOC_E_BILLING_ID_CALL_TRANSFER;
+ aoc_e->billing_id = PRI_AOC_E_BILLING_ID_CALL_TRANSFER;
break;
case AST_AOC_BILLING_NA:
default:
- aoc_e.billing_id = PRI_AOC_E_BILLING_ID_NOT_AVAILABLE;
+ aoc_e->billing_id = PRI_AOC_E_BILLING_ID_NOT_AVAILABLE;
};
switch (ast_aoc_get_charge_type(decoded)) {
case AST_AOC_CHARGE_FREE:
- aoc_e.charge = PRI_AOC_DE_CHARGE_FREE;
+ aoc_e->charge = PRI_AOC_DE_CHARGE_FREE;
break;
case AST_AOC_CHARGE_CURRENCY:
{
const char *currency_name = ast_aoc_get_currency_name(decoded);
- aoc_e.charge = PRI_AOC_DE_CHARGE_CURRENCY;
- aoc_e.recorded.money.amount.cost = ast_aoc_get_currency_amount(decoded);
- aoc_e.recorded.money.amount.multiplier = sig_pri_aoc_multiplier_from_ast(ast_aoc_get_currency_multiplier(decoded));
+ aoc_e->charge = PRI_AOC_DE_CHARGE_CURRENCY;
+ aoc_e->recorded.money.amount.cost = ast_aoc_get_currency_amount(decoded);
+ aoc_e->recorded.money.amount.multiplier = sig_pri_aoc_multiplier_from_ast(ast_aoc_get_currency_multiplier(decoded));
if (!ast_strlen_zero(currency_name)) {
- ast_copy_string(aoc_e.recorded.money.currency, currency_name, sizeof(aoc_e.recorded.money.currency));
+ ast_copy_string(aoc_e->recorded.money.currency, currency_name, sizeof(aoc_e->recorded.money.currency));
}
}
break;
@@ -2710,22 +2712,20 @@
{
const struct ast_aoc_unit_entry *entry;
int i;
- aoc_e.charge = PRI_AOC_DE_CHARGE_UNITS;
+ aoc_e->charge = PRI_AOC_DE_CHARGE_UNITS;
for (i = 0; i < ast_aoc_get_unit_count(decoded); i++) {
- if ((entry = ast_aoc_get_unit_info(decoded, i)) && i < ARRAY_LEN(aoc_e.recorded.unit.item)) {
- aoc_e.recorded.unit.item[i].number = entry->amount;
- aoc_e.recorded.unit.item[i].type = entry->type;
- aoc_e.recorded.unit.num_items++;
+ if ((entry = ast_aoc_get_unit_info(decoded, i)) && i < ARRAY_LEN(aoc_e->recorded.unit.item)) {
+ aoc_e->recorded.unit.item[i].number = entry->amount;
+ aoc_e->recorded.unit.item[i].type = entry->type;
+ aoc_e->recorded.unit.num_items++;
}
}
}
break;
case AST_AOC_CHARGE_NA:
default:
- aoc_e.charge = PRI_AOC_DE_CHARGE_NOT_AVAILABLE;
+ aoc_e->charge = PRI_AOC_DE_CHARGE_NOT_AVAILABLE;
};
-
- pri_aoc_e_send(pvt->pri->pri, pvt->call, &aoc_e);
}
#endif /* defined(HAVE_PRI_AOC_EVENTS) */
@@ -4585,6 +4585,13 @@
sig_pri_lock_private(pri->pvts[chanpos]);
}
#endif /* defined(HAVE_PRI_CALL_HOLD) */
+
+#if defined(HAVE_PRI_AOC_EVENTS)
+ /* since a hangup request event is a disconnect, any resulting AOC-E sent for this call
+ * should be done on the release now. */
+ pri->pvts[chanpos]->send_aoce_on_release = 1;
+#endif
+
switch (e->hangup.cause) {
case PRI_CAUSE_USER_BUSY:
case PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION:
@@ -4931,6 +4938,13 @@
if (atoi(cause))
icause = atoi(cause);
}
+
+#if defined(HAVE_PRI_AOC_EVENTS)
+ if (p->holding_aoce) {
+ pri_aoc_e_send(p->pri->pri, p->call, &p->aoc_e, p->send_aoce_on_release);
+ }
+#endif
+
pri_hangup(p->pri->pri, p->call, icause);
}
}
@@ -4941,6 +4955,11 @@
ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->pri->span);
res = -1;
}
+
+#if defined(HAVE_PRI_AOC_EVENTS)
+ p->holding_aoce = 0;
+ p->send_aoce_on_release = 0;
+#endif
ast->tech_pvt = NULL;
return res;
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=256480&r1=256479&r2=256480
==============================================================================
--- team/dvossel/generic_aoc/channels/sig_pri.h (original)
+++ team/dvossel/generic_aoc/channels/sig_pri.h Thu Apr 8 16:17:37 2010
@@ -241,6 +241,12 @@
* 0,2-7 - Reserved for future use
*/
int reverse_charging_indication;
+#endif
+
+#if defined(HAVE_PRI_AOC_EVENTS)
+ struct pri_subcmd_aoc_e aoc_e;
+ unsigned int holding_aoce:1; /*!< received AOC-E msg from asterisk. holding for disconnect/release */
+ unsigned int send_aoce_on_release:1; /*!< indicates if AOC-E msg should be sent on disconnect or release. */
#endif
};
More information about the asterisk-commits
mailing list