31 #define AOC_CURRENCY_NAME_SIZE (10 + 1)
35 AST_AOC_MULT_ONETHOUSANDTH = 1,
36 AST_AOC_MULT_ONEHUNDREDTH,
37 AST_AOC_MULT_ONETENTH,
41 AST_AOC_MULT_THOUSAND,
42 AST_AOC_MULT_NUM_ENTRIES,
50 AST_AOC_BILLING_NA = 0,
51 AST_AOC_BILLING_NORMAL,
52 AST_AOC_BILLING_REVERSE_CHARGE,
53 AST_AOC_BILLING_CREDIT_CARD,
54 AST_AOC_BILLING_CALL_FWD_UNCONDITIONAL,
55 AST_AOC_BILLING_CALL_FWD_BUSY,
56 AST_AOC_BILLING_CALL_FWD_NO_REPLY,
57 AST_AOC_BILLING_CALL_DEFLECTION,
58 AST_AOC_BILLING_CALL_TRANSFER,
59 AST_AOC_BILLING_NUM_ENTRIES
69 enum ast_aoc_charge_type {
70 AST_AOC_CHARGE_NA = 0,
72 AST_AOC_CHARGE_CURRENCY,
76 enum ast_aoc_request {
77 AST_AOC_REQUEST_S = (1 << 0),
78 AST_AOC_REQUEST_D = (1 << 1),
79 AST_AOC_REQUEST_E = (1 << 2),
82 enum ast_aoc_total_type {
87 enum ast_aoc_time_scale {
88 AST_AOC_TIME_SCALE_HUNDREDTH_SECOND,
89 AST_AOC_TIME_SCALE_TENTH_SECOND,
90 AST_AOC_TIME_SCALE_SECOND,
91 AST_AOC_TIME_SCALE_TEN_SECOND,
92 AST_AOC_TIME_SCALE_MINUTE,
93 AST_AOC_TIME_SCALE_HOUR,
94 AST_AOC_TIME_SCALE_DAY,
111 uint16_t granularity_time_scale;
125 enum ast_aoc_volume_unit {
126 AST_AOC_VOLUME_UNIT_OCTET,
127 AST_AOC_VOLUME_UNIT_SEGMENT,
128 AST_AOC_VOLUME_UNIT_MESSAGE,
134 uint16_t volume_unit;
135 char currency_name[AOC_CURRENCY_NAME_SIZE];
145 enum ast_aoc_s_charged_item {
146 AST_AOC_CHARGED_ITEM_NA,
147 AST_AOC_CHARGED_ITEM_SPECIAL_ARRANGEMENT,
148 AST_AOC_CHARGED_ITEM_BASIC_COMMUNICATION,
149 AST_AOC_CHARGED_ITEM_CALL_ATTEMPT,
150 AST_AOC_CHARGED_ITEM_CALL_SETUP,
151 AST_AOC_CHARGED_ITEM_USER_USER_INFO,
152 AST_AOC_CHARGED_ITEM_SUPPLEMENTARY_SERVICE,
155 enum ast_aoc_s_rate_type {
156 AST_AOC_RATE_TYPE_NA,
157 AST_AOC_RATE_TYPE_FREE,
158 AST_AOC_RATE_TYPE_FREE_FROM_BEGINNING,
159 AST_AOC_RATE_TYPE_DURATION,
160 AST_AOC_RATE_TYPE_FLAT,
161 AST_AOC_RATE_TYPE_VOLUME,
162 AST_AOC_RATE_TYPE_SPECIAL_CODE,
166 uint16_t charged_item;
174 uint16_t special_code;
176 } __attribute__((packed));
185 enum AST_AOC_CHARGING_ASSOCIATION {
186 AST_AOC_CHARGING_ASSOCIATION_NA,
187 AST_AOC_CHARGING_ASSOCIATION_NUMBER,
188 AST_AOC_CHARGING_ASSOCIATION_ID,
193 } __attribute__((packed));
201 } __attribute__((packed));
223 const enum ast_aoc_charge_type charge_type,
224 const enum ast_aoc_request
requests);
284 const unsigned int amount,
304 const unsigned int amount_is_present,
305 const unsigned int amount,
306 const unsigned int type_is_present,
307 const unsigned int type);
383 enum ast_aoc_s_charged_item charged_item,
386 const char *currency_name,
388 enum ast_aoc_time_scale time_scale,
389 unsigned long granularity_time,
390 enum ast_aoc_time_scale granularity_time_scale,
407 enum ast_aoc_s_charged_item charged_item,
410 const char *currency_name);
427 enum ast_aoc_s_charged_item charged_item,
428 enum ast_aoc_volume_unit volume_unit,
431 const char *currency_name);
445 enum ast_aoc_s_charged_item charged_item,
460 enum ast_aoc_s_charged_item charged_item,
int from_beginning);
473 enum ast_aoc_s_charged_item charged_item);
int ast_aoc_decoded2str(const struct ast_aoc_decoded *decoded, struct ast_str **msg)
Convert decoded aoc msg to string representation.
int ast_aoc_s_add_rate_duration(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item, unsigned int amount, enum ast_aoc_currency_multiplier multiplier, const char *currency_name, unsigned long time, enum ast_aoc_time_scale time_scale, unsigned long granularity_time, enum ast_aoc_time_scale granularity_time_scale, int step_function)
Add AOC-S duration rate entry.
Main Channel structure associated with a channel.
int ast_aoc_set_termination_request(struct ast_aoc_decoded *decoded)
Mark the AST_AOC_REQUEST message as a termination request.
int ast_aoc_add_unit_entry(struct ast_aoc_decoded *decoded, const unsigned int amount_is_present, const unsigned int amount, const unsigned int type_is_present, const unsigned int type)
Adds a unit entry into the list of units.
enum ast_aoc_request ast_aoc_get_request(struct ast_aoc_decoded *decoded)
get the types of AOC requested for when message type is AOC Request
int ast_aoc_s_add_special_arrangement(struct ast_aoc_decoded *decoded, unsigned int code)
Add AOC-S special arrangement entry.
union ast_aoc_s_entry::@180 rate
Charge rate being applied.
int ast_aoc_s_add_rate_flat(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item, unsigned int amount, enum ast_aoc_currency_multiplier multiplier, const char *currency_name)
Add AOC-S flat rate entry.
enum ast_aoc_total_type ast_aoc_get_total_type(struct ast_aoc_decoded *decoded)
get the type of total for a AOC-D message
void * ast_aoc_destroy_decoded(struct ast_aoc_decoded *decoded)
free an ast_aoc_decoded object
int ast_aoc_s_add_rate_special_charge_code(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item, unsigned int code)
Add AOC-S special rate entry.
uint8_t charging_type
Charging interval type.
int ast_aoc_s_add_rate_volume(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item, enum ast_aoc_volume_unit volume_unit, unsigned int amount, enum ast_aoc_currency_multiplier multiplier, const char *currency_name)
Add AOC-S volume rate entry.
ast_aoc_currency_multiplier
Defines the currency multiplier for an aoc message.
int ast_aoc_manager_event(const struct ast_aoc_decoded *decoded, struct ast_channel *chan)
generate AOC manager event for an AOC-S, AOC-D, or AOC-E msg
int ast_aoc_s_add_rate_free(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item, int from_beginning)
Add AOC-S indicating charge item is free.
const char * ast_aoc_get_currency_multiplier_decimal(struct ast_aoc_decoded *decoded)
get the currency multiplier for AOC-D and AOC-E messages in decimal format
const struct ast_aoc_s_entry * ast_aoc_s_get_rate_info(struct ast_aoc_decoded *decoded, unsigned int entry_number)
get a specific AOC-S rate entry.
int ast_aoc_set_association_number(struct ast_aoc_decoded *decoded, const char *num, uint8_t plan)
set the charging association number for an AOC-E message
unsigned int ast_aoc_s_get_count(struct ast_aoc_decoded *decoded)
get the number rates associated with an AOC-S message
struct ast_aoc_decoded * ast_aoc_decode(struct ast_aoc_encoded *encoded, size_t size, struct ast_channel *chan)
decodes an encoded aoc payload.
General Asterisk PBX channel definitions.
int ast_aoc_s_add_rate_na(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item)
Add AOC-S entry indicating charge item is not available.
struct ast_aoc_encoded * ast_aoc_encode(struct ast_aoc_decoded *decoded, size_t *out_size, struct ast_channel *chan)
encodes a decoded aoc structure so it can be passed on the wire
char currency_name[AOC_CURRENCY_NAME_SIZE]
int ast_aoc_cli_init(void)
enable aoc cli options
unsigned int ast_aoc_get_currency_amount(struct ast_aoc_decoded *decoded)
get the currency amount for AOC-D and AOC-E messages
int ast_aoc_set_billing_id(struct ast_aoc_decoded *decoded, const enum ast_aoc_billing_id id)
set the billing id for a AOC-D or AST_AOC_E message
int ast_aoc_test_encode_decode_match(struct ast_aoc_decoded *decoded)
test aoc encode decode routines.
Support for dynamic strings.
const struct ast_aoc_unit_entry * ast_aoc_get_unit_info(struct ast_aoc_decoded *decoded, unsigned int entry_number)
get a specific unit entry.
int ast_aoc_get_termination_request(struct ast_aoc_decoded *decoded)
get whether or not the AST_AOC_REQUEST message as a termination request.
uint32_t granularity_time
enum ast_aoc_billing_id ast_aoc_get_billing_id(struct ast_aoc_decoded *decoded)
get the billing id for AOC-D and AOC-E messages
int ast_aoc_set_total_type(struct ast_aoc_decoded *decoded, const enum ast_aoc_total_type type)
Sets the type of total for a AOC-D message.
void * ast_aoc_destroy_encoded(struct ast_aoc_encoded *encoded)
free an ast_aoc_encoded object
char currency_name[AOC_CURRENCY_NAME_SIZE]
const char * ast_aoc_get_currency_name(struct ast_aoc_decoded *decoded)
get the currency name for AOC-D and AOC-E messages
struct ast_aoc_decoded * ast_aoc_create(const enum ast_aoc_type msg_type, const enum ast_aoc_charge_type charge_type, const enum ast_aoc_request requests)
creates a ast_aoc_decode object of a specific message type
enum ast_aoc_charge_type ast_aoc_get_charge_type(struct ast_aoc_decoded *decoded)
get the charging type for an AOC-D or AOC-E message
ast_aoc_billing_id
Defines the billing id options for an aoc message.
int ast_aoc_set_association_id(struct ast_aoc_decoded *decoded, const int id)
set the charging association id for an AST_AOC_E message
enum ast_aoc_type ast_aoc_get_msg_type(struct ast_aoc_decoded *decoded)
get the message type, AOC-D, AOC-E, or AOC Request
enum ast_aoc_currency_multiplier ast_aoc_get_currency_multiplier(struct ast_aoc_decoded *decoded)
get the currency multiplier for AOC-D and AOC-E messages
unsigned int ast_aoc_get_unit_count(struct ast_aoc_decoded *decoded)
get the number of unit entries for AOC-D and AOC-E messages
int ast_aoc_set_currency_info(struct ast_aoc_decoded *decoded, const unsigned int amount, const enum ast_aoc_currency_multiplier multiplier, const char *name)
Sets the currency values for a AOC-D or AOC-E message.
const struct ast_aoc_charging_association * ast_aoc_get_association_info(struct ast_aoc_decoded *decoded)
get the charging association info for AOC-E messages