Skip to content
Snippets Groups Projects
Commit 5583d2c6 authored by Jonathan Rose's avatar Jonathan Rose
Browse files

chan_pjsip: Revert r403587

This patch was intended to eliminate a deadlock that occurs when
masquerades occur in pjsip channels, but has some potential side
effects. Mark Michelson is currently working on addressing this
problem from another angle.

(issue ASTERISK-22936)
Reported by: Jonathan Rose
........

Merged revisions 403705 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403707 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent c602b086
No related branches found
No related tags found
No related merge requests found
...@@ -630,28 +630,14 @@ static int chan_pjsip_write(struct ast_channel *ast, struct ast_frame *frame) ...@@ -630,28 +630,14 @@ static int chan_pjsip_write(struct ast_channel *ast, struct ast_frame *frame)
struct fixup_data { struct fixup_data {
struct ast_sip_session *session; struct ast_sip_session *session;
struct ast_channel *chan; struct ast_channel *chan;
struct ast_channel *oldchan;
}; };
static void fixup_data_destroy(struct fixup_data *fix_data)
{
ao2_cleanup(fix_data->session);
ast_channel_cleanup(fix_data->chan);
ast_channel_cleanup(fix_data->oldchan);
ast_free(fix_data);
}
static int fixup(void *data) static int fixup(void *data)
{ {
struct fixup_data *fix_data = data; struct fixup_data *fix_data = data;
struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(fix_data->chan); struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(fix_data->chan);
struct chan_pjsip_pvt *pvt = channel->pvt; struct chan_pjsip_pvt *pvt = channel->pvt;
if (channel->session->channel != fix_data->oldchan) {
fixup_data_destroy(fix_data);
return -1;
}
channel->session->channel = fix_data->chan; channel->session->channel = fix_data->chan;
if (pvt->media[SIP_MEDIA_AUDIO] && pvt->media[SIP_MEDIA_AUDIO]->rtp) { if (pvt->media[SIP_MEDIA_AUDIO] && pvt->media[SIP_MEDIA_AUDIO]->rtp) {
ast_rtp_instance_set_channel_id(pvt->media[SIP_MEDIA_AUDIO]->rtp, ast_channel_uniqueid(fix_data->chan)); ast_rtp_instance_set_channel_id(pvt->media[SIP_MEDIA_AUDIO]->rtp, ast_channel_uniqueid(fix_data->chan));
...@@ -660,8 +646,6 @@ static int fixup(void *data) ...@@ -660,8 +646,6 @@ static int fixup(void *data)
ast_rtp_instance_set_channel_id(pvt->media[SIP_MEDIA_VIDEO]->rtp, ast_channel_uniqueid(fix_data->chan)); ast_rtp_instance_set_channel_id(pvt->media[SIP_MEDIA_VIDEO]->rtp, ast_channel_uniqueid(fix_data->chan));
} }
fixup_data_destroy(fix_data);
return 0; return 0;
} }
...@@ -669,23 +653,16 @@ static int fixup(void *data) ...@@ -669,23 +653,16 @@ static int fixup(void *data)
static int chan_pjsip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan) static int chan_pjsip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
{ {
struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(newchan); struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(newchan);
struct fixup_data *fix_data = ast_calloc(1, sizeof(*fix_data)); struct fixup_data fix_data;
fix_data.session = channel->session;
fix_data.chan = newchan;
if (!fix_data) { if (channel->session->channel != oldchan) {
return -1; return -1;
} }
fix_data->session = channel->session; if (ast_sip_push_task_synchronous(channel->session->serializer, fixup, &fix_data)) {
ao2_ref(fix_data->session, +1);
fix_data->chan = newchan;
ast_channel_ref(fix_data->chan);
fix_data->oldchan = oldchan;
ast_channel_ref(fix_data->oldchan);
if (ast_sip_push_task(channel->session->serializer, fixup, fix_data)) {
fixup_data_destroy(fix_data);
ast_log(LOG_WARNING, "Unable to perform channel fixup\n"); ast_log(LOG_WARNING, "Unable to perform channel fixup\n");
return -1; return -1;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment