summaryrefslogtreecommitdiff
path: root/res/res_pjsip_refer.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2014-05-30 14:53:44 +0000
committerKinsey Moore <kmoore@digium.com>2014-05-30 14:53:44 +0000
commit00077c46dbd8abbd3881625879cc3887065b0694 (patch)
treebe2a49e1185a850f7650812dd80f547a876f1b88 /res/res_pjsip_refer.c
parent53968c00b34a913e0467200b95add483f79dd3b6 (diff)
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 ........ Merged revisions 414948 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414949 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip_refer.c')
-rw-r--r--res/res_pjsip_refer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/res/res_pjsip_refer.c b/res/res_pjsip_refer.c
index 20e3012b1..efcee67a2 100644
--- a/res/res_pjsip_refer.c
+++ b/res/res_pjsip_refer.c
@@ -691,11 +691,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;
}