From afd4454c4446ee1889616d09541171fc6355bbf7 Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Wed, 2 Jun 2010 18:10:15 +0000 Subject: Generic Advice of Charge. Asterisk Generic AOC Representation - Generic AOC encode/decode routines. (Generic AOC must be encoded to be passed on the wire in the AST_CONTROL_AOC frame) - AST_CONTROL_AOC frame type to represent generic encoded AOC data - Manager events for AOC-S, AOC-D, and AOC-E messages Asterisk App Support - app_dial AOC-S pass-through support on call setup - app_queue AOC-S pass-through support on call setup AOC Unit Tests - AOC Unit Tests for encode/decode routines - AOC Unit Test for manager event representation. SIP AOC Support - Pass-through of generic AOC-D and AOC-E messages to snom phones via the snom AOC specification. - Creation of chan_sip page3 flags for the addition of the new 'snom_aoc_enabled' sip.conf option. IAX AOC Support - Natively supports AOC pass-through through the use of the new AST_CONTROL_AOC frame type DAHDI AOC Support - ETSI PRI full AOC Pass-through support - 'aoc_enable' chan_dahdi.conf option for independently enabling pass-through of AOC-S, AOC-D, AOC-E. - 'aoce_delayhangup' option for retrieving AOC-E on disconnect. - DAHDI A() dial string option for requesting AOC services. example usage: ;requests AOC-S, AOC-D, and AOC-E on call setup exten=>1111,1,Dial(DAHDI/g1/1112/A(s,d,e)) Review: https://reviewboard.asterisk.org/r/552/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267096 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_dial.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'apps/app_dial.c') diff --git a/apps/app_dial.c b/apps/app_dial.c index 1422a4e02..d813c0068 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -62,6 +62,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/global_datastores.h" #include "asterisk/dsp.h" #include "asterisk/cel.h" +#include "asterisk/aoc.h" #include "asterisk/ccss.h" #include "asterisk/indications.h" @@ -638,6 +639,7 @@ struct chanlist { struct ast_party_connected_line connected; /*! TRUE if an AST_CONTROL_CONNECTED_LINE update was saved to the connected element. */ unsigned int pending_connected_update:1; + struct ast_aoc_decoded *aoc_s_rate_list; }; static int detect_disconnect(struct ast_channel *chan, char code, struct ast_str *featurecode); @@ -645,6 +647,7 @@ static int detect_disconnect(struct ast_channel *chan, char code, struct ast_str static void chanlist_free(struct chanlist *outgoing) { ast_party_connected_line_free(&outgoing->connected); + ast_aoc_destroy_decoded(outgoing->aoc_s_rate_list); ast_free(outgoing); } @@ -1053,6 +1056,14 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, ast_party_connected_line_free(&connected_caller); } } + if (o->aoc_s_rate_list) { + size_t encoded_size; + struct ast_aoc_encoded *encoded; + if ((encoded = ast_aoc_encode(o->aoc_s_rate_list, &encoded_size, o->chan))) { + ast_indicate_data(in, AST_CONTROL_AOC, encoded, encoded_size); + ast_aoc_destroy_encoded(encoded); + } + } peer = c; ast_copy_flags64(peerflags, o, OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER | @@ -1115,6 +1126,14 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, ast_party_connected_line_free(&connected_caller); } } + if (o->aoc_s_rate_list) { + size_t encoded_size; + struct ast_aoc_encoded *encoded; + if ((encoded = ast_aoc_encode(o->aoc_s_rate_list, &encoded_size, o->chan))) { + ast_indicate_data(in, AST_CONTROL_AOC, encoded, encoded_size); + ast_aoc_destroy_encoded(encoded); + } + } peer = c; if (peer->cdr) { peer->cdr->answer = ast_tvnow(); @@ -1230,6 +1249,17 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, } } break; + case AST_CONTROL_AOC: + { + struct ast_aoc_decoded *decoded = ast_aoc_decode(f->data.ptr, f->datalen, o->chan); + if (decoded && (ast_aoc_get_msg_type(decoded) == AST_AOC_S)) { + ast_aoc_destroy_decoded(o->aoc_s_rate_list); + o->aoc_s_rate_list = decoded; + } else { + ast_aoc_destroy_decoded(decoded); + } + } + break; case AST_CONTROL_REDIRECTING: if (ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) { ast_verb(3, "Redirecting update to %s prevented.\n", in->name); -- cgit v1.2.3