<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14026">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">test_res_pjsip_session_caps: Create unit test<br><br>This unit test runs through combinations of...<br> * Local codecs<br> * Remote Codecs<br> * Codec Preference<br> * Incoming/Outgoing<br><br>A few new APIs were created to make it easier to test<br>the functionality but didn't result in any actual<br>functional change.<br><br>ASTERISK_28777<br><br>Change-Id: Ic8957c43e7ceeab0e9272af60ea53f056164f164<br>---<br>M include/asterisk/res_pjsip.h<br>M res/res_pjsip.c<br>M res/res_pjsip/pjsip_configuration.c<br>M res/res_pjsip_session.exports.in<br>A tests/test_res_pjsip_session_caps.c<br>5 files changed, 215 insertions(+), 13 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/26/14026/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h</span><br><span>index 3699725..fb4d73c 100644</span><br><span>--- a/include/asterisk/res_pjsip.h</span><br><span>+++ b/include/asterisk/res_pjsip.h</span><br><span>@@ -3255,6 +3255,19 @@</span><br><span> const char *ast_sip_call_codec_pref_to_str(struct ast_flags pref);</span><br><span> </span><br><span> /*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Convert a call codec preference string to preference flags</span><br><span style="color: hsl(120, 100%, 40%);">+ * \since 18.0.0</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param pref A pointer to an ast_flags structure to receive the preference flags</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param pref_str The call codec preference setting string</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param is_outgoing Is for outgoing calls?</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \retval 0 The string was parsed successfully</span><br><span style="color: hsl(120, 100%, 40%);">+ * \retval -1 The string option was invalid</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+int ast_sip_call_codec_str_to_pref(struct ast_flags *pref, const char *pref_str, int is_outgoing);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span> * \brief Transport shutdown monitor callback.</span><br><span> * \since 13.18.0</span><br><span> *</span><br><span>diff --git a/res/res_pjsip.c b/res/res_pjsip.c</span><br><span>index 0887498..0b578ec 100644</span><br><span>--- a/res/res_pjsip.c</span><br><span>+++ b/res/res_pjsip.c</span><br><span>@@ -5117,6 +5117,29 @@</span><br><span> return value;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+int ast_sip_call_codec_str_to_pref(struct ast_flags *pref, const char *pref_str, int is_outgoing)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ pref->flags = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (strcmp(pref_str, "local") == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_set_flag(pref, AST_SIP_CALL_CODEC_PREF_LOCAL | AST_SIP_CALL_CODEC_PREF_INTERSECT | AST_SIP_CALL_CODEC_PREF_ALL);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (is_outgoing && strcmp(pref_str, "local_merge") == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_set_flag(pref, AST_SIP_CALL_CODEC_PREF_LOCAL | AST_SIP_CALL_CODEC_PREF_UNION | AST_SIP_CALL_CODEC_PREF_ALL);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (strcmp(pref_str, "local_first") == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_set_flag(pref, AST_SIP_CALL_CODEC_PREF_LOCAL | AST_SIP_CALL_CODEC_PREF_INTERSECT | AST_SIP_CALL_CODEC_PREF_FIRST);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (strcmp(pref_str, "remote") == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_set_flag(pref, AST_SIP_CALL_CODEC_PREF_REMOTE | AST_SIP_CALL_CODEC_PREF_INTERSECT | AST_SIP_CALL_CODEC_PREF_ALL);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (is_outgoing && strcmp(pref_str, "remote_merge") == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_set_flag(pref, AST_SIP_CALL_CODEC_PREF_REMOTE | AST_SIP_CALL_CODEC_PREF_UNION | AST_SIP_CALL_CODEC_PREF_ALL);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (strcmp(pref_str, "remote_first") == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_set_flag(pref, AST_SIP_CALL_CODEC_PREF_REMOTE | AST_SIP_CALL_CODEC_PREF_UNION | AST_SIP_CALL_CODEC_PREF_FIRST);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*!</span><br><span> * \brief Set name and number information on an identity header.</span><br><span> *</span><br><span>diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c</span><br><span>index 0285486..a74d663 100644</span><br><span>--- a/res/res_pjsip/pjsip_configuration.c</span><br><span>+++ b/res/res_pjsip/pjsip_configuration.c</span><br><span>@@ -1128,19 +1128,8 @@</span><br><span> struct ast_flags pref = { 0, };</span><br><span> int outgoing = strcmp(var->name, "outgoing_call_offer_pref") == 0;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (strcmp(var->value, "local") == 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_set_flag(&pref, AST_SIP_CALL_CODEC_PREF_LOCAL | AST_SIP_CALL_CODEC_PREF_INTERSECT | AST_SIP_CALL_CODEC_PREF_ALL);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (outgoing && strcmp(var->value, "local_merge") == 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_set_flag(&pref, AST_SIP_CALL_CODEC_PREF_LOCAL | AST_SIP_CALL_CODEC_PREF_UNION | AST_SIP_CALL_CODEC_PREF_ALL);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (strcmp(var->value, "local_first") == 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_set_flag(&pref, AST_SIP_CALL_CODEC_PREF_LOCAL | AST_SIP_CALL_CODEC_PREF_INTERSECT | AST_SIP_CALL_CODEC_PREF_FIRST);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (strcmp(var->value, "remote") == 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_set_flag(&pref, AST_SIP_CALL_CODEC_PREF_REMOTE | AST_SIP_CALL_CODEC_PREF_INTERSECT | AST_SIP_CALL_CODEC_PREF_ALL);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (outgoing && strcmp(var->value, "remote_merge") == 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_set_flag(&pref, AST_SIP_CALL_CODEC_PREF_REMOTE | AST_SIP_CALL_CODEC_PREF_UNION | AST_SIP_CALL_CODEC_PREF_ALL);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (strcmp(var->value, "remote_first") == 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_set_flag(&pref, AST_SIP_CALL_CODEC_PREF_REMOTE | AST_SIP_CALL_CODEC_PREF_UNION | AST_SIP_CALL_CODEC_PREF_FIRST);</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ int res = ast_sip_call_codec_str_to_pref(&pref, var->value, outgoing);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (res != 0) {</span><br><span> return -1;</span><br><span> }</span><br><span> </span><br><span>diff --git a/res/res_pjsip_session.exports.in b/res/res_pjsip_session.exports.in</span><br><span>index d65b247..65c35ad 100644</span><br><span>--- a/res/res_pjsip_session.exports.in</span><br><span>+++ b/res/res_pjsip_session.exports.in</span><br><span>@@ -4,6 +4,7 @@</span><br><span> LINKER_SYMBOL_PREFIX__ast_sip_session_*;</span><br><span> LINKER_SYMBOL_PREFIXast_sip_dialog_get_session;</span><br><span> LINKER_SYMBOL_PREFIXast_sip_channel_pvt_alloc;</span><br><span style="color: hsl(120, 100%, 40%);">+ LINKER_SYMBOL_PREFIXast_sip_create_joint_call_cap;</span><br><span> local:</span><br><span> *;</span><br><span> };</span><br><span>diff --git a/tests/test_res_pjsip_session_caps.c b/tests/test_res_pjsip_session_caps.c</span><br><span>new file mode 100644</span><br><span>index 0000000..54438f5</span><br><span>--- /dev/null</span><br><span>+++ b/tests/test_res_pjsip_session_caps.c</span><br><span>@@ -0,0 +1,176 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * Asterisk -- An open source telephony toolkit.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (C) 2020, Sangoma Technologies Corporation</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * George Joseph <gjoseph@sangoma.com></span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * See http://www.asterisk.org for more information about</span><br><span style="color: hsl(120, 100%, 40%);">+ * the Asterisk project. Please do not directly contact</span><br><span style="color: hsl(120, 100%, 40%);">+ * any of the maintainers of this project for assistance;</span><br><span style="color: hsl(120, 100%, 40%);">+ * the project provides a web site, mailing lists and IRC</span><br><span style="color: hsl(120, 100%, 40%);">+ * channels for your use.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software, distributed under the terms of</span><br><span style="color: hsl(120, 100%, 40%);">+ * the GNU General Public License Version 2. See the LICENSE file</span><br><span style="color: hsl(120, 100%, 40%);">+ * at the top of the source tree.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \file</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief res_pjsip_session format caps tests</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \author George Joseph <gjoseph@sangoma.com></span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*** MODULEINFO</span><br><span style="color: hsl(120, 100%, 40%);">+ <depend>TEST_FRAMEWORK</depend></span><br><span style="color: hsl(120, 100%, 40%);">+ <depend>pjproject</depend></span><br><span style="color: hsl(120, 100%, 40%);">+ <depend>res_pjsip</depend></span><br><span style="color: hsl(120, 100%, 40%);">+ <depend>res_pjsip_session</depend></span><br><span style="color: hsl(120, 100%, 40%);">+ <support_level>core</support_level></span><br><span style="color: hsl(120, 100%, 40%);">+ ***/</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include "asterisk.h"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include "asterisk/test.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "asterisk/module.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "asterisk/res_pjsip.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "asterisk/utils.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "asterisk/format.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "asterisk/format_cap.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "asterisk/res_pjsip_session.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "asterisk/res_pjsip_session_caps.h"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static enum ast_test_result_state test_create_joint(struct ast_test *test, const char *local_string,</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *remote_string, const char *pref_string, int is_outgoing, const char *expected_string,</span><br><span style="color: hsl(120, 100%, 40%);">+ enum ast_test_result_state expected_result)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ RAII_VAR(struct ast_format_cap *, local, ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT), ao2_cleanup);</span><br><span style="color: hsl(120, 100%, 40%);">+ RAII_VAR(struct ast_format_cap *, remote, ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT), ao2_cleanup);</span><br><span style="color: hsl(120, 100%, 40%);">+ RAII_VAR(struct ast_format_cap *, joint, ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT), ao2_cleanup);</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_str *joint_str = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *joint_string;</span><br><span style="color: hsl(120, 100%, 40%);">+ char *stripped_joint;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_flags codec_prefs;</span><br><span style="color: hsl(120, 100%, 40%);">+ int rc;</span><br><span style="color: hsl(120, 100%, 40%);">+ int i;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_test_status_update(test, "Testing local: (%s), remote: (%s), pref: (%-12s), outgoing: (%s), expected: (%s) expected result: (%s)\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ local_string, remote_string, pref_string, is_outgoing ? "yes" : "no ", expected_string,</span><br><span style="color: hsl(120, 100%, 40%);">+ expected_result == AST_TEST_PASS ? "PASS" : "FAIL");</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_test_validate(test, local != NULL && remote != NULL && joint != NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ rc = ast_format_cap_update_by_allow_disallow(local, local_string, 1);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (rc != 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_test_status_update(test, " %sxpected Failure: Coulldn't parse local codecs (%s)\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ expected_result == AST_TEST_FAIL ? "E" : "Une", local_string);</span><br><span style="color: hsl(120, 100%, 40%);">+ return expected_result == AST_TEST_FAIL ? AST_TEST_PASS : AST_TEST_FAIL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ rc = ast_format_cap_update_by_allow_disallow(remote, remote_string, 1);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (rc != 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_test_status_update(test, " %sxpected Failure: Coulldn't parse remote codecs (%s)\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ expected_result == AST_TEST_FAIL ? "E" : "Une", remote_string);</span><br><span style="color: hsl(120, 100%, 40%);">+ return expected_result == AST_TEST_FAIL ? AST_TEST_PASS : AST_TEST_FAIL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ rc = ast_sip_call_codec_str_to_pref(&codec_prefs, pref_string, is_outgoing);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (rc != 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_test_status_update(test, " %sxpected Failure: Invalid preference string incoming/outgoing combination.\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ expected_result == AST_TEST_FAIL ? "E" : "Une");</span><br><span style="color: hsl(120, 100%, 40%);">+ return expected_result == AST_TEST_FAIL ? AST_TEST_PASS : AST_TEST_FAIL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ joint = ast_sip_create_joint_call_cap(remote, local, AST_MEDIA_TYPE_AUDIO, codec_prefs);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (joint == NULL) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_test_status_update(test, " %sxpected Failure: No joint caps.\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ expected_result == AST_TEST_FAIL ? "E" : "Une");</span><br><span style="color: hsl(120, 100%, 40%);">+ return expected_result == AST_TEST_FAIL ? AST_TEST_PASS : AST_TEST_FAIL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ joint_string = ast_format_cap_get_names(joint, &joint_str);</span><br><span style="color: hsl(120, 100%, 40%);">+ stripped_joint = ast_str_truncate(joint_str, ast_str_strlen(joint_str) - 1) + 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ for(i = 0; i <= strlen(stripped_joint); i++) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if(stripped_joint[i] == '|') {</span><br><span style="color: hsl(120, 100%, 40%);">+ stripped_joint[i] = ',';</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!joint_string || strcmp(stripped_joint, expected_string) != 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_test_status_update(test, " %sxpected Failure: Expected: (%s) Actual: (%s)\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ expected_result == AST_TEST_FAIL ? "E" : "Une", expected_string, stripped_joint);</span><br><span style="color: hsl(120, 100%, 40%);">+ return expected_result == AST_TEST_FAIL ? AST_TEST_PASS : AST_TEST_FAIL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return AST_TEST_PASS;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define RUN_CREATE_JOINT(local, remote, pref, outgoing, expected, result) \</span><br><span style="color: hsl(120, 100%, 40%);">+do { \</span><br><span style="color: hsl(120, 100%, 40%);">+ if (test_create_joint(test, local, remote, pref, outgoing, expected, result) != AST_TEST_PASS) { \</span><br><span style="color: hsl(120, 100%, 40%);">+ rc += 1; \</span><br><span style="color: hsl(120, 100%, 40%);">+ } \</span><br><span style="color: hsl(120, 100%, 40%);">+} while (0)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+AST_TEST_DEFINE(low_level)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ int rc = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ switch (cmd) {</span><br><span style="color: hsl(120, 100%, 40%);">+ case TEST_INIT:</span><br><span style="color: hsl(120, 100%, 40%);">+ info->name = __func__;</span><br><span style="color: hsl(120, 100%, 40%);">+ info->category = "/res/res_pjsip_session/caps/";</span><br><span style="color: hsl(120, 100%, 40%);">+ info->summary = "Test res_pjsip_session_caps";</span><br><span style="color: hsl(120, 100%, 40%);">+ info->description = "Test res_pjsip_session_caps";</span><br><span style="color: hsl(120, 100%, 40%);">+ return AST_TEST_NOT_RUN;</span><br><span style="color: hsl(120, 100%, 40%);">+ case TEST_EXECUTE:</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Incoming */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_test_status_update(test, "Testing incoming expected pass\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ RUN_CREATE_JOINT("ulaw,alaw,g722", "g722,alaw,g729", "local", 0, "alaw,g722", AST_TEST_PASS);</span><br><span style="color: hsl(120, 100%, 40%);">+ RUN_CREATE_JOINT("ulaw,alaw,g722", "g722,alaw,g729", "local_first", 0, "alaw", AST_TEST_PASS);</span><br><span style="color: hsl(120, 100%, 40%);">+ RUN_CREATE_JOINT("slin", "all", "local", 0, "slin", AST_TEST_PASS);</span><br><span style="color: hsl(120, 100%, 40%);">+ RUN_CREATE_JOINT("ulaw,alaw,g722", "g722,alaw,g729", "remote", 0, "g722,alaw", AST_TEST_PASS);</span><br><span style="color: hsl(120, 100%, 40%);">+ RUN_CREATE_JOINT("ulaw,alaw,g722", "g722,alaw,g729", "remote_first", 0, "g722", AST_TEST_PASS);</span><br><span style="color: hsl(120, 100%, 40%);">+ RUN_CREATE_JOINT("all", "slin", "remote_first", 0, "slin", AST_TEST_PASS);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_test_status_update(test, "Testing incoming expected fail\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ RUN_CREATE_JOINT("ulaw,alaw,g722", "g729", "local", 0, "", AST_TEST_FAIL);</span><br><span style="color: hsl(120, 100%, 40%);">+ RUN_CREATE_JOINT("ulaw,alaw,g722", "g722,alaw,g729", "local_merge", 0, "", AST_TEST_FAIL);</span><br><span style="color: hsl(120, 100%, 40%);">+ RUN_CREATE_JOINT("ulaw,alaw,g722", "g722,alaw,g729", "remote_merge", 0, "", AST_TEST_FAIL);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_test_status_update(test, "Testing outgoing expected pass\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ RUN_CREATE_JOINT("ulaw,alaw,g722", "g722,g729,alaw", "local", 1, "alaw,g722", AST_TEST_PASS);</span><br><span style="color: hsl(120, 100%, 40%);">+ RUN_CREATE_JOINT("ulaw,alaw,g722", "g722,g729,alaw", "local_first", 1, "alaw", AST_TEST_PASS);</span><br><span style="color: hsl(120, 100%, 40%);">+ RUN_CREATE_JOINT("ulaw,alaw,g722", "g722,g729,alaw", "local_merge", 1, "ulaw,alaw,g722,g729", AST_TEST_PASS);</span><br><span style="color: hsl(120, 100%, 40%);">+ RUN_CREATE_JOINT("ulaw,alaw,g722", "g722,g729,alaw", "remote", 1, "g722,alaw", AST_TEST_PASS);</span><br><span style="color: hsl(120, 100%, 40%);">+ RUN_CREATE_JOINT("ulaw,alaw,g722", "g722,g729,alaw", "remote_first", 1, "g722", AST_TEST_PASS);</span><br><span style="color: hsl(120, 100%, 40%);">+ RUN_CREATE_JOINT("ulaw,alaw,g722", "g722,g729,alaw", "remote_merge", 1, "g722,g729,alaw,ulaw", AST_TEST_PASS);</span><br><span style="color: hsl(120, 100%, 40%);">+ RUN_CREATE_JOINT("!all", "g722,g729,alaw", "remote_merge", 1, "g722,g729,alaw", AST_TEST_PASS);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return rc >= 1 ? AST_TEST_FAIL : AST_TEST_PASS;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static int load_module(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_TEST_REGISTER(low_level);</span><br><span style="color: hsl(120, 100%, 40%);">+ return AST_MODULE_LOAD_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static int unload_module(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_TEST_UNREGISTER(low_level);</span><br><span style="color: hsl(120, 100%, 40%);">+ return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "res_pjsip_session caps test module",</span><br><span style="color: hsl(120, 100%, 40%);">+ .support_level = AST_MODULE_SUPPORT_CORE,</span><br><span style="color: hsl(120, 100%, 40%);">+ .load = load_module,</span><br><span style="color: hsl(120, 100%, 40%);">+ .unload = unload_module,</span><br><span style="color: hsl(120, 100%, 40%);">+ .requires = "res_pjsip_session",</span><br><span style="color: hsl(120, 100%, 40%);">+);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14026">change 14026</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/14026"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ic8957c43e7ceeab0e9272af60ea53f056164f164 </div>
<div style="display:none"> Gerrit-Change-Number: 14026 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>