res_pjsip: Patch for res_pjsip_* module load/reload crash

The session_supplements for the pjsip makes crashes when the module
load/unload.

ASTERISK-28157

Change-Id: I5b82be3a75d702cf1933d8d1417f44aa10ad1029
This commit is contained in:
Sungtae Kim
2018-12-03 08:44:59 -06:00
committed by Joshua Colp
parent efeab21b52
commit 8644511cbf
4 changed files with 94 additions and 22 deletions
+14 -1
View File
@@ -258,6 +258,8 @@ enum ast_sip_session_response_priority {
* processing to incoming and outgoing SIP requests and responses
*/
struct ast_sip_session_supplement {
/*! Reference module info */
struct ast_module *module;
/*! Method on which to call the callbacks. If NULL, call on all methods */
const char *method;
/*! Priority for this supplement. Lower numbers are visited before higher numbers */
@@ -580,9 +582,13 @@ void ast_sip_session_unregister_sdp_handler(struct ast_sip_session_sdp_handler *
* set channel data based on headers in an incoming message. Similarly,
* a module could reject an incoming request if desired.
*
* \param module Referenced module(NULL safe)
* \param supplement The supplement to register
*/
void ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement);
void ast_sip_session_register_supplement_with_module(struct ast_module *module, struct ast_sip_session_supplement *supplement);
#define ast_sip_session_register_supplement(supplement) \
ast_sip_session_register_supplement_with_module(AST_MODULE_SELF, supplement)
/*!
* \brief Unregister a an supplement to SIP session processing
@@ -598,6 +604,13 @@ void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *su
*/
int ast_sip_session_add_supplements(struct ast_sip_session *session);
/*!
* \brief Remove supplements from a SIP session
*
* \param session The session to remove
*/
void ast_sip_session_remove_supplements(struct ast_sip_session *session);
/*!
* \brief Alternative for ast_datastore_alloc()
*