test_res_pjsip_session_caps: Create unit test

This unit test runs through combinations of...
	* Local codecs
	* Remote Codecs
	* Codec Preference
	* Incoming/Outgoing

A few new APIs were created to make it easier to test
the functionality but didn't result in any actual
functional change.

ASTERISK_28777

Change-Id: Ic8957c43e7ceeab0e9272af60ea53f056164f164
This commit is contained in:
George Joseph
2020-03-25 11:51:32 -06:00
parent 2ee455958e
commit 7ba6d43083
5 changed files with 215 additions and 13 deletions

View File

@@ -1128,19 +1128,8 @@ static int call_offer_pref_handler(const struct aco_option *opt,
struct ast_flags pref = { 0, };
int outgoing = strcmp(var->name, "outgoing_call_offer_pref") == 0;
if (strcmp(var->value, "local") == 0) {
ast_set_flag(&pref, AST_SIP_CALL_CODEC_PREF_LOCAL | AST_SIP_CALL_CODEC_PREF_INTERSECT | AST_SIP_CALL_CODEC_PREF_ALL);
} else if (outgoing && strcmp(var->value, "local_merge") == 0) {
ast_set_flag(&pref, AST_SIP_CALL_CODEC_PREF_LOCAL | AST_SIP_CALL_CODEC_PREF_UNION | AST_SIP_CALL_CODEC_PREF_ALL);
} else if (strcmp(var->value, "local_first") == 0) {
ast_set_flag(&pref, AST_SIP_CALL_CODEC_PREF_LOCAL | AST_SIP_CALL_CODEC_PREF_INTERSECT | AST_SIP_CALL_CODEC_PREF_FIRST);
} else if (strcmp(var->value, "remote") == 0) {
ast_set_flag(&pref, AST_SIP_CALL_CODEC_PREF_REMOTE | AST_SIP_CALL_CODEC_PREF_INTERSECT | AST_SIP_CALL_CODEC_PREF_ALL);
} else if (outgoing && strcmp(var->value, "remote_merge") == 0) {
ast_set_flag(&pref, AST_SIP_CALL_CODEC_PREF_REMOTE | AST_SIP_CALL_CODEC_PREF_UNION | AST_SIP_CALL_CODEC_PREF_ALL);
} else if (strcmp(var->value, "remote_first") == 0) {
ast_set_flag(&pref, AST_SIP_CALL_CODEC_PREF_REMOTE | AST_SIP_CALL_CODEC_PREF_UNION | AST_SIP_CALL_CODEC_PREF_FIRST);
} else {
int res = ast_sip_call_codec_str_to_pref(&pref, var->value, outgoing);
if (res != 0) {
return -1;
}