summaryrefslogtreecommitdiff
path: root/res/res_pjsip.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2016-06-23 15:13:24 -0500
committerRichard Mudgett <rmudgett@digium.com>2016-06-30 12:09:10 -0500
commit38a4e983dcf0d83006be1c50982fd62fdc6ea1a3 (patch)
tree7bc2f11f3523dc1fab69d4819d12e168a4eac7bf /res/res_pjsip.c
parent1952434df562f0b4dd41af161cf0186e393013da (diff)
res_pjsip.c: Register PJMEDIA error code decoder.
Registering the PJMEDIA error codes allows errors found when parsing an incoming SDP to be easier to figure out. "Missing SDP rtpmap for dynamic payload type (PJMEDIA_SDP_EMISSINGRTPMAP)" is much easier to understand than "Unknown error 220030". ASTERISK-25772 Change-Id: I44b2dcea656fedd7593171be9e845880a2c70ca0
Diffstat (limited to 'res/res_pjsip.c')
-rw-r--r--res/res_pjsip.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index bbaf77853..5df2603ad 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -24,6 +24,7 @@
#include <pjsip/sip_transaction.h>
#include <pj/timer.h>
#include <pjlib.h>
+#include <pjmedia/errno.h>
#include "asterisk/res_pjsip.h"
#include "res_pjsip/include/res_pjsip_private.h"
@@ -4252,6 +4253,19 @@ error:
return AST_MODULE_LOAD_DECLINE;
}
+/*
+ * This is a place holder function to ensure that pjmedia_strerr() is at
+ * least directly referenced by this module to ensure that the loader
+ * linker will link to the function. If a module only indirectly
+ * references a function from another module, such as a callback parameter
+ * to a function, the loader linker has been known to miss the link.
+ */
+void never_called_res_pjsip(void);
+void never_called_res_pjsip(void)
+{
+ pjmedia_strerror(0, NULL, 0);
+}
+
static int load_module(void)
{
struct ast_threadpool_options options;
@@ -4267,6 +4281,12 @@ static int load_module(void)
goto error;
}
+ /* Register PJMEDIA error codes for SDP parsing errors */
+ if (pj_register_strerror(PJMEDIA_ERRNO_START, PJ_ERRNO_SPACE_SIZE, pjmedia_strerror)
+ != PJ_SUCCESS) {
+ ast_log(LOG_WARNING, "Failed to register pjmedia error codes. Codes will not be decoded.\n");
+ }
+
if (ast_sip_initialize_system()) {
ast_log(LOG_ERROR, "Failed to initialize SIP 'system' configuration section. Aborting load\n");
goto error;