47 const char *remote_string,
const char *pref_string,
int is_outgoing,
const char *expected_string,
54 const char *joint_string;
60 ast_test_status_update(test,
"Testing local: (%s), remote: (%s), pref: (%-12s), outgoing: (%s), expected: (%s) expected result: (%s)\n",
61 local_string, remote_string, pref_string, is_outgoing ?
"yes" :
"no ", expected_string,
64 ast_test_validate(test, local !=
NULL && remote !=
NULL && joint !=
NULL);
69 expected_result ==
AST_TEST_FAIL ?
"E" :
"Une", local_string);
75 expected_result ==
AST_TEST_FAIL ?
"E" :
"Une", remote_string);
81 ast_test_status_update(test,
" %sxpected Failure: Invalid preference string incoming/outgoing combination.\n",
95 for(i = 0; i <= strlen(stripped_joint); i++) {
96 if(stripped_joint[i] ==
'|') {
97 stripped_joint[i] =
',';
101 if (!joint_string || strcmp(stripped_joint, expected_string) != 0) {
103 expected_result ==
AST_TEST_FAIL ?
"E" :
"Une", expected_string, stripped_joint);
110 #define RUN_CREATE_JOINT(local, remote, pref, outgoing, expected, result) \ 112 if (test_create_joint(test, local, remote, pref, outgoing, expected, result) != AST_TEST_PASS) { \ 123 info->name = __func__;
124 info->category =
"/res/res_pjsip_session/caps/";
125 info->summary =
"Test res_pjsip_session_caps";
126 info->description =
"Test res_pjsip_session_caps";
135 RUN_CREATE_JOINT(
"ulaw,alaw,g722",
"g722,alaw,g729",
"local", 0,
"alaw,g722",
AST_TEST_PASS);
138 RUN_CREATE_JOINT(
"ulaw,alaw,g722",
"g722,alaw,g729",
"remote", 0,
"g722,alaw",
AST_TEST_PASS);
148 RUN_CREATE_JOINT(
"ulaw,alaw,g722",
"g722,g729,alaw",
"local", 1,
"alaw,g722",
AST_TEST_PASS);
150 RUN_CREATE_JOINT(
"ulaw,alaw,g722",
"g722,g729,alaw",
"local_merge", 1,
"ulaw,alaw,g722",
AST_TEST_PASS);
151 RUN_CREATE_JOINT(
"ulaw,alaw,g722",
"g722,g729,alaw",
"remote", 1,
"g722,alaw",
AST_TEST_PASS);
153 RUN_CREATE_JOINT(
"ulaw,alaw,g722",
"g722,g729,alaw",
"remote_merge", 1,
"g722,alaw,ulaw",
AST_TEST_PASS);
175 .requires =
"res_pjsip_session",
int ast_sip_call_codec_str_to_pref(struct ast_flags *pref, const char *pref_str, int is_outgoing)
Convert a call codec preference string to preference flags.
Asterisk main include file. File version handling, generic pbx functions.
AST_TEST_DEFINE(low_level)
static int unload_module(void)
#define AST_TEST_REGISTER(cb)
#define ast_str_alloca(init_len)
#define RUN_CREATE_JOINT(local, remote, pref, outgoing, expected, result)
char * ast_str_truncate(struct ast_str *buf, ssize_t len)
Truncates the enclosed string to the given length.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_test_status_update(a, b, c...)
static enum ast_test_result_state test_create_joint(struct ast_test *test, const char *local_string, const char *remote_string, const char *pref_string, int is_outgoing, const char *expected_string, enum ast_test_result_state expected_result)
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
#define AST_TEST_UNREGISTER(cb)
static int load_module(void)
Structure used to handle boolean flags.
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
struct ast_format_cap * ast_sip_create_joint_call_cap(const struct ast_format_cap *remote, struct ast_format_cap *local, enum ast_media_type media_type, struct ast_flags codec_pref)
Create joint capabilities.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.