title: QuickBlox Chat: can't perform video call
body: <p>I'm developing a video chat application with quickblox. And I have a trouble with performing video call. There are logs of two instances of application started in one time:</p>
  
  <pre><code>Sep 11 16:43:40 iPod-touch DimChat[3823] &lt;Warning&gt;: QBChat/didConnect
  Sep 11 16:43:40 iPod-touch DimChat[3823] &lt;Warning&gt;: -[QBChat xmppStreamDidAuthenticate:] -&gt; user: 290427, supportsStartTLS: 1, isSecure: 0
  Sep 11 16:43:40 iPod-touch DimChat[3823] &lt;Warning&gt;: -[QBChat xmppStream:didSendPresence:] -&gt; Presence: &lt;presence/&gt;
  Sep 11 16:43:40 iPod-touch DimChat[3823] &lt;Warning&gt;: -[QBChat xmppStream:didSendIQ:] -&gt; IQ: &lt;iq type="get" id="561006823"&gt;&lt;query xmlns="jabber:iq:roster"/&gt;&lt;/iq&gt;
  Sep 11 16:43:41 iPod-touch DimChat[3823] &lt;Warning&gt;: -[QBChat xmppStream:didReceiveIQ:] -&gt; &lt;iq xmlns="jabber:client" id="561006823" type="result" to="290427-3936@chat.quickblox.com/tigase-3171"&gt;&lt;query xmlns="jabber:iq:roster"/&gt;&lt;/iq&gt;
  Sep 11 16:44:00 iPod-touch DimChat[3823] &lt;Warning&gt;: -[QBChat xmppStream:didSendPresence:] -&gt; Presence: &lt;presence/&gt;
  Sep 11 16:44:18 iPod-touch wifid[14] &lt;Error&gt;: WiFi:[400596258.779212]: Disable WoW requested by "UserEventAgent"
  Sep 11 16:44:18 iPod-touch DimChat[3823] &lt;Warning&gt;: QBChat/didDisconnect, error: Error Domain=GCDAsyncSocketErrorDomain Code=7 "Socket closed by remote peer" UserInfo=0x1ed273e0 {NSLocalizedDescription=Socket closed by remote peer}
  Sep 11 16:44:20 iPod-touch DimChat[3823] &lt;Warning&gt;: -[QBChat sendPresence] -&gt; return. You have to be logged in in order to use Chat API
  </code></pre>
  
  <p>The second instance which calls the first one:</p>
  
  <pre><code>2013-09-11 16:43:46.408 DimChat[55216:b10f] QBChat/didConnect
  2013-09-11 16:43:47.053 DimChat[55216:a207] -[QBChat xmppStreamDidAuthenticate:] -&gt; user: 503867, supportsStartTLS: 1, isSecure: 0
  2013-09-11 16:43:47.053 DimChat[55216:a207] -[QBChat xmppStream:didSendIQ:] -&gt; IQ: &lt;iq type="get" id="561006823"&gt;&lt;query xmlns="jabber:iq:roster"/&gt;&lt;/iq&gt;
  2013-09-11 16:43:47.053 DimChat[55216:a207] -[QBChat xmppStream:didSendPresence:] -&gt; Presence: &lt;presence/&gt;
  2013-09-11 16:43:47.215 DimChat[55216:b10f] -[QBChat xmppStream:didReceiveIQ:] -&gt; &lt;iq xmlns="jabber:client" id="561006823" type="result" to="503867-3936@chat.quickblox.com/tigase-3170"&gt;&lt;query xmlns="jabber:iq:roster"/&gt;&lt;/iq&gt;
  2013-09-11 16:43:56.295 DimChat[55216:b10f] -[QBVideoChat init] -&gt; 
  2013-09-11 16:43:56.295 DimChat[55216:b10f] -[QBVideoChat orientatioDidChange:] -&gt; LandscapeLeft
  2013-09-11 16:43:56.296 DimChat[55216:b10f] -[QBVideoChat callUser:conferenceType:customParameters:] -&gt; VideoChat configuration: {
      kQBVideoChatBadConnectionTimeout = 5;
      kQBVideoChatCallTimeout = 15;
      kQBVideoChatFrameQualityPreset = AVCaptureSessionPresetLow;
      kQBVideoChatP2PTimeout = "1.5";
      kQBVideoChatTURNServerEndPoint = "turnserver.quickblox.com";
      kQBVideoChatVideoFramesPerSecond = 10;
      kQBVideoChatWriteQueueMaxAudioOperationsThreshold = 25;
      kQBVideoChatWriteQueueMaxVideoOperationsThreshold = 25;
  }
  2013-09-11 16:43:56.296 DimChat[55216:b10f] -[QBChat xmppStream:didSendMessage:] -&gt; Message: &lt;message id="282475249" type="qbvideochat_call" to="290427-3936@chat.quickblox.com" from="503867-3936@chat.quickblox.com"&gt;&lt;body&gt;1&lt;/body&gt;&lt;/message&gt;
  2013-09-11 16:43:58.297 DimChat[55216:b10f] -[QBChat xmppStream:didSendMessage:] -&gt; Message: &lt;message id="1622650073" type="qbvideochat_call" to="290427-3936@chat.quickblox.com" from="503867-3936@chat.quickblox.com"&gt;&lt;body&gt;1&lt;/body&gt;&lt;/message&gt;
  2013-09-11 16:44:00.298 DimChat[55216:b10f] -[QBChat xmppStream:didSendMessage:] -&gt; Message: &lt;message id="984943658" type="qbvideochat_call" to="290427-3936@chat.quickblox.com" from="503867-3936@chat.quickblox.com"&gt;&lt;body&gt;1&lt;/body&gt;&lt;/message&gt;
  2013-09-11 16:44:02.300 DimChat[55216:b10f] -[QBChat xmppStream:didSendMessage:] -&gt; Message: &lt;message id="1144108930" type="qbvideochat_call" to="290427-3936@chat.quickblox.com" from="503867-3936@chat.quickblox.com"&gt;&lt;body&gt;1&lt;/body&gt;&lt;/message&gt;
  2013-09-11 16:44:04.300 DimChat[55216:b10f] -[QBChat xmppStream:didSendMessage:] -&gt; Message: &lt;message id="470211272" type="qbvideochat_call" to="290427-3936@chat.quickblox.com" from="503867-3936@chat.quickblox.com"&gt;&lt;body&gt;1&lt;/body&gt;&lt;/message&gt;
  2013-09-11 16:44:06.302 DimChat[55216:b10f] -[QBChat xmppStream:didSendMessage:] -&gt; Message: &lt;message id="101027544" type="qbvideochat_call" to="290427-3936@chat.quickblox.com" from="503867-3936@chat.quickblox.com"&gt;&lt;body&gt;1&lt;/body&gt;&lt;/message&gt;
  2013-09-11 16:44:07.065 DimChat[55216:b10f] -[QBChat xmppStream:didSendPresence:] -&gt; Presence: &lt;presence/&gt;
  2013-09-11 16:44:08.303 DimChat[55216:b10f] -[QBChat xmppStream:didSendMessage:] -&gt; Message: &lt;message id="1457850878" type="qbvideochat_call" to="290427-3936@chat.quickblox.com" from="503867-3936@chat.quickblox.com"&gt;&lt;body&gt;1&lt;/body&gt;&lt;/message&gt;
  2013-09-11 16:44:10.303 DimChat[55216:b10f] -[QBChat xmppStream:didSendMessage:] -&gt; Message: &lt;message id="1458777923" type="qbvideochat_call" to="290427-3936@chat.quickblox.com" from="503867-3936@chat.quickblox.com"&gt;&lt;body&gt;1&lt;/body&gt;&lt;/message&gt;
  2013-09-11 16:44:11.304 DimChat[55216:b10f] -[QBVideoChat finishCallWithStatus:customParameters:] -&gt; kStopVideoChatCallStatus_OpponentDidNotAnswer
  2013-09-11 16:44:11.305 DimChat[55216:b10f] -[QBVideoChat deinitialization] -&gt; 
  2013-09-11 16:44:11.305 DimChat[55216:b10f] -[QBVideoChat releaseVideoCapture] -&gt; 
  2013-09-11 16:44:11.306 DimChat[55216:b10f] -[QBVideoChat releaseAudioCapture] -&gt; 
  2013-09-11 16:44:11.306 DimChat[55216:b10f] -[QBVideoChat releaseSocketConnection] -&gt; 
  2013-09-11 16:44:11.306 DimChat[55216:b10f] -[QBChat xmppStream:didSendMessage:] -&gt; Message: &lt;message id="2007237709" type="qbvideochat_stopCall" to="290427-3936@chat.quickblox.com" from="503867-3936@chat.quickblox.com"&gt;&lt;body&gt;kStopVideoChatCallStatus_OpponentDidNotAnswer&lt;/body&gt;&lt;/message&gt;
  2013-09-11 16:44:25.264 DimChat[55216:b10f] QBChat/didDisconnect, error: Error Domain=GCDAsyncSocketErrorDomain Code=7 "Socket closed by remote peer" UserInfo=0x9ca1260 {NSLocalizedDescription=Socket closed by remote peer}
  2013-09-11 16:44:27.074 DimChat[55216:b10f] -[QBChat sendPresence] -&gt; return. You have to be logged in in order to use Chat API
  </code></pre>
  
  <p>Actually the problem is that the first instance didn't receive incoming call. 
  I checked the video chat example from quickblox's github. It works with my users/passwords, so I have a mistake in my code, but I really don't know where I should search it.</p>
  
  <p>As you can see both instances have the same problem: "Socket closed by remote peer". But this problem happens after call timeout, so it isn't a cause of main problem.</p>