mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Expose the chan_pjsip implementation pvt and session in a defined manner.
This allows modules outside of chan_pjsip itself to get the session given only an Asterisk channel. Review: https://reviewboard.asterisk.org/r/2674/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395102 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -901,6 +901,31 @@ static int add_session_media(void *obj, void *arg, int flags)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*! \brief Destructor for SIP channel */
|
||||
static void sip_channel_destroy(void *obj)
|
||||
{
|
||||
struct ast_sip_channel_pvt *channel = obj;
|
||||
|
||||
ao2_cleanup(channel->pvt);
|
||||
ao2_cleanup(channel->session);
|
||||
}
|
||||
|
||||
struct ast_sip_channel_pvt *ast_sip_channel_pvt_alloc(void *pvt, struct ast_sip_session *session)
|
||||
{
|
||||
struct ast_sip_channel_pvt *channel = ao2_alloc(sizeof(*channel), sip_channel_destroy);
|
||||
|
||||
if (!channel) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ao2_ref(pvt, +1);
|
||||
channel->pvt = pvt;
|
||||
ao2_ref(session, +1);
|
||||
channel->session = session;
|
||||
|
||||
return channel;
|
||||
}
|
||||
|
||||
struct ast_sip_session *ast_sip_session_alloc(struct ast_sip_endpoint *endpoint, pjsip_inv_session *inv_session)
|
||||
{
|
||||
RAII_VAR(struct ast_sip_session *, session, ao2_alloc(sizeof(*session), session_destructor), ao2_cleanup);
|
||||
|
@@ -16,6 +16,7 @@
|
||||
LINKER_SYMBOL_PREFIXast_sip_session_create_invite;
|
||||
LINKER_SYMBOL_PREFIXast_sip_session_create_outgoing;
|
||||
LINKER_SYMBOL_PREFIXast_sip_dialog_get_session;
|
||||
LINKER_SYMBOL_PREFIXast_sip_channel_pvt_alloc;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
Reference in New Issue
Block a user