Fixes a bug in chan_iax that uses send_command to poke a peer while a channel is...
authorBrett Bryant <bbryant@digium.com>
Wed, 28 May 2008 16:01:05 +0000 (16:01 +0000)
committerBrett Bryant <bbryant@digium.com>
Wed, 28 May 2008 16:01:05 +0000 (16:01 +0000)
random failures could be related to some bugs in the tracker...

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@118702 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c

index fcd1882..7ce45d3 100644 (file)
@@ -9908,7 +9908,11 @@ static int iax2_poke_peer(struct iax2_peer *peer, int heldcall)
                peer_unref(peer);
 
        /* And send the poke */
-       send_command(iaxs[peer->callno], AST_FRAME_IAX, IAX_COMMAND_POKE, 0, NULL, 0, -1);
+       ast_mutex_lock(&iaxsl[peer->callno]);
+       if (iaxs[peer->callno]) {
+               send_command(iaxs[peer->callno], AST_FRAME_IAX, IAX_COMMAND_POKE, 0, NULL, 0, -1);
+       }
+       ast_mutex_unlock(&iaxsl[peer->callno]);
 
        return 0;
 }