Fix a crash due to the INVITE session being destroyed before the session.
This change ensures that the INVITE session remains valid for the lifetime of the session object itself by increasing the session count on the dialog that the INVITE session is allocated from. Once this reaches zero (normally as a result of decrementing it within the session destructor) the dialog, and INVITE session, are destroyed. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389609 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
557125664d
commit
814fa7fe11
1 changed files with 5 additions and 0 deletions
|
@ -887,6 +887,10 @@ static void session_destructor(void *obj)
|
||||||
ast_party_id_free(&session->id);
|
ast_party_id_free(&session->id);
|
||||||
ao2_cleanup(session->endpoint);
|
ao2_cleanup(session->endpoint);
|
||||||
ast_format_cap_destroy(session->req_caps);
|
ast_format_cap_destroy(session->req_caps);
|
||||||
|
|
||||||
|
if (session->inv_session) {
|
||||||
|
pjsip_dlg_dec_session(session->inv_session->dlg, &session_module);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_supplements(struct ast_sip_session *session)
|
static int add_supplements(struct ast_sip_session *session)
|
||||||
|
@ -945,6 +949,7 @@ struct ast_sip_session *ast_sip_session_alloc(struct ast_sip_endpoint *endpoint,
|
||||||
}
|
}
|
||||||
ast_sip_dialog_set_serializer(inv_session->dlg, session->serializer);
|
ast_sip_dialog_set_serializer(inv_session->dlg, session->serializer);
|
||||||
ast_sip_dialog_set_endpoint(inv_session->dlg, endpoint);
|
ast_sip_dialog_set_endpoint(inv_session->dlg, endpoint);
|
||||||
|
pjsip_dlg_inc_session(inv_session->dlg, &session_module);
|
||||||
ao2_ref(endpoint, +1);
|
ao2_ref(endpoint, +1);
|
||||||
inv_session->mod_data[session_module.id] = session;
|
inv_session->mod_data[session_module.id] = session;
|
||||||
session->endpoint = endpoint;
|
session->endpoint = endpoint;
|
||||||
|
|
Loading…
Reference in a new issue