49 info->name =
"aoc_event_test";
50 info->category =
"/main/aoc/";
51 info->summary =
"Advice of Charge event generation test";
53 "Creates AOC messages, verify event string matches expected results";
60 goto cleanup_aoc_event_test;
68 goto cleanup_aoc_event_test;
79 goto cleanup_aoc_event_test;
85 goto cleanup_aoc_event_test;
90 "BillingID: CreditCard\r\n"
91 "TypeOfCharging: SubTotal\r\n"
93 "Currency/Amount/Cost: 100\r\n"
94 "Currency/Amount/Multiplier: 1\r\n",
99 goto cleanup_aoc_event_test;
110 goto cleanup_aoc_event_test;
152 goto cleanup_aoc_event_test;
159 "Rate(0)/Chargeable: BasicCommunication\r\n"
160 "Rate(0)/Type: Flat\r\n"
161 "Rate(0)/Flat/Currency: pineapple\r\n"
162 "Rate(0)/Flat/Amount/Cost: 123\r\n"
163 "Rate(0)/Flat/Amount/Multiplier: 10\r\n"
164 "Rate(1)/Chargeable: CallAttempt\r\n"
165 "Rate(1)/Type: Volume\r\n"
166 "Rate(1)/Volume/Currency: oranges\r\n"
167 "Rate(1)/Volume/Amount/Cost: 937\r\n"
168 "Rate(1)/Volume/Amount/Multiplier: 1/100\r\n"
169 "Rate(1)/Volume/Unit: Segment\r\n"
170 "Rate(2)/Chargeable: CallAttempt\r\n"
171 "Rate(2)/Type: Duration\r\n"
172 "Rate(2)/Duration/Currency: bananas\r\n"
173 "Rate(2)/Duration/Amount/Cost: 937\r\n"
174 "Rate(2)/Duration/Amount/Multiplier: 1/1000\r\n"
175 "Rate(2)/Duration/ChargingType: StepFunction\r\n"
176 "Rate(2)/Duration/Time/Length: 848\r\n"
177 "Rate(2)/Duration/Time/Scale: OneTenthSecond\r\n"
178 "Rate(2)/Duration/Granularity/Length: 949\r\n"
179 "Rate(2)/Duration/Granularity/Scale: Hour\r\n"
180 "Rate(3)/Chargeable: UserUserInfo\r\n"
181 "Rate(3)/Type: Duration\r\n"
182 "Rate(3)/Duration/Currency: bananas\r\n"
183 "Rate(3)/Duration/Amount/Cost: 937\r\n"
184 "Rate(3)/Duration/Amount/Multiplier: 1000\r\n"
185 "Rate(3)/Duration/ChargingType: ContinuousCharging\r\n"
186 "Rate(3)/Duration/Time/Length: 1111\r\n"
187 "Rate(3)/Duration/Time/Scale: Second\r\n"
188 "Rate(3)/Duration/Granularity/Length: 2222\r\n"
189 "Rate(3)/Duration/Granularity/Scale: Day\r\n",
194 goto cleanup_aoc_event_test;
204 goto cleanup_aoc_event_test;
213 goto cleanup_aoc_event_test;
219 goto cleanup_aoc_event_test;
225 "BillingID: NotAvailable\r\n"
226 "Units/NumberItems: 3\r\n"
227 "Units/Item(0)/NumberOf: 111\r\n"
228 "Units/Item(0)/TypeOf: 1\r\n"
229 "Units/Item(1)/NumberOf: 3333\r\n"
230 "Units/Item(2)/TypeOf: 4\r\n",
235 goto cleanup_aoc_event_test;
242 goto cleanup_aoc_event_test;
249 goto cleanup_aoc_event_test;
254 "ChargingAssociation/Number: 555-555-5555\r\n"
255 "ChargingAssociation/Number/Plan: 16\r\n"
257 "BillingID: NotAvailable\r\n"
258 "Units/NumberItems: 3\r\n"
259 "Units/Item(0)/NumberOf: 111\r\n"
260 "Units/Item(0)/TypeOf: 1\r\n"
261 "Units/Item(1)/NumberOf: 3333\r\n"
262 "Units/Item(2)/TypeOf: 4\r\n",
267 goto cleanup_aoc_event_test;
274 goto cleanup_aoc_event_test;
281 goto cleanup_aoc_event_test;
286 "ChargingAssociation/ID: 2222\r\n"
288 "BillingID: NotAvailable\r\n"
289 "Units/NumberItems: 3\r\n"
290 "Units/Item(0)/NumberOf: 111\r\n"
291 "Units/Item(0)/TypeOf: 1\r\n"
292 "Units/Item(1)/NumberOf: 3333\r\n"
293 "Units/Item(2)/TypeOf: 4\r\n",
298 goto cleanup_aoc_event_test;
302cleanup_aoc_event_test:
316 info->name =
"aoc_encode_decode_test";
317 info->category =
"/main/aoc/";
318 info->summary =
"Advice of Charge encode and decode test";
320 "This tests the Advice of Charge encode and decode routines.";
334 goto cleanup_aoc_test;
343 goto cleanup_aoc_test;
357 goto cleanup_aoc_test;
370 goto cleanup_aoc_test;
377 goto cleanup_aoc_test;
390 goto cleanup_aoc_test;
401 goto cleanup_aoc_test;
408 for (i = 0; i < 3; i++) {
418 goto cleanup_aoc_test;
424 goto cleanup_aoc_test;
435 goto cleanup_aoc_test;
446 goto cleanup_aoc_test;
477 goto cleanup_aoc_test;
480 for (i = 0; i <
ARRAY_LEN(billid); i++) {
486 goto cleanup_aoc_test;
494 goto cleanup_aoc_test;
520 goto cleanup_aoc_test;
527 goto cleanup_aoc_test;
543 goto cleanup_aoc_test;
550 goto cleanup_aoc_test;
561 goto cleanup_aoc_test;
567 goto cleanup_aoc_test;
573 goto cleanup_aoc_test;
584 goto cleanup_aoc_test;
589 goto cleanup_aoc_test;
601 goto cleanup_aoc_test;
606 goto cleanup_aoc_test;
617 goto cleanup_aoc_test;
662 goto cleanup_aoc_test;
Generic Advice of Charge encode and decode routines.
int ast_aoc_decoded2str(const struct ast_aoc_decoded *decoded, struct ast_str **msg)
Convert decoded aoc msg to string representation.
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_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.
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
const char * ast_aoc_get_currency_name(struct ast_aoc_decoded *decoded)
get the currency name for AOC-D and AOC-E messages
@ AST_AOC_CHARGED_ITEM_BASIC_COMMUNICATION
@ AST_AOC_CHARGED_ITEM_SPECIAL_ARRANGEMENT
@ AST_AOC_CHARGED_ITEM_USER_USER_INFO
@ AST_AOC_CHARGED_ITEM_CALL_SETUP
@ AST_AOC_CHARGED_ITEM_SUPPLEMENTARY_SERVICE
@ AST_AOC_CHARGED_ITEM_CALL_ATTEMPT
@ AST_AOC_CHARGE_CURRENCY
@ AST_AOC_TIME_SCALE_TENTH_SECOND
@ AST_AOC_TIME_SCALE_SECOND
@ AST_AOC_TIME_SCALE_HOUR
@ AST_AOC_TIME_SCALE_HUNDREDTH_SECOND
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
@ AST_AOC_VOLUME_UNIT_SEGMENT
int ast_aoc_test_encode_decode_match(struct ast_aoc_decoded *decoded)
test aoc encode decode routines.
int ast_aoc_get_termination_request(struct ast_aoc_decoded *decoded)
get whether or not the AST_AOC_REQUEST message as a termination request.
@ AST_AOC_MULT_ONEHUNDREDTH
@ AST_AOC_MULT_ONETHOUSANDTH
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
void * ast_aoc_destroy_decoded(struct ast_aoc_decoded *decoded)
free an ast_aoc_decoded object
@ AST_AOC_CHARGING_ASSOCIATION_ID
@ AST_AOC_CHARGING_ASSOCIATION_NUMBER
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
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.
@ AST_AOC_BILLING_CALL_FWD_BUSY
@ AST_AOC_BILLING_CALL_FWD_NO_REPLY
@ AST_AOC_BILLING_CALL_DEFLECTION
@ AST_AOC_BILLING_CREDIT_CARD
@ AST_AOC_BILLING_CALL_TRANSFER
@ AST_AOC_BILLING_CALL_FWD_UNCONDITIONAL
@ AST_AOC_BILLING_REVERSE_CHARGE
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 struct ast_aoc_unit_entry * ast_aoc_get_unit_info(struct ast_aoc_decoded *decoded, unsigned int entry_number)
get a specific unit entry.
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_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_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.
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
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.
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.
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.
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
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
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
int ast_aoc_set_termination_request(struct ast_aoc_decoded *decoded)
Mark the AST_AOC_REQUEST message as a termination request.
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
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.
unsigned int ast_aoc_get_currency_amount(struct ast_aoc_decoded *decoded)
get the currency amount for AOC-D and AOC-E messages
Asterisk main include file. File version handling, generic pbx functions.
static int request(void *obj)
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
union ast_aoc_charging_association::@183 charge
struct ast_aoc_charging_association_number number
Support for dynamic strings.
#define AST_TEST_REGISTER(cb)
#define ast_test_status_update(a, b, c...)
#define AST_TEST_UNREGISTER(cb)
AST_TEST_DEFINE(aoc_event_generation_test)
static int load_module(void)
static int unload_module(void)