Asterisk - The Open Source Telephony Project
18.5.0
|
generic AOC payload generation encoding and decoding More...
#include "asterisk.h"
#include "asterisk/aoc.h"
#include "asterisk/utils.h"
#include "asterisk/strings.h"
#include "asterisk/_private.h"
#include "asterisk/cli.h"
#include "asterisk/manager.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/stasis_message_router.h"
Go to the source code of this file.
Data Structures | |
struct | aoc_event_blob |
struct | aoc_ie_billing |
struct | aoc_ie_charging_association |
struct | aoc_ie_charging_rate |
struct | aoc_ie_currency |
struct | aoc_ie_data |
struct | aoc_ie_unit |
struct | aoc_pl_ie_hdr |
AOC IE payload header. More... | |
struct | ast_aoc_decoded |
struct | ast_aoc_encoded |
Macros | |
#define | AST_AOC_ENCODE_VERSION 1 |
#define | AST_AOC_ENCODED_CHARGE_CURRENCY (2 << 5) |
#define | AST_AOC_ENCODED_CHARGE_FREE (1 << 5) |
#define | AST_AOC_ENCODED_CHARGE_NA (0 << 5) |
#define | AST_AOC_ENCODED_CHARGE_SUBTOTAL (1 << 7) |
#define | AST_AOC_ENCODED_CHARGE_TOTAL (0 << 7) |
#define | AST_AOC_ENCODED_CHARGE_UNIT (3 << 5) |
#define | AST_AOC_ENCODED_REQUEST_D (1 << 3) |
#define | AST_AOC_ENCODED_REQUEST_E (1 << 4) |
#define | AST_AOC_ENCODED_REQUEST_S (1 << 2) |
#define | AST_AOC_ENCODED_TYPE_D (1 << 0) |
#define | AST_AOC_ENCODED_TYPE_E (2 << 0) |
#define | AST_AOC_ENCODED_TYPE_REQUEST (0 << 0) |
#define | AST_AOC_ENCODED_TYPE_S (3 << 0) |
Enumerations | |
enum | AOC_IE { AOC_IE_CURRENCY = 1, AOC_IE_UNIT = 2, AOC_IE_BILLING = 3, AOC_IE_CHARGING_ASSOCIATION = 4, AOC_IE_RATE = 5, AOC_IE_TERMINATION_REQUEST = 6 } |
AOC Payload Information Elements. More... | |
Functions | |
static void | aoc_amount_str (struct ast_str **msg, const char *prefix, unsigned int amount, enum ast_aoc_currency_multiplier mult) |
static int | aoc_append_ie (struct aoc_ie_data *ied, unsigned short ie_id, const void *data, unsigned short datalen) |
static const char * | aoc_billingid_str (enum ast_aoc_billing_id billing_id) |
static const char * | aoc_charge_type_str (enum ast_aoc_charge_type value) |
static const char * | aoc_charged_item_str (enum ast_aoc_s_charged_item value) |
static char * | aoc_cli_debug_enable (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static void | aoc_create_ie_data (struct ast_aoc_decoded *decoded, struct aoc_ie_data *ied) |
static void | aoc_create_ie_data_charging_rate (const struct ast_aoc_s_entry *entry, struct aoc_ie_charging_rate *ie) |
static void | aoc_d_event (const struct ast_aoc_decoded *decoded, struct ast_str **msg) |
static struct ast_manager_event_blob * | aoc_d_to_ami (struct stasis_message *message) |
struct stasis_message_type * | aoc_d_type (void) |
static void | aoc_display_decoded_debug (const struct ast_aoc_decoded *decoded, int decoding, struct ast_channel *chan) |
static void | aoc_e_event (const struct ast_aoc_decoded *decoded, struct ast_str **msg) |
static struct ast_manager_event_blob * | aoc_e_to_ami (struct stasis_message *message) |
struct stasis_message_type * | aoc_e_type (void) |
static void | aoc_event_blob_dtor (void *obj) |
static const char * | aoc_multiplier_str (enum ast_aoc_currency_multiplier mult) |
static int | aoc_parse_ie (struct ast_aoc_decoded *decoded, unsigned char *data, unsigned int datalen) |
static void | aoc_parse_ie_charging_rate (struct ast_aoc_decoded *decoded, const struct aoc_ie_charging_rate *ie) |
static void | aoc_publish_blob (struct ast_channel *chan, struct stasis_message_type *msg_type, struct ast_json *blob) |
static const char * | aoc_rate_type_str (enum ast_aoc_s_rate_type value) |
static void | aoc_request_event (const struct ast_aoc_decoded *decoded, struct ast_str **msg) |
static int | aoc_s_add_entry (struct ast_aoc_decoded *decoded, struct ast_aoc_s_entry *entry) |
static void | aoc_s_event (const struct ast_aoc_decoded *decoded, struct ast_str **msg) |
static struct ast_manager_event_blob * | aoc_s_to_ami (struct stasis_message *message) |
struct stasis_message_type * | aoc_s_type (void) |
static const char * | aoc_scale_str (enum ast_aoc_time_scale value) |
static void | aoc_shutdown (void) |
static void | aoc_time_str (struct ast_str **msg, const char *prefix, const char *name, unsigned long time, enum ast_aoc_time_scale scale) |
static struct ast_manager_event_blob * | aoc_to_ami (struct stasis_message *message, const char *event_name) |
static const char * | aoc_type_of_totaling_str (enum ast_aoc_total_type value) |
static const char * | aoc_volume_unit_str (enum ast_aoc_volume_unit value) |
static struct ast_json * | association_to_json (const struct ast_aoc_decoded *decoded) |
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. More... | |
int | ast_aoc_cli_init (void) |
enable aoc cli options More... | |
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 More... | |
struct ast_aoc_decoded * | ast_aoc_decode (struct ast_aoc_encoded *encoded, size_t size, struct ast_channel *chan) |
decodes an encoded aoc payload. More... | |
int | ast_aoc_decoded2str (const struct ast_aoc_decoded *decoded, struct ast_str **msg) |
Convert decoded aoc msg to string representation. More... | |
void * | ast_aoc_destroy_decoded (struct ast_aoc_decoded *decoded) |
free an ast_aoc_decoded object More... | |
void * | ast_aoc_destroy_encoded (struct ast_aoc_encoded *encoded) |
free an ast_aoc_encoded object More... | |
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 More... | |
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 More... | |
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 More... | |
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 More... | |
unsigned int | ast_aoc_get_currency_amount (struct ast_aoc_decoded *decoded) |
get the currency amount for AOC-D and AOC-E messages More... | |
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 More... | |
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 More... | |
const char * | ast_aoc_get_currency_name (struct ast_aoc_decoded *decoded) |
get the currency name for AOC-D and AOC-E messages More... | |
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 More... | |
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 More... | |
int | ast_aoc_get_termination_request (struct ast_aoc_decoded *decoded) |
get whether or not the AST_AOC_REQUEST message as a termination request. More... | |
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 More... | |
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 More... | |
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. More... | |
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 More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
int | ast_aoc_s_add_special_arrangement (struct ast_aoc_decoded *decoded, unsigned int code) |
Add AOC-S special arrangement entry. More... | |
unsigned int | ast_aoc_s_get_count (struct ast_aoc_decoded *decoded) |
get the number rates associated with an AOC-S message More... | |
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. More... | |
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 More... | |
int | ast_aoc_set_association_number (struct ast_aoc_decoded *decoded, const char *num, uint8_t plan) |
set the charging accociation number for an AOC-E message More... | |
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 More... | |
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. More... | |
int | ast_aoc_set_termination_request (struct ast_aoc_decoded *decoded) |
Mark the AST_AOC_REQUEST message as a termination request. More... | |
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. More... | |
int | ast_aoc_test_encode_decode_match (struct ast_aoc_decoded *decoded) |
test aoc encode decode routines. More... | |
static struct ast_json * | charge_to_json (const struct ast_aoc_decoded *decoded) |
static struct ast_json * | currency_to_json (const char *name, int cost, enum ast_aoc_currency_multiplier mult) |
static struct ast_json * | d_to_json (const struct ast_aoc_decoded *decoded) |
static struct ast_json * | e_to_json (const struct ast_aoc_decoded *decoded) |
static struct ast_json * | s_to_json (const struct ast_aoc_decoded *decoded) |
STASIS_MESSAGE_TYPE_DEFN (aoc_s_type,.to_ami=aoc_s_to_ami) | |
STASIS_MESSAGE_TYPE_DEFN (aoc_d_type,.to_ami=aoc_d_to_ami) | |
STASIS_MESSAGE_TYPE_DEFN (aoc_e_type,.to_ami=aoc_e_to_ami) | |
static struct ast_json * | units_to_json (const struct ast_aoc_decoded *decoded) |
Variables | |
static struct ast_cli_entry | aoc_cli [] |
static char | aoc_debug_enabled = 0 |
generic AOC payload generation encoding and decoding
Definition in file aoc.c.
#define AST_AOC_ENCODE_VERSION 1 |
Definition at line 189 of file aoc.c.
Referenced by ast_aoc_encode().
#define AST_AOC_ENCODED_CHARGE_CURRENCY (2 << 5) |
Definition at line 183 of file aoc.c.
Referenced by ast_aoc_decode(), and ast_aoc_encode().
#define AST_AOC_ENCODED_CHARGE_FREE (1 << 5) |
Definition at line 182 of file aoc.c.
Referenced by ast_aoc_decode(), and ast_aoc_encode().
#define AST_AOC_ENCODED_CHARGE_NA (0 << 5) |
Definition at line 181 of file aoc.c.
Referenced by ast_aoc_encode().
#define AST_AOC_ENCODED_CHARGE_SUBTOTAL (1 << 7) |
Definition at line 186 of file aoc.c.
Referenced by ast_aoc_decode(), and ast_aoc_encode().
#define AST_AOC_ENCODED_CHARGE_UNIT (3 << 5) |
Definition at line 184 of file aoc.c.
Referenced by ast_aoc_decode(), and ast_aoc_encode().
#define AST_AOC_ENCODED_REQUEST_D (1 << 3) |
Definition at line 178 of file aoc.c.
Referenced by ast_aoc_decode(), and ast_aoc_encode().
#define AST_AOC_ENCODED_REQUEST_E (1 << 4) |
Definition at line 179 of file aoc.c.
Referenced by ast_aoc_decode(), and ast_aoc_encode().
#define AST_AOC_ENCODED_REQUEST_S (1 << 2) |
Definition at line 177 of file aoc.c.
Referenced by ast_aoc_decode(), and ast_aoc_encode().
#define AST_AOC_ENCODED_TYPE_D (1 << 0) |
Definition at line 173 of file aoc.c.
Referenced by ast_aoc_decode(), and ast_aoc_encode().
#define AST_AOC_ENCODED_TYPE_E (2 << 0) |
Definition at line 174 of file aoc.c.
Referenced by ast_aoc_decode(), and ast_aoc_encode().
#define AST_AOC_ENCODED_TYPE_REQUEST (0 << 0) |
Definition at line 172 of file aoc.c.
Referenced by ast_aoc_encode().
#define AST_AOC_ENCODED_TYPE_S (3 << 0) |
Definition at line 175 of file aoc.c.
Referenced by ast_aoc_decode(), and ast_aoc_encode().
enum AOC_IE |
AOC Payload Information Elements.
Enumerator | |
---|---|
AOC_IE_CURRENCY | |
AOC_IE_UNIT | |
AOC_IE_BILLING | |
AOC_IE_CHARGING_ASSOCIATION | |
AOC_IE_RATE | |
AOC_IE_TERMINATION_REQUEST |
|
static |
Definition at line 1414 of file aoc.c.
References aoc_multiplier_str(), ast_str_append(), and name.
Referenced by aoc_d_event(), aoc_e_event(), and aoc_s_event().
|
static |
Definition at line 522 of file aoc.c.
References ast_log, aoc_ie_data::buf, ast_aoc_encoded::datalen, LOG_WARNING, and aoc_ie_data::pos.
Referenced by aoc_create_ie_data().
|
static |
Definition at line 1303 of file aoc.c.
References AST_AOC_BILLING_CALL_DEFLECTION, AST_AOC_BILLING_CALL_FWD_BUSY, AST_AOC_BILLING_CALL_FWD_NO_REPLY, AST_AOC_BILLING_CALL_FWD_UNCONDITIONAL, AST_AOC_BILLING_CALL_TRANSFER, AST_AOC_BILLING_CREDIT_CARD, AST_AOC_BILLING_NA, AST_AOC_BILLING_NORMAL, AST_AOC_BILLING_NUM_ENTRIES, and AST_AOC_BILLING_REVERSE_CHARGE.
Referenced by aoc_d_event(), aoc_e_event(), and charge_to_json().
|
static |
Definition at line 1257 of file aoc.c.
References AST_AOC_CHARGE_CURRENCY, AST_AOC_CHARGE_FREE, AST_AOC_CHARGE_NA, AST_AOC_CHARGE_UNIT, and str.
Referenced by aoc_d_event(), aoc_e_event(), and charge_to_json().
|
static |
Definition at line 1121 of file aoc.c.
References AST_AOC_CHARGED_ITEM_BASIC_COMMUNICATION, AST_AOC_CHARGED_ITEM_CALL_ATTEMPT, AST_AOC_CHARGED_ITEM_CALL_SETUP, AST_AOC_CHARGED_ITEM_NA, AST_AOC_CHARGED_ITEM_SPECIAL_ARRANGEMENT, AST_AOC_CHARGED_ITEM_SUPPLEMENTARY_SERVICE, AST_AOC_CHARGED_ITEM_USER_USER_INFO, and str.
Referenced by aoc_s_event(), and s_to_json().
|
static |
Definition at line 1355 of file aoc.c.
References aoc_debug_enabled, ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_false(), ast_true(), CLI_GENERATE, CLI_HANDLER, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 583 of file aoc.c.
References ast_aoc_unit_entry::amount, aoc_ie_currency::amount, aoc_ie_unit::amount, aoc_append_ie(), aoc_create_ie_data_charging_rate(), AOC_IE_BILLING, AOC_IE_CHARGING_ASSOCIATION, AOC_IE_CURRENCY, AOC_IE_RATE, AOC_IE_TERMINATION_REQUEST, AOC_IE_UNIT, ast_aoc_decoded::aoc_s_count, ast_aoc_decoded::aoc_s_entries, AST_AOC_CHARGING_ASSOCIATION_ID, AST_AOC_CHARGING_ASSOCIATION_NA, AST_AOC_CHARGING_ASSOCIATION_NUMBER, ast_copy_string(), ast_strlen_zero, ast_aoc_decoded::billing_id, aoc_ie_charging_association::ca, ast_aoc_charging_association::charge, ast_aoc_decoded::charging_association, ast_aoc_charging_association::charging_type, ast_aoc_decoded::currency_amount, ast_aoc_decoded::currency_name, ast_aoc_charging_association::id, aoc_ie_billing::id, ast_aoc_decoded::multiplier, aoc_ie_currency::name, NULL, ast_aoc_charging_association_number::number, ast_aoc_charging_association::number, ast_aoc_charging_association_number::plan, aoc_ie_data::pos, ast_aoc_decoded::termination_request, ast_aoc_unit_entry::type, aoc_ie_unit::type, ast_aoc_decoded::unit_count, ast_aoc_decoded::unit_list, ast_aoc_unit_entry::valid_amount, aoc_ie_unit::valid_amount, ast_aoc_unit_entry::valid_type, and aoc_ie_unit::valid_type.
Referenced by ast_aoc_encode().
|
static |
Definition at line 537 of file aoc.c.
References ast_aoc_duration_rate::amount, ast_aoc_volume_rate::amount, ast_aoc_flat_rate::amount, AST_AOC_RATE_TYPE_DURATION, AST_AOC_RATE_TYPE_FLAT, AST_AOC_RATE_TYPE_SPECIAL_CODE, AST_AOC_RATE_TYPE_VOLUME, ast_copy_string(), ast_strlen_zero, ast_aoc_s_entry::charged_item, ast_aoc_duration_rate::charging_type, ast_aoc_duration_rate::currency_name, ast_aoc_volume_rate::currency_name, ast_aoc_flat_rate::currency_name, ast_aoc_s_entry::duration, aoc_ie_charging_rate::entry, ast_aoc_s_entry::flat, ast_aoc_duration_rate::granularity_time, ast_aoc_duration_rate::granularity_time_scale, ast_aoc_duration_rate::multiplier, ast_aoc_volume_rate::multiplier, ast_aoc_flat_rate::multiplier, ast_aoc_s_entry::rate, ast_aoc_s_entry::rate_type, ast_aoc_s_entry::special_code, ast_aoc_duration_rate::time, ast_aoc_duration_rate::time_scale, ast_aoc_s_entry::volume, and ast_aoc_volume_rate::volume_unit.
Referenced by aoc_create_ie_data().
|
static |
Definition at line 1511 of file aoc.c.
References ast_aoc_unit_entry::amount, aoc_amount_str(), aoc_billingid_str(), aoc_charge_type_str(), aoc_type_of_totaling_str(), AST_AOC_CHARGE_CURRENCY, AST_AOC_CHARGE_UNIT, ast_str_append(), ast_aoc_decoded::billing_id, ast_aoc_decoded::charge_type, ast_aoc_decoded::currency_amount, ast_aoc_decoded::currency_name, ast_aoc_decoded::multiplier, prefix, ast_aoc_decoded::total_type, ast_aoc_unit_entry::type, ast_aoc_decoded::unit_count, ast_aoc_decoded::unit_list, ast_aoc_unit_entry::valid_amount, and ast_aoc_unit_entry::valid_type.
Referenced by ast_aoc_decoded2str().
|
static |
Definition at line 1902 of file aoc.c.
References aoc_to_ami().
Referenced by aoc_e_to_ami().
struct stasis_message_type* aoc_d_type | ( | void | ) |
Referenced by aoc_e_to_ami(), and ast_aoc_manager_event().
|
static |
Definition at line 1988 of file aoc.c.
References ast_aoc_decoded2str(), ast_channel_name(), ast_free, ast_str_append(), ast_str_buffer(), ast_str_create, and ast_verb.
Referenced by ast_aoc_decode(), and ast_aoc_encode().
|
static |
Definition at line 1560 of file aoc.c.
References ast_aoc_unit_entry::amount, aoc_amount_str(), aoc_billingid_str(), aoc_charge_type_str(), AST_AOC_CHARGE_CURRENCY, AST_AOC_CHARGE_UNIT, AST_AOC_CHARGING_ASSOCIATION_ID, AST_AOC_CHARGING_ASSOCIATION_NA, AST_AOC_CHARGING_ASSOCIATION_NUMBER, ast_str_append(), ast_aoc_decoded::billing_id, ast_aoc_charging_association::charge, ast_aoc_decoded::charge_type, ast_aoc_decoded::charging_association, ast_aoc_charging_association::charging_type, ast_aoc_decoded::currency_amount, ast_aoc_decoded::currency_name, ast_aoc_charging_association::id, ast_aoc_decoded::multiplier, ast_aoc_charging_association_number::number, ast_aoc_charging_association::number, ast_aoc_charging_association_number::plan, prefix, ast_aoc_unit_entry::type, ast_aoc_decoded::unit_count, ast_aoc_decoded::unit_list, ast_aoc_unit_entry::valid_amount, and ast_aoc_unit_entry::valid_type.
Referenced by ast_aoc_decoded2str().
|
static |
Definition at line 1907 of file aoc.c.
References aoc_d_to_ami(), aoc_d_type(), aoc_e_type(), aoc_s_to_ami(), aoc_s_type(), aoc_to_ami(), STASIS_MESSAGE_TYPE_DEFN(), and to_ami().
struct stasis_message_type* aoc_e_type | ( | void | ) |
Referenced by aoc_e_to_ami(), and ast_aoc_manager_event().
|
static |
Definition at line 1816 of file aoc.c.
References ao2_cleanup, ast_json_unref(), aoc_event_blob::blob, and aoc_event_blob::snapshot.
Referenced by aoc_publish_blob().
|
static |
Definition at line 1280 of file aoc.c.
References AST_AOC_MULT_HUNDRED, AST_AOC_MULT_NUM_ENTRIES, AST_AOC_MULT_ONE, AST_AOC_MULT_ONEHUNDREDTH, AST_AOC_MULT_ONETENTH, AST_AOC_MULT_ONETHOUSANDTH, AST_AOC_MULT_TEN, and AST_AOC_MULT_THOUSAND.
Referenced by aoc_amount_str(), and currency_to_json().
|
static |
Definition at line 369 of file aoc.c.
References aoc_ie_currency::amount, aoc_ie_unit::amount, AOC_IE_BILLING, AOC_IE_CHARGING_ASSOCIATION, AOC_IE_CURRENCY, AOC_IE_RATE, AOC_IE_TERMINATION_REQUEST, AOC_IE_UNIT, aoc_parse_ie_charging_rate(), ast_aoc_add_unit_entry(), AST_AOC_CHARGING_ASSOCIATION_ID, ast_log, ast_aoc_decoded::billing_id, ast_aoc_charging_association::charge, ast_aoc_decoded::charging_association, ast_aoc_charging_association::charging_type, ast_aoc_decoded::currency_amount, ast_aoc_decoded::currency_name, ast_aoc_charging_association::id, aoc_ie_billing::id, len(), LOG_ERROR, LOG_WARNING, ast_aoc_decoded::multiplier, aoc_ie_currency::multiplier, aoc_ie_currency::name, ast_aoc_decoded::termination_request, aoc_ie_unit::type, aoc_ie_unit::valid_amount, and aoc_ie_unit::valid_type.
Referenced by ast_aoc_decode().
|
static |
Definition at line 319 of file aoc.c.
References ast_aoc_duration_rate::amount, ast_aoc_volume_rate::amount, ast_aoc_flat_rate::amount, aoc_s_add_entry(), AST_AOC_RATE_TYPE_DURATION, AST_AOC_RATE_TYPE_FLAT, AST_AOC_RATE_TYPE_SPECIAL_CODE, AST_AOC_RATE_TYPE_VOLUME, ast_copy_string(), ast_strlen_zero, ast_aoc_s_entry::charged_item, ast_aoc_duration_rate::charging_type, ast_aoc_duration_rate::currency_name, ast_aoc_volume_rate::currency_name, ast_aoc_flat_rate::currency_name, ast_aoc_s_entry::duration, aoc_ie_charging_rate::entry, ast_aoc_s_entry::flat, ast_aoc_duration_rate::granularity_time, ast_aoc_duration_rate::granularity_time_scale, ast_aoc_duration_rate::multiplier, ast_aoc_volume_rate::multiplier, ast_aoc_flat_rate::multiplier, ast_aoc_s_entry::rate, ast_aoc_s_entry::rate_type, ast_aoc_s_entry::special_code, ast_aoc_duration_rate::time, ast_aoc_duration_rate::time_scale, ast_aoc_s_entry::volume, and ast_aoc_volume_rate::volume_unit.
Referenced by aoc_parse_ie().
|
static |
Definition at line 1835 of file aoc.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_bump, ao2_ref, aoc_event_blob_dtor(), ast_channel_lock, ast_channel_snapshot(), ast_channel_unlock, ast_json_is_null(), ast_json_ref(), ast_manager_get_topic(), aoc_event_blob::blob, aoc_event_blob::snapshot, stasis_message_create(), and stasis_publish().
Referenced by ast_aoc_manager_event().
|
static |
Definition at line 1186 of file aoc.c.
References AST_AOC_RATE_TYPE_DURATION, AST_AOC_RATE_TYPE_FLAT, AST_AOC_RATE_TYPE_FREE, AST_AOC_RATE_TYPE_FREE_FROM_BEGINNING, AST_AOC_RATE_TYPE_NA, AST_AOC_RATE_TYPE_SPECIAL_CODE, AST_AOC_RATE_TYPE_VOLUME, and str.
Referenced by aoc_s_event(), and s_to_json().
|
static |
Definition at line 1423 of file aoc.c.
References AST_AOC_REQUEST_D, AST_AOC_REQUEST_E, AST_AOC_REQUEST_S, ast_str_append(), and ast_aoc_decoded::request_flag.
Referenced by ast_aoc_decoded2str().
|
static |
Definition at line 743 of file aoc.c.
References ast_aoc_decoded::aoc_s_count, ast_aoc_decoded::aoc_s_entries, and ARRAY_LEN.
Referenced by aoc_parse_ie_charging_rate(), ast_aoc_s_add_rate_duration(), ast_aoc_s_add_rate_flat(), ast_aoc_s_add_rate_free(), ast_aoc_s_add_rate_na(), ast_aoc_s_add_rate_special_charge_code(), ast_aoc_s_add_rate_volume(), and ast_aoc_s_add_special_arrangement().
|
static |
Definition at line 1443 of file aoc.c.
References ast_aoc_duration_rate::amount, ast_aoc_volume_rate::amount, ast_aoc_flat_rate::amount, aoc_amount_str(), aoc_charged_item_str(), aoc_rate_type_str(), ast_aoc_decoded::aoc_s_count, ast_aoc_decoded::aoc_s_entries, aoc_time_str(), aoc_volume_unit_str(), AST_AOC_CHARGED_ITEM_NA, AST_AOC_RATE_TYPE_DURATION, AST_AOC_RATE_TYPE_FLAT, AST_AOC_RATE_TYPE_SPECIAL_CODE, AST_AOC_RATE_TYPE_VOLUME, ast_str_append(), ast_aoc_s_entry::charged_item, ast_aoc_duration_rate::charging_type, ast_aoc_duration_rate::currency_name, ast_aoc_volume_rate::currency_name, ast_aoc_flat_rate::currency_name, ast_aoc_s_entry::duration, ast_aoc_s_entry::flat, ast_aoc_duration_rate::granularity_time, ast_aoc_duration_rate::granularity_time_scale, ast_aoc_duration_rate::multiplier, ast_aoc_volume_rate::multiplier, ast_aoc_flat_rate::multiplier, prefix, ast_aoc_s_entry::rate, ast_aoc_s_entry::rate_type, ast_aoc_s_entry::special_code, ast_aoc_duration_rate::time, ast_aoc_duration_rate::time_scale, ast_aoc_s_entry::volume, and ast_aoc_volume_rate::volume_unit.
Referenced by ast_aoc_decoded2str().
|
static |
Definition at line 1897 of file aoc.c.
References aoc_to_ami().
Referenced by aoc_e_to_ami().
struct stasis_message_type* aoc_s_type | ( | void | ) |
Referenced by aoc_e_to_ami(), and ast_aoc_manager_event().
|
static |
Definition at line 1226 of file aoc.c.
References AST_AOC_TIME_SCALE_DAY, AST_AOC_TIME_SCALE_HOUR, AST_AOC_TIME_SCALE_HUNDREDTH_SECOND, AST_AOC_TIME_SCALE_MINUTE, AST_AOC_TIME_SCALE_SECOND, AST_AOC_TIME_SCALE_TEN_SECOND, AST_AOC_TIME_SCALE_TENTH_SECOND, and str.
Referenced by aoc_time_str().
|
static |
Definition at line 2018 of file aoc.c.
References ARRAY_LEN, ast_cli_unregister_multiple(), and STASIS_MESSAGE_TYPE_CLEANUP.
Referenced by ast_aoc_cli_init().
|
static |
Definition at line 1395 of file aoc.c.
References aoc_scale_str(), and ast_str_append().
Referenced by aoc_s_event().
|
static |
Definition at line 1871 of file aoc.c.
References AS_OR, ast_free, ast_manager_build_channel_state_string(), ast_manager_event_blob_create(), ast_manager_str_from_json_object(), ast_str_buffer(), ast_strlen_zero, aoc_event_blob::blob, EVENT_FLAG_AOC, NULL, aoc_event_blob::snapshot, and stasis_message_data().
Referenced by aoc_d_to_ami(), aoc_e_to_ami(), and aoc_s_to_ami().
|
static |
Definition at line 1161 of file aoc.c.
References AST_AOC_SUBTOTAL, AST_AOC_TOTAL, and str.
Referenced by aoc_d_event(), and charge_to_json().
|
static |
Definition at line 1093 of file aoc.c.
References AST_AOC_VOLUME_UNIT_MESSAGE, AST_AOC_VOLUME_UNIT_OCTET, AST_AOC_VOLUME_UNIT_SEGMENT, and str.
Referenced by aoc_s_event(), and s_to_json().
|
static |
Definition at line 1691 of file aoc.c.
References AST_AOC_CHARGING_ASSOCIATION_ID, AST_AOC_CHARGING_ASSOCIATION_NA, AST_AOC_CHARGING_ASSOCIATION_NUMBER, ast_json_null(), ast_json_pack(), AST_JSON_UTF8_VALIDATE, ast_aoc_charging_association::charge, ast_aoc_decoded::charging_association, ast_aoc_charging_association::charging_type, ast_aoc_charging_association::id, ast_aoc_charging_association_number::number, ast_aoc_charging_association::number, and ast_aoc_charging_association_number::plan.
Referenced by e_to_json().
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.
decoded | ast_aoc_decoded struct to set values on |
amount_is_present | set this if the number of units is actually present. |
amount | number of units |
type_is_present | set this if the type value is present |
type | unit type |
0 | success |
Definition at line 977 of file aoc.c.
References ast_aoc_unit_entry::amount, ARRAY_LEN, AST_AOC_REQUEST, ast_aoc_decoded::msg_type, type, ast_aoc_unit_entry::type, ast_aoc_decoded::unit_count, ast_aoc_decoded::unit_list, ast_aoc_unit_entry::valid_amount, and ast_aoc_unit_entry::valid_type.
Referenced by action_aocmessage(), aoc_parse_ie(), and AST_TEST_DEFINE().
int ast_aoc_cli_init | ( | void | ) |
enable aoc cli options
Definition at line 2026 of file aoc.c.
References aoc_shutdown(), ARRAY_LEN, ast_cli_register_multiple, ast_register_cleanup(), and STASIS_MESSAGE_TYPE_INIT.
Referenced by asterisk_daemon().
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
msg_type | AOC-D, AOC-E, or AOC Request |
charge_type | this is ignored if message type is not AOC-D or AOC-E. |
requests | flags. This defines the types of AOC requested. This field should only be set when the message type is AOC Request, the value is ignored otherwise. |
heap | allocated ast_aoc_decoded object ptr on success |
NULL | failure |
Definition at line 276 of file aoc.c.
References AST_AOC_CHARGE_UNIT, AST_AOC_D, AST_AOC_E, AST_AOC_REQUEST, ast_calloc, ast_log, ast_aoc_decoded::charge_type, LOG_WARNING, ast_aoc_decoded::msg_type, NULL, ast_aoc_decoded::request_flag, and requests.
Referenced by action_aocmessage(), and AST_TEST_DEFINE().
struct ast_aoc_decoded* ast_aoc_decode | ( | struct ast_aoc_encoded * | encoded, |
size_t | size, | ||
struct ast_channel * | chan | ||
) |
decodes an encoded aoc payload.
encoded | the encoded payload to decode. |
size | total size of encoded payload |
chan | ast channel, Optional for DEBUG output purposes |
heap | allocated ast_aoc_decoded object ptr on success |
NULL | failure |
Definition at line 449 of file aoc.c.
References aoc_debug_enabled, aoc_display_decoded_debug(), aoc_parse_ie(), AST_AOC_CHARGE_CURRENCY, AST_AOC_CHARGE_FREE, AST_AOC_CHARGE_NA, AST_AOC_CHARGE_UNIT, AST_AOC_D, AST_AOC_E, AST_AOC_ENCODED_CHARGE_CURRENCY, AST_AOC_ENCODED_CHARGE_FREE, AST_AOC_ENCODED_CHARGE_SUBTOTAL, AST_AOC_ENCODED_CHARGE_UNIT, AST_AOC_ENCODED_REQUEST_D, AST_AOC_ENCODED_REQUEST_E, AST_AOC_ENCODED_REQUEST_S, AST_AOC_ENCODED_TYPE_D, AST_AOC_ENCODED_TYPE_E, AST_AOC_ENCODED_TYPE_S, AST_AOC_REQUEST, AST_AOC_REQUEST_D, AST_AOC_REQUEST_E, AST_AOC_REQUEST_S, AST_AOC_S, AST_AOC_SUBTOTAL, ast_calloc, ast_log, ast_aoc_decoded::charge_type, ast_aoc_encoded::data, ast_aoc_encoded::datalen, ast_aoc_encoded::flags, LOG_WARNING, ast_aoc_decoded::msg_type, NULL, ast_aoc_decoded::request_flag, and ast_aoc_decoded::total_type.
Referenced by ast_aoc_test_encode_decode_match(), sip_indicate(), and wait_for_answer().
int ast_aoc_decoded2str | ( | const struct ast_aoc_decoded * | decoded, |
struct ast_str ** | msg | ||
) |
Convert decoded aoc msg to string representation.
decoded | ast_aoc_decoded struct to convert to string |
msg | dynamic heap allocated ast_str object to store string representation in |
0 | success |
-1 | failure |
Definition at line 1960 of file aoc.c.
References aoc_d_event(), aoc_e_event(), aoc_request_event(), aoc_s_event(), AST_AOC_D, AST_AOC_E, AST_AOC_REQUEST, AST_AOC_S, ast_str_append(), and ast_aoc_decoded::msg_type.
Referenced by aoc_display_decoded_debug(), and AST_TEST_DEFINE().
void* ast_aoc_destroy_decoded | ( | struct ast_aoc_decoded * | decoded | ) |
free an ast_aoc_decoded object
Definition at line 307 of file aoc.c.
References ast_free, and NULL.
Referenced by action_aocmessage(), ast_aoc_test_encode_decode_match(), AST_TEST_DEFINE(), chanlist_free(), hangupcalls(), sip_indicate(), and wait_for_answer().
void* ast_aoc_destroy_encoded | ( | struct ast_aoc_encoded * | encoded | ) |
free an ast_aoc_encoded object
Definition at line 313 of file aoc.c.
References ast_free, and NULL.
Referenced by action_aocmessage(), ast_aoc_test_encode_decode_match(), and wait_for_answer().
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
decoded | the decoded struct to be encoded |
out_size | output parameter representing size of encoded data |
chan | ast channel, Optional for DEBUG output purposes |
pointer | to encoded data |
NULL | failure |
Definition at line 650 of file aoc.c.
References aoc_create_ie_data(), aoc_debug_enabled, aoc_display_decoded_debug(), AST_AOC_CHARGE_CURRENCY, AST_AOC_CHARGE_FREE, AST_AOC_CHARGE_NA, AST_AOC_CHARGE_UNIT, AST_AOC_D, AST_AOC_E, AST_AOC_ENCODE_VERSION, AST_AOC_ENCODED_CHARGE_CURRENCY, AST_AOC_ENCODED_CHARGE_FREE, AST_AOC_ENCODED_CHARGE_NA, AST_AOC_ENCODED_CHARGE_SUBTOTAL, AST_AOC_ENCODED_CHARGE_UNIT, AST_AOC_ENCODED_REQUEST_D, AST_AOC_ENCODED_REQUEST_E, AST_AOC_ENCODED_REQUEST_S, AST_AOC_ENCODED_TYPE_D, AST_AOC_ENCODED_TYPE_E, AST_AOC_ENCODED_TYPE_REQUEST, AST_AOC_ENCODED_TYPE_S, AST_AOC_REQUEST, AST_AOC_REQUEST_D, AST_AOC_REQUEST_E, AST_AOC_REQUEST_S, AST_AOC_S, AST_AOC_SUBTOTAL, ast_calloc, ast_log, ast_aoc_decoded::charge_type, ast_aoc_encoded::data, ast_aoc_encoded::datalen, ast_aoc_encoded::flags, LOG_WARNING, ast_aoc_decoded::msg_type, NULL, ast_aoc_decoded::request_flag, ast_aoc_decoded::total_type, and ast_aoc_encoded::version.
Referenced by action_aocmessage(), ast_aoc_test_encode_decode_match(), and wait_for_answer().
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
Definition at line 1051 of file aoc.c.
References ast_aoc_decoded::charging_association.
Referenced by AST_TEST_DEFINE().
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
Definition at line 1035 of file aoc.c.
References ast_aoc_decoded::billing_id.
Referenced by AST_TEST_DEFINE().
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
Definition at line 897 of file aoc.c.
References ast_aoc_decoded::charge_type.
Referenced by AST_TEST_DEFINE(), and transmit_info_with_aoc().
unsigned int ast_aoc_get_currency_amount | ( | struct ast_aoc_decoded * | decoded | ) |
get the currency amount for AOC-D and AOC-E messages
Definition at line 940 of file aoc.c.
References ast_aoc_decoded::currency_amount.
Referenced by AST_TEST_DEFINE(), and transmit_info_with_aoc().
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
Definition at line 945 of file aoc.c.
References ast_aoc_decoded::multiplier.
Referenced by AST_TEST_DEFINE().
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
Definition at line 950 of file aoc.c.
References AST_AOC_MULT_HUNDRED, AST_AOC_MULT_ONE, AST_AOC_MULT_ONEHUNDREDTH, AST_AOC_MULT_ONETENTH, AST_AOC_MULT_ONETHOUSANDTH, AST_AOC_MULT_TEN, AST_AOC_MULT_THOUSAND, and ast_aoc_decoded::multiplier.
Referenced by transmit_info_with_aoc().
const char* ast_aoc_get_currency_name | ( | struct ast_aoc_decoded * | decoded | ) |
get the currency name for AOC-D and AOC-E messages
Definition at line 972 of file aoc.c.
References ast_aoc_decoded::currency_name.
Referenced by AST_TEST_DEFINE(), and transmit_info_with_aoc().
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
Definition at line 892 of file aoc.c.
References ast_aoc_decoded::msg_type.
Referenced by AST_TEST_DEFINE(), sip_indicate(), transmit_info_with_aoc(), and wait_for_answer().
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
Definition at line 902 of file aoc.c.
References ast_aoc_decoded::request_flag.
Referenced by AST_TEST_DEFINE().
int ast_aoc_get_termination_request | ( | struct ast_aoc_decoded * | decoded | ) |
get whether or not the AST_AOC_REQUEST message as a termination request.
decoded | ast_aoc_decoded struct to get values on |
0 | not a termination request |
1 | is a termination request |
Definition at line 1079 of file aoc.c.
References ast_aoc_decoded::termination_request.
Referenced by AST_TEST_DEFINE(), and sip_indicate().
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
Definition at line 914 of file aoc.c.
References ast_aoc_decoded::total_type.
Referenced by AST_TEST_DEFINE().
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
Definition at line 1019 of file aoc.c.
References ast_aoc_decoded::unit_count.
Referenced by AST_TEST_DEFINE().
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.
Definition at line 1010 of file aoc.c.
References NULL, ast_aoc_decoded::unit_count, and ast_aoc_decoded::unit_list.
Referenced by AST_TEST_DEFINE(), and transmit_info_with_aoc().
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
Definition at line 1928 of file aoc.c.
References aoc_d_type(), aoc_e_type(), aoc_publish_blob(), aoc_s_type(), AST_AOC_D, AST_AOC_E, AST_AOC_S, ast_json_unref(), d_to_json(), e_to_json(), ast_aoc_decoded::msg_type, and s_to_json().
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.
decoded | aoc decoded object to add entry to |
charged_item | ast_aoc_s_charged_item |
amount | currency amount |
multiplier | currency multiplier |
currency_name | truncated after 10 characters |
time | |
time_scale | from ast_aoc_time_scale enum |
granularity_time | (optional, set to 0 if not present); |
granularity_time_scale | (optional, set to 0 if not present); |
step_function | set to 1 if this is to use a step function, 0 if continuious |
0 | success |
-1 | failure |
Definition at line 770 of file aoc.c.
References ast_aoc_duration_rate::amount, aoc_s_add_entry(), AST_AOC_RATE_TYPE_DURATION, ast_copy_string(), ast_strlen_zero, ast_aoc_s_entry::charged_item, ast_aoc_duration_rate::charging_type, ast_aoc_duration_rate::currency_name, ast_aoc_s_entry::duration, ast_aoc_duration_rate::granularity_time, ast_aoc_duration_rate::granularity_time_scale, ast_aoc_duration_rate::multiplier, ast_aoc_s_entry::rate, ast_aoc_s_entry::rate_type, ast_aoc_duration_rate::time, and ast_aoc_duration_rate::time_scale.
Referenced by AST_TEST_DEFINE().
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.
decoded | aoc decoded object to add entry to |
charged_item | ast_aoc_s_charged_item |
amount | currency amount |
multiplier | currency multiplier |
currency_name | truncated after 10 characters |
0 | success |
-1 | failure |
Definition at line 801 of file aoc.c.
References ast_aoc_flat_rate::amount, aoc_s_add_entry(), AST_AOC_RATE_TYPE_FLAT, ast_copy_string(), ast_strlen_zero, ast_aoc_s_entry::charged_item, ast_aoc_flat_rate::currency_name, ast_aoc_s_entry::flat, ast_aoc_flat_rate::multiplier, ast_aoc_s_entry::rate, and ast_aoc_s_entry::rate_type.
Referenced by AST_TEST_DEFINE().
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.
decoded | aoc decoded object to add entry to |
charged_item | ast_aoc_s_charged_item |
from_beginning | TRUE if the rate is free from beginning. |
0 | success |
-1 | failure |
Definition at line 857 of file aoc.c.
References aoc_s_add_entry(), AST_AOC_RATE_TYPE_FREE, AST_AOC_RATE_TYPE_FREE_FROM_BEGINNING, ast_aoc_s_entry::charged_item, and ast_aoc_s_entry::rate_type.
Referenced by AST_TEST_DEFINE().
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.
decoded | aoc decoded object to add entry to |
charged_item | ast_aoc_s_charged_item |
0 | success |
-1 | failure |
Definition at line 869 of file aoc.c.
References aoc_s_add_entry(), AST_AOC_RATE_TYPE_NA, ast_aoc_s_entry::charged_item, and ast_aoc_s_entry::rate_type.
Referenced by AST_TEST_DEFINE().
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.
decoded | aoc decoded object to add entry to |
charged_item | ast_aoc_s_charged_item |
code | special charging code |
0 | success |
-1 | failure |
Definition at line 844 of file aoc.c.
References aoc_s_add_entry(), AST_AOC_RATE_TYPE_SPECIAL_CODE, ast_aoc_s_entry::charged_item, ast_aoc_s_entry::rate, ast_aoc_s_entry::rate_type, and ast_aoc_s_entry::special_code.
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.
decoded | aoc decoded object to add entry to |
charged_item | ast_aoc_s_charged_item |
volume_unit | from ast_aoc_volume_unit enum |
amount | currency amount |
multiplier | currency multiplier |
currency_name | truncated after 10 characters |
0 | success |
-1 | failure |
Definition at line 822 of file aoc.c.
References ast_aoc_volume_rate::amount, aoc_s_add_entry(), AST_AOC_RATE_TYPE_VOLUME, ast_copy_string(), ast_strlen_zero, ast_aoc_s_entry::charged_item, ast_aoc_volume_rate::currency_name, ast_aoc_volume_rate::multiplier, ast_aoc_s_entry::rate, ast_aoc_s_entry::rate_type, ast_aoc_s_entry::volume, and ast_aoc_volume_rate::volume_unit.
Referenced by AST_TEST_DEFINE().
int ast_aoc_s_add_special_arrangement | ( | struct ast_aoc_decoded * | decoded, |
unsigned int | code | ||
) |
Add AOC-S special arrangement entry.
decoded | aoc decoded object to add entry to |
code | special arrangement code |
0 | success |
-1 | failure |
Definition at line 880 of file aoc.c.
References aoc_s_add_entry(), AST_AOC_CHARGED_ITEM_SPECIAL_ARRANGEMENT, AST_AOC_RATE_TYPE_SPECIAL_CODE, ast_aoc_s_entry::charged_item, ast_aoc_s_entry::rate, ast_aoc_s_entry::rate_type, and ast_aoc_s_entry::special_code.
unsigned int ast_aoc_s_get_count | ( | struct ast_aoc_decoded * | decoded | ) |
get the number rates associated with an AOC-S message
Definition at line 756 of file aoc.c.
References ast_aoc_decoded::aoc_s_count.
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.
Definition at line 761 of file aoc.c.
References ast_aoc_decoded::aoc_s_count, ast_aoc_decoded::aoc_s_entries, and NULL.
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
decoded | ast_aoc_decoded struct to set values on |
id | charging association identifier |
0 | success |
Definition at line 1040 of file aoc.c.
References AST_AOC_CHARGING_ASSOCIATION_ID, AST_AOC_E, ast_aoc_charging_association::charge, ast_aoc_decoded::charging_association, ast_aoc_charging_association::charging_type, ast_aoc_charging_association::id, id, and ast_aoc_decoded::msg_type.
Referenced by action_aocmessage(), and AST_TEST_DEFINE().
int ast_aoc_set_association_number | ( | struct ast_aoc_decoded * | decoded, |
const char * | num, | ||
uint8_t | plan | ||
) |
set the charging accociation number for an AOC-E message
decoded | ast_aoc_decoded struct to set values on |
num | charging association number |
plan | charging association number plan and type-of-number fields |
0 | success |
Definition at line 1056 of file aoc.c.
References AST_AOC_CHARGING_ASSOCIATION_NUMBER, AST_AOC_E, ast_copy_string(), ast_strlen_zero, ast_aoc_charging_association::charge, ast_aoc_decoded::charging_association, ast_aoc_charging_association::charging_type, ast_aoc_decoded::msg_type, ast_aoc_charging_association_number::number, ast_aoc_charging_association::number, and ast_aoc_charging_association_number::plan.
Referenced by action_aocmessage(), and AST_TEST_DEFINE().
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
decoded | ast_aoc_decoded struct to set values on |
id | billing id |
0 | success |
Definition at line 1024 of file aoc.c.
References AST_AOC_BILLING_NA, AST_AOC_BILLING_NUM_ENTRIES, ast_aoc_decoded::billing_id, and id.
Referenced by action_aocmessage(), and AST_TEST_DEFINE().
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.
decoded | ast_aoc_decoded struct to set values on |
amount | currency amount REQUIRED |
multiplier | currency multiplier REQUIRED, 0 or undefined value defaults to AST_AOC_MULT_ONE. |
name | currency name OPTIONAL |
0 | success |
Definition at line 919 of file aoc.c.
References AST_AOC_MULT_NUM_ENTRIES, AST_AOC_MULT_ONE, ast_copy_string(), ast_strlen_zero, ast_aoc_decoded::currency_amount, ast_aoc_decoded::currency_name, and ast_aoc_decoded::multiplier.
Referenced by action_aocmessage(), and AST_TEST_DEFINE().
int ast_aoc_set_termination_request | ( | struct ast_aoc_decoded * | decoded | ) |
Mark the AST_AOC_REQUEST message as a termination request.
decoded | ast_aoc_decoded struct to set values on |
0 | success |
-1 | failure |
Definition at line 1069 of file aoc.c.
References AST_AOC_REQUEST, ast_aoc_decoded::msg_type, and ast_aoc_decoded::termination_request.
Referenced by AST_TEST_DEFINE().
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.
decoded | ast_aoc_decoded struct to set values on |
type | total type: TOTAL or SUBTOTAL |
0 | success |
Definition at line 907 of file aoc.c.
References ast_aoc_decoded::total_type, and type.
Referenced by action_aocmessage(), and AST_TEST_DEFINE().
int ast_aoc_test_encode_decode_match | ( | struct ast_aoc_decoded * | decoded | ) |
test aoc encode decode routines.
Definition at line 1330 of file aoc.c.
References ast_aoc_decode(), ast_aoc_destroy_decoded(), ast_aoc_destroy_encoded(), ast_aoc_encode(), ast_free, and NULL.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 1664 of file aoc.c.
References aoc_billingid_str(), aoc_charge_type_str(), aoc_type_of_totaling_str(), AST_AOC_CHARGE_CURRENCY, AST_AOC_CHARGE_UNIT, ast_json_pack(), ast_aoc_decoded::billing_id, ast_aoc_decoded::charge_type, ast_aoc_decoded::currency_amount, ast_aoc_decoded::currency_name, currency_to_json(), ast_aoc_decoded::multiplier, ast_aoc_decoded::total_type, and units_to_json().
Referenced by d_to_json(), and e_to_json().
|
static |
Definition at line 1655 of file aoc.c.
References aoc_multiplier_str(), ast_json_pack(), and AST_JSON_UTF8_VALIDATE.
Referenced by charge_to_json(), and s_to_json().
|
static |
Definition at line 1797 of file aoc.c.
References ast_json_pack(), and charge_to_json().
Referenced by ast_aoc_manager_event().
|
static |
Definition at line 1802 of file aoc.c.
References association_to_json(), ast_json_pack(), and charge_to_json().
Referenced by ast_aoc_manager_event().
|
static |
Definition at line 1706 of file aoc.c.
References ast_aoc_duration_rate::amount, ast_aoc_volume_rate::amount, ast_aoc_flat_rate::amount, aoc_charged_item_str(), aoc_rate_type_str(), ast_aoc_decoded::aoc_s_count, ast_aoc_decoded::aoc_s_entries, aoc_volume_unit_str(), AST_AOC_CHARGED_ITEM_NA, AST_AOC_RATE_TYPE_DURATION, AST_AOC_RATE_TYPE_FLAT, AST_AOC_RATE_TYPE_SPECIAL_CODE, AST_AOC_RATE_TYPE_VOLUME, ast_json_array_append(), ast_json_array_create(), ast_json_null(), ast_json_pack(), ast_aoc_s_entry::charged_item, ast_aoc_duration_rate::charging_type, ast_aoc_duration_rate::currency_name, ast_aoc_volume_rate::currency_name, ast_aoc_flat_rate::currency_name, currency_to_json(), ast_aoc_s_entry::duration, ast_aoc_s_entry::flat, ast_aoc_duration_rate::granularity_time, ast_aoc_duration_rate::granularity_time_scale, ast_aoc_duration_rate::multiplier, ast_aoc_volume_rate::multiplier, ast_aoc_flat_rate::multiplier, NULL, ast_aoc_s_entry::rate, ast_aoc_s_entry::rate_type, ast_aoc_s_entry::special_code, ast_aoc_duration_rate::time, ast_aoc_duration_rate::time_scale, type, ast_aoc_s_entry::volume, and ast_aoc_volume_rate::volume_unit.
Referenced by ast_aoc_manager_event().
STASIS_MESSAGE_TYPE_DEFN | ( | aoc_s_type | , |
. | to_ami = aoc_s_to_ami |
||
) |
Referenced by aoc_e_to_ami().
STASIS_MESSAGE_TYPE_DEFN | ( | aoc_d_type | , |
. | to_ami = aoc_d_to_ami |
||
) |
STASIS_MESSAGE_TYPE_DEFN | ( | aoc_e_type | , |
. | to_ami = aoc_e_to_ami |
||
) |
|
static |
Definition at line 1623 of file aoc.c.
References ast_aoc_unit_entry::amount, ast_json_array_append(), ast_json_array_create(), ast_json_null(), ast_json_object_create(), ast_json_object_set(), ast_json_stringf(), ast_aoc_unit_entry::type, ast_aoc_decoded::unit_count, ast_aoc_decoded::unit_list, ast_aoc_unit_entry::valid_amount, and ast_aoc_unit_entry::valid_type.
Referenced by charge_to_json().
|
static |
|
static |
Definition at line 192 of file aoc.c.
Referenced by aoc_cli_debug_enable(), ast_aoc_decode(), and ast_aoc_encode().