From 2b3dec3e284a7d7356699da69bf9368a39343626 Mon Sep 17 00:00:00 2001 From: Kinsey Moore Date: Fri, 30 May 2014 14:46:32 +0000 Subject: [PATCH] PJSIP: Prevent crash on blind transfer Blind transfers don't go too well with NULL channels which can occur if the channel has already been transferred away. (closes issue ASTERISK-23718) Reported by: Jonathan Rose git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@414948 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/res_pjsip_refer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/res/res_pjsip_refer.c b/res/res_pjsip_refer.c index ab27f0b0cb..4a906e9580 100644 --- a/res/res_pjsip_refer.c +++ b/res/res_pjsip_refer.c @@ -692,11 +692,16 @@ static int refer_incoming_attended_request(struct ast_sip_session *session, pjsi static int refer_incoming_blind_request(struct ast_sip_session *session, pjsip_rx_data *rdata, pjsip_sip_uri *target, struct refer_progress *progress) { - const char *context = (session->channel ? pbx_builtin_getvar_helper(session->channel, "TRANSFER_CONTEXT") : ""); + const char *context; char exten[AST_MAX_EXTENSION]; struct refer_blind refer = { 0, }; + if (!session->channel) { + return 404; + } + /* If no explicit transfer context has been provided use their configured context */ + context = pbx_builtin_getvar_helper(session->channel, "TRANSFER_CONTEXT"); if (ast_strlen_zero(context)) { context = session->endpoint->context; } -- 2.47.2