Lock iax2 pvt structure when passing off to the AMI function, and make sure it exists...
authorJoshua Colp <jcolp@digium.com>
Sun, 6 May 2007 20:09:18 +0000 (20:09 +0000)
committerJoshua Colp <jcolp@digium.com>
Sun, 6 May 2007 20:09:18 +0000 (20:09 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@63182 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c

index fe53030..a92e59c 100644 (file)
@@ -3343,7 +3343,10 @@ static int iax2_answer(struct ast_channel *c)
        unsigned short callno = PTR_TO_CALLNO(c->tech_pvt);
        if (option_debug)
                ast_log(LOG_DEBUG, "Answering IAX2 call\n");
-       iax2_ami_channelupdate(c->tech_pvt);
+       ast_mutex_lock(&iaxsl[callno]);
+       if (iaxs[callno])
+               iax2_ami_channelupdate(iaxs[callno]);
+       ast_mutex_unlock(&iaxsl[callno]);
        return send_command_locked(callno, AST_FRAME_CONTROL, AST_CONTROL_ANSWER, 0, NULL, 0, -1);
 }