To guarantee the channel is valid when calling setvar on the MASTER_CHANNEL
dialplan function, a channel reference must be taken before unlocking. Thanks
to russell for pointing out the error.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256823
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
snprintf(causevar, sizeof(causevar), "MASTER_CHANNEL(HASH(SIP_CAUSE,%s))", owner->name);
snprintf(causeval, sizeof(causeval), "SIP %s", REQ_OFFSET_TO_STR(req, rlPart2));
+ ast_channel_ref(owner);
sip_pvt_unlock(p);
ast_channel_unlock(owner);
*nounlock = 1;
pbx_builtin_setvar_helper(owner, causevar, causeval);
+ ast_channel_unref(owner);
sip_pvt_lock(p);
}
}