res_pjsip_session: Added new function calls to avoid ABI issues.

Added two new functions (ast_sip_session_get_dialog and
ast_sip_session_get_pjsip_inv_state) that retrieve the dialog and the
pjsip_inv_state respectively from the pjsip_inv_session on the
ast_sip_session struct. This is due to pjproject adding a new field to
the pjsip_inv_session struct that caused crashes when trying to access
fields that were no longer where they were expected to be if a module
was compiled against a different version of pjproject.

Resolves: #145
This commit is contained in:
Ben Ford
2023-06-05 14:13:16 -05:00
committed by asterisk-org-access-app[bot]
parent 7dfc190e23
commit 8c76507b9f
2 changed files with 42 additions and 0 deletions

View File

@@ -3641,6 +3641,28 @@ struct ast_sip_session *ast_sip_dialog_get_session(pjsip_dialog *dlg)
return session;
}
pjsip_dialog *ast_sip_session_get_dialog(const struct ast_sip_session *session)
{
pjsip_inv_session *inv_session = session->inv_session;
if (!inv_session) {
return NULL;
}
return inv_session->dlg;
}
pjsip_inv_state ast_sip_session_get_pjsip_inv_state(const struct ast_sip_session *session)
{
pjsip_inv_session *inv_session = session->inv_session;
if (!inv_session) {
return PJSIP_INV_STATE_NULL;
}
return inv_session->state;
}
enum sip_get_destination_result {
/*! The extension was successfully found */
SIP_GET_DEST_EXTEN_FOUND,