Index: channels/chan_misdn.c =================================================================== --- channels/chan_misdn.c (revision 123644) +++ channels/chan_misdn.c (working copy) @@ -2329,6 +2329,7 @@ ast_queue_hangup_with_cause(ast, AST_CAUSE_PROTOCOL_ERROR); } + ast_channel_lock(p->ast); tmp = pbx_builtin_getvar_helper(p->ast, "CRYPT_KEY"); if (!ast_strlen_zero(tmp)) { @@ -2337,7 +2338,9 @@ } else { chan_misdn_log(3, p->bc->port, " --> Connection is without BF encryption\n"); } + ast_channel_unlock(p->ast); + ast_channel_lock(ast); tmp = pbx_builtin_getvar_helper(ast, "MISDN_DIGITAL_TRANS"); if (!ast_strlen_zero(tmp) && ast_true(tmp)) { chan_misdn_log(1, p->bc->port, " --> Connection is transparent digital\n"); @@ -2345,6 +2348,7 @@ p->bc->hdlc = 0; p->bc->nojitter = 1; } + ast_channel_unlock(ast); p->state = MISDN_CONNECTED; stop_indicate(p); @@ -2565,12 +2569,15 @@ bc = p->bc; if (bc) { - const char *tmp=pbx_builtin_getvar_helper(ast,"MISDN_USERUSER"); + const char *tmp; + ast_channel_lock(ast); + tmp=pbx_builtin_getvar_helper(ast,"MISDN_USERUSER"); if (tmp) { ast_log(LOG_NOTICE, "MISDN_USERUSER: %s\n", tmp); strcpy(bc->uu, tmp); bc->uulen=strlen(bc->uu); } + ast_channel_unlock(ast); } MISDN_ASTERISK_TECH_PVT(ast) = NULL; @@ -2614,12 +2621,14 @@ stop_bc_tones(p); bc->out_cause = ast->hangupcause ? ast->hangupcause : AST_CAUSE_NORMAL_CLEARING; - + + ast_channel_lock(ast); if ( (varcause = pbx_builtin_getvar_helper(ast, "HANGUPCAUSE")) || (varcause = pbx_builtin_getvar_helper(ast, "PRI_CAUSE"))) { int tmpcause = atoi(varcause); bc->out_cause = tmpcause ? tmpcause : AST_CAUSE_NORMAL_CLEARING; } + ast_channel_unlock(ast); chan_misdn_log(1, bc->port, "* IND : HANGUP\tpid:%d ctx:%s dad:%s oad:%s State:%s\n", p->bc ? p->bc->pid : -1, ast->context, ast->exten, ast->cid.cid_num, misdn_get_ch_state(p)); chan_misdn_log(3, bc->port, " --> l3id:%x\n", p->l3id); @@ -3875,7 +3884,10 @@ void import_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_list *ch) { - const char *tmp = pbx_builtin_getvar_helper(chan, "MISDN_PID"); + const char *tmp; + + ast_channel_lock(chan); + tmp = pbx_builtin_getvar_helper(chan, "MISDN_PID"); if (tmp) { ch->other_pid = atoi(tmp); chan_misdn_log(3, bc->port, " --> IMPORT_PID: importing pid:%s\n", tmp); @@ -3901,6 +3913,7 @@ tmp = pbx_builtin_getvar_helper(chan, "MISDN_KEYPAD"); if (tmp) ast_copy_string(bc->keypad, tmp, sizeof(bc->keypad)); + ast_channel_unlock(chan); } void export_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_list *ch)