diff --git a/chan_lcr.c b/chan_lcr.c index 38f969b..85310ac 100644 --- a/chan_lcr.c +++ b/chan_lcr.c @@ -675,9 +675,19 @@ static void send_setup_to_lcr(struct chan_call *call) default: newparam.setup.callerinfo.ntype = INFO_NTYPE_UNKNOWN; } + + /* If we don't lock the channel, the variable could disappear out from underneath us */ + lock_debug("A10+"); + ast_channel_lock(ast); + lock_debug("A10-"); tmp = pbx_builtin_getvar_helper(ast, "LCR_TRANSFERCAPABILITY"); - if (tmp && *tmp) - ast->transfercapability = atoi(tmp); + if (tmp && *tmp) { + tmp = ast_strdupa(tmp); + ast->transfercapability = atoi(tmp); + } + ast_channel_unlock(ast); + lock_debug("a10"); + newparam.setup.capainfo.bearer_capa = ast->transfercapability; newparam.setup.capainfo.bearer_mode = INFO_BMODE_CIRCUIT; if (call->hdlc)