Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
602
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.91 KB | None | 0 0
  1. function connectToChat(callback) {
  2. setViewState('initializing');
  3. QB.createSession(function(err, res) {
  4. if (err) {
  5. return console.error('connectToChat', err);
  6. } else {
  7. var userParameters
  8. if (urlParams['user'] == 1) {
  9. userParameters = user1Parameters;
  10. } else {
  11. userParameters = user2Parameters;
  12. }
  13. $('#my_id').html(userParameters.userId);
  14. QB.login(userParameters, function(err, user) {
  15. if (err) {
  16. return console.error('QB.login', err);
  17. } else {
  18. var userName = urlParams['user'] == 1 ? 'User#1' : 'User#2';
  19. QB.users.update(userParameters.userId, {
  20. 'full_name': userName,
  21. 'tag_list': ROOM_TAG,
  22. }, function(updateError, updateUser) {
  23. $('#current-user').html('Logged in as : ' + userParameters.userId + ' - ' + userName);
  24. if(updateError) {
  25. console.error('APP [update user] Error:', updateError);
  26. } else {
  27. QB.chat.connect({
  28. jid: QB.chat.helpers.getUserJid(userParameters.userId, APP_ID),
  29. password: userParameters.password,
  30. }, callback);
  31. }
  32. });
  33. }
  34. });
  35. }
  36. })
  37. }
  38.  
  39. function makeCall() {
  40. console.log('[APP EVENT]', 'Calling the current session');
  41.  
  42. var mediaParams = {
  43. audio: false,
  44. video: {
  45. deviceId: undefined
  46. },
  47. options: {
  48. muted: true,
  49. mirror: true
  50. },
  51. elemId: 'localVideo'
  52. };
  53. setViewState('calling');
  54.  
  55. if (urlParams['user'] == 1) {
  56. var calleesIds = [user2Parameters.userId];
  57. } else {
  58. var calleesIds = [user1Parameters.userId];
  59. }
  60. var sessionType = QB.webrtc.CallType.VIDEO; // AUDIO is also possible
  61. console.log('calleesIds::', calleesIds);
  62. session = QB.webrtc.createNewSession(calleesIds, sessionType);
  63. console.log('Session is', session);
  64. session.getUserMedia(mediaParams, function(err, stream) {
  65. if (err || !stream.getVideoTracks().length) {
  66. console.error('Failed to get video tracks', err);
  67. session.stop({});
  68. setViewState('error');
  69. } else {
  70. session.call({}, function(error) {
  71. if(error) {
  72. console.warn('session.call', error.detail);
  73. } else {
  74. console.log('Called successfully.');
  75. }
  76. });
  77. }
  78. });
  79. }
  80.  
  81. [AuthProxy] createSession Object {application_id: "46121", auth_key: "grNjnNAOUDwtC3b", nonce: 1834, timestamp: 1496471781, signature: "c79ba456143ef8dc117516c6c27878e045f1aa26"}
  82. quickblox.min.js:55221 [ServiceProxy] Request: POST Object {data: undefined}
  83. quickblox.min.js:55221 [ServiceProxy] Response: Object {data: "{"session":{"application_id":46121,"created_at":"2…-06-03T06:36:22Z","user_id":0,"_id":"161537831"}}"}
  84. quickblox.min.js:55221 [AuthProxy] login Object {userId: 27183475, login: "USERNAME", password: "PASSWORD"}
  85. quickblox.min.js:55221 [ServiceProxy] Request: POST Object {data: undefined}
  86. quickblox.min.js:55221 [ServiceProxy] Response: Object {data: "{"user":{"id":27183475,"owner_id":54682,"full_name…ter_digits_id":null,"user_tags":"secret-123456"}}"}
  87. quickblox.min.js:55221 [UsersProxy] update 27183475 Object {full_name: "User#2", tag_list: "secret-123456"}
  88. quickblox.min.js:55221 [ServiceProxy] Request: PUT Object {data: undefined}
  89. quickblox.min.js:55221 [ServiceProxy] Response: Object {data: "{"user":{"id":27183475,"owner_id":54682,"full_name…ter_digits_id":null,"user_tags":"secret-123456"}}"}
  90. quickblox.min.js:55221 [ChatProxy] connect Object {jid: "27183475-46121@chat.quickblox.com", password: "PASSWORD"}
  91. quickblox.min.js:55221 [ChatProxy] Status.CONNECTING
  92. quickblox.min.js:55221 [ChatProxy] Chat Protocol - WebSocket
  93. quickblox.min.js:55221 [QBChat] SENT: <open xmlns=​"urn:​ietf:​params:​xml:​ns:​xmpp-framing" to=​"chat.quickblox.com" version=​"1.0">​</open>​
  94. quickblox.min.js:55221 [QBChat] RECV: <open xmlns=​"urn:​ietf:​params:​xml:​ns:​xmpp-framing" from=​"chat.quickblox.com" id=​"c4f15c35-e9f0-4d12-9430-a327dd72e217" version=​"1.0" xml:lang=​"en">​</open>​
  95. quickblox.min.js:55221 [QBChat] RECV: <stream:features xmlns:stream=​"http:​/​/​etherx.jabber.org/​streams">​…​</stream:features>​
  96. quickblox.min.js:55221 [QBChat] SENT: <auth xmlns=​"urn:​ietf:​params:​xml:​ns:​xmpp-sasl" mechanism=​"PLAIN">​…​</auth>​
  97. quickblox.min.js:55221 [QBChat] RECV: <success xmlns=​"urn:​ietf:​params:​xml:​ns:​xmpp-sasl">​</success>​
  98. quickblox.min.js:55221 [QBChat] SENT: <open xmlns=​"urn:​ietf:​params:​xml:​ns:​xmpp-framing" to=​"chat.quickblox.com" version=​"1.0">​</open>​
  99. quickblox.min.js:55221 [QBChat] RECV: <open xmlns=​"urn:​ietf:​params:​xml:​ns:​xmpp-framing" from=​"chat.quickblox.com" id=​"c4f15c35-e9f0-4d12-9430-a327dd72e217" version=​"1.0" xml:lang=​"en">​</open>​
  100. quickblox.min.js:55221 [QBChat] RECV: <stream:features xmlns:stream=​"http:​/​/​etherx.jabber.org/​streams">​…​</stream:features>​
  101. quickblox.min.js:55221 [QBChat] SENT: <iq type=​"set" id=​"_bind_auth_2" xmlns=​"jabber:​client">​…​</iq>​
  102. quickblox.min.js:55221 [QBChat] RECV: <iq xmlns=​"jabber:​client" to=​"27183475-46121@chat.quickblox.com/​1571722472-quickblox-2693571" type=​"result" id=​"_bind_auth_2">​…​</iq>​
  103. quickblox.min.js:55221 [QBChat] SENT: <iq type=​"set" id=​"_session_auth_2" xmlns=​"jabber:​client">​…​</iq>​
  104. quickblox.min.js:55221 [QBChat] RECV: <iq xmlns=​"jabber:​client" to=​"27183475-46121@chat.quickblox.com/​1571722472-quickblox-2693571" type=​"result" id=​"_session_auth_2">​</iq>​
  105. quickblox.min.js:55221 [ChatProxy] Status.CONNECTED at 16:36:27
  106. quickblox.min.js:55221 [QBChat] SENT: <iq type=​"set" from=​"27183475-46121@chat.quickblox.com/​1571722472-quickblox-2693571" id=​"87836bf7-f1d7-4605-8e86-3298160dd5bb:​enableCarbons" xmlns=​"jabber:​client">​…​</iq>​
  107. quickblox.min.js:55221 [QBChat] SENT: <presence xmlns=​"jabber:​client">​</presence>​
  108. quickblox.min.js:55221 [QBChat] SENT: <iq type=​"get" from=​"27183475-46121@chat.quickblox.com/​1571722472-quickblox-2693571" id=​"9c926c20-a437-4a5a-879d-a44616fc8d86:​getRoster" xmlns=​"jabber:​client">​…​</iq>​
  109. quickblox.min.js:55221 [QBChat] RECV: <iq xmlns=​"jabber:​client" to=​"27183475-46121@chat.quickblox.com/​1571722472-quickblox-2693571" type=​"result" id=​"87836bf7-f1d7-4605-8e86-3298160dd5bb:​enableCarbons">​</iq>​
  110. quickblox.min.js:55221 [QBChat] RECV: <iq xmlns=​"jabber:​client" to=​"27183475-46121@chat.quickblox.com/​1571722472-quickblox-2693571" type=​"result" id=​"9c926c20-a437-4a5a-879d-a44616fc8d86:​getRoster">​…​</iq>​
  111. app.js:56 Connected to chat.
  112. quickblox.min.js:55221 [UsersProxy] get Object {tags: Array(1), per_page: 100}
  113. quickblox.min.js:55221 [ServiceProxy] Request: GET Object {data: undefined}
  114. quickblox.min.js:55221 [QBChat] RECV: <presence xmlns=​"jabber:​client" to=​"27183475-46121@chat.quickblox.com" from=​"27183475-46121@chat.quickblox.com/​1571722472-quickblox-2691871">​</presence>​
  115. quickblox.min.js:55221 [QBChat] RECV: <presence xmlns=​"jabber:​client" to=​"27183475-46121@chat.quickblox.com" from=​"27183475-46121@chat.quickblox.com/​1571722472-quickblox-2693360">​</presence>​
  116. quickblox.min.js:55221 [QBChat] RECV: <presence xmlns=​"jabber:​client" to=​"27183475-46121@chat.quickblox.com" from=​"27183475-46121@chat.quickblox.com/​1571722472-quickblox-2693571">​</presence>​
  117. quickblox.min.js:55221 [ServiceProxy] Response: Object {data: "{"current_page":1,"per_page":100,"total_entries":2…r_digits_id":null,"user_tags":"secret-123456"}}]}"}
  118. app.js:166 [APP EVENT] Calling the current session
  119. app.js:187 calleesIds:: [26345193]
  120. app.js:189 Session is n {ID: "01b6e562-e1b2-445d-a5fc-4fcf4683d98c", state: 1, initiatorID: 27183475, opponentsIDs: Array(1), callType: 1…}
  121. quickblox.min.js:52658 [QBWebRTC]: Call, extension: {}
  122. quickblox.min.js:52658 [QBWebRTC]: _createPeer, iceServers: {"iceServers":[{"url":"stun:stun.l.google.com:19302","urls":"stun:stun.l.google.com:19302"},{"url":"stun:turn.quickblox.com","username":"quickblox","credential":"baccb97ba2d92d71e26eb9886da5f1e0","urls":"stun:turn.quickblox.com"},{"url":"turn:turn.quickblox.com:3478?transport=udp","username":"quickblox","credential":"baccb97ba2d92d71e26eb9886da5f1e0","urls":"turn:turn.quickblox.com:3478?transport=udp"},{"url":"turn:turn.quickblox.com:3478?transport=tcp","username":"quickblox","credential":"baccb97ba2d92d71e26eb9886da5f1e0","urls":"turn:turn.quickblox.com:3478?transport=tcp"},{"url":"turn:turnsingapor.quickblox.com:3478?transport=udp","username":"quickblox","credential":"baccb97ba2d92d71e26eb9886da5f1e0","urls":"turn:turnsingapor.quickblox.com:3478?transport=udp"},{"url":"turn:turnsingapore.quickblox.com:3478?transport=tcp","username":"quickblox","credential":"baccb97ba2d92d71e26eb9886da5f1e0","urls":"turn:turnsingapore.quickblox.com:3478?transport=tcp"},{"url":"turn:turnireland.quickblox.com:3478?transport=udp","username":"quickblox","credential":"baccb97ba2d92d71e26eb9886da5f1e0","urls":"turn:turnireland.quickblox.com:3478?transport=udp"},{"url":"turn:turnireland.quickblox.com:3478?transport=tcp","username":"quickblox","credential":"baccb97ba2d92d71e26eb9886da5f1e0","urls":"turn:turnireland.quickblox.com:3478?transport=tcp"}]}
  123. quickblox.min.js:52658 [QBWebRTC]: RTCPeerConnection init. userID: 26345193, sessionID: 01b6e562-e1b2-445d-a5fc-4fcf4683d98c, type: offer
  124. quickblox.min.js:52763 _callInternal
  125. app.js:200 Called successfully.
  126. quickblox.min.js:52658 [QBWebRTC]: getAndSetLocalSessionDescription success
  127. quickblox.min.js:52658 [QBWebRTC]: _startDialingTimer, dialingTimeInterval: 5000
  128. quickblox.min.js:52658 [QBWebRTC]: _dialingCallback, answerTimeInterval: 0
  129. quickblox.min.js:55221 [QBChat] SENT: <message to=​"26345193-46121@chat.quickblox.com" type=​"headline" id=​"593258f4858e5a6ec7000000" xmlns=​"jabber:​client">​…​</message>​
  130. quickblox.min.js:55221 [QBChat] RECV: <message xmlns="jabber:client" to="27183475-46121@chat.quickblox.com" id="593258f53446726f40000025" from="26345193-46121@chat.quickblox.com/1571722472-quickblox-2691870" type="headline"><extraParams xmlns="jabber:client"><callType>1</callType><callerID>27183475</callerID><opponentsIDs><opponentID>26345193</opponentID></opponentsIDs><sessionID>01b6e562-e1b2-445d-a5fc-4fcf4683d98c</sessionID><moduleIdentifier>WebRTCVideoChat</moduleIdentifier><signalType>reject</signalType><platform>web</platform></extraParams></message>
  131. quickblox.min.js:52658 [QBWebRTC]: onReject. UserID:27183475. SessionID: 01b6e562-e1b2-445d-a5fc-4fcf4683d98c
  132. app.js:81 onRejectCallListener. The other person rejected the call.
  133. quickblox.min.js:52664 [QBWebRTC]: Ignore 'OnReject', there is no information about peer connection by some reason.
  134. traceError @ quickblox.min.js:52664
  135. n.processOnReject @ quickblox.min.js:52849
  136. n._onRejectListener @ quickblox.min.js:52621
  137. _onMessage @ quickblox.min.js:52999
  138. _onSystemMessageListener @ quickblox.min.js:51072
  139. run @ quickblox.min.js:37985
  140. (anonymous) @ quickblox.min.js:38206
  141. forEachChild @ quickblox.min.js:37758
  142. _dataRecv @ quickblox.min.js:38201
  143. _onMessage @ quickblox.min.js:38823
  144. quickblox.min.js:52658 [QBWebRTC]: All peer connections closed: false
  145. quickblox.min.js:55221 [QBChat] RECV: <message xmlns=​"jabber:​client" to=​"27183475-46121@chat.quickblox.com" id=​"593258f5b2eadf50f700002a" from=​"27183475-46121@chat.quickblox.com/​1571722472-quickblox-2691871" type=​"headline">​…​</message>​
  146. quickblox.min.js:52658 [QBWebRTC]: onReject. UserID:27183475. SessionID: 01b6e562-e1b2-445d-a5fc-4fcf4683d98c
  147. app.js:81 onRejectCallListener. The other person rejected the call.
  148. quickblox.min.js:52664 [QBWebRTC]: Ignore 'OnReject', there is no information about peer connection by some reason.
  149. traceError @ quickblox.min.js:52664
  150. n.processOnReject @ quickblox.min.js:52849
  151. n._onRejectListener @ quickblox.min.js:52621
  152. _onMessage @ quickblox.min.js:52999
  153. _onSystemMessageListener @ quickblox.min.js:51072
  154. run @ quickblox.min.js:37985
  155. (anonymous) @ quickblox.min.js:38206
  156. forEachChild @ quickblox.min.js:37758
  157. _dataRecv @ quickblox.min.js:38201
  158. _onMessage @ quickblox.min.js:38823
  159. quickblox.min.js:52658 [QBWebRTC]: All peer connections closed: false
  160. quickblox.min.js:55221 [QBChat] RECV: <message xmlns=​"jabber:​client" to=​"27183475-46121@chat.quickblox.com" id=​"593258f53446726f40000025" from=​"26345193-46121@chat.quickblox.com/​1571722472-quickblox-2691870" type=​"headline">​…​</message>​
  161. quickblox.min.js:52658 [QBWebRTC]: onReject. UserID:26345193. SessionID: 01b6e562-e1b2-445d-a5fc-4fcf4683d98c
  162. app.js:81 onRejectCallListener. The other person rejected the call.
  163. quickblox.min.js:52658 [QBWebRTC]: _clearDialingTimer
  164. quickblox.min.js:52658 [QBWebRTC]: All peer connections closed: true
  165. app.js:105 onSessionCloseListener: n {ID: "01b6e562-e1b2-445d-a5fc-4fcf4683d98c", state: 2, initiatorID: 27183475, opponentsIDs: Array(1), callType: 1…}
  166. quickblox.min.js:52658 [QBWebRTC]: onIceConnectionStateCallback: closed
  167. app.js:109 All states Object {UNDEFINED: 0, CONNECTING: 1, CONNECTED: 2, FAILED: 3, DISCONNECTED: 4…}
  168. app.js:110 Connection state is # 5
  169.  
  170. QB.webrtc.onCallListener = function(receivingSession, extension) {
  171. console.log('onCallListener. Someone else is calling me.');
  172. setViewState('receiving-call');
  173. };
  174.  
  175. onCallListener. Someone else is calling me.
  176. quickblox.min.js:52658 [QBWebRTC]: _createPeer, iceServers: {"iceServers":[{"url":"stun:stun.l.google.com:19302","urls":"stun:stun.l.google.com:19302"},{"url":"stun:turn.quickblox.com","username":"quickblox","credential":"baccb97ba2d92d71e26eb9886da5f1e0","urls":"stun:turn.quickblox.com"},{"url":"turn:turn.quickblox.com:3478?transport=udp","username":"quickblox","credential":"baccb97ba2d92d71e26eb9886da5f1e0","urls":"turn:turn.quickblox.com:3478?transport=udp"},{"url":"turn:turn.quickblox.com:3478?transport=tcp","username":"quickblox","credential":"baccb97ba2d92d71e26eb9886da5f1e0","urls":"turn:turn.quickblox.com:3478?transport=tcp"},{"url":"turn:turnsingapor.quickblox.com:3478?transport=udp","username":"quickblox","credential":"baccb97ba2d92d71e26eb9886da5f1e0","urls":"turn:turnsingapor.quickblox.com:3478?transport=udp"},{"url":"turn:turnsingapore.quickblox.com:3478?transport=tcp","username":"quickblox","credential":"baccb97ba2d92d71e26eb9886da5f1e0","urls":"turn:turnsingapore.quickblox.com:3478?transport=tcp"},{"url":"turn:turnireland.quickblox.com:3478?transport=udp","user
  177. name":"quickblox","credential":"baccb97ba2d92d71e26eb9886da5f1e0","urls":"turn:turnireland.quickblox.com:3478?transport=udp"},{"url":"turn:turnireland.quickblox.com:3478?transport=tcp","username":"quickblox","credential":"baccb97ba2d92d71e26eb9886da5f1e0","urls":"turn:turnireland.quickblox.com:3478?transport=tcp"}]}
  178. quickblox.min.js:52658 [QBWebRTC]: RTCPeerConnection init. userID: 27183475, sessionID: c7bc18fc-746f-445b-b631-40e1cfa6ca85, type: answer
  179. quickblox.min.js:52658 [QBWebRTC]: _startAnswerTimer
  180. quickblox.min.js:55219 [QBChat] RECV: <message xmlns=​"jabber:​client" to=​"26345193-46121@chat.quickblox.com/​1571722472-quickblox-2693645" from=​"26345193-46121@chat.quickblox.com" type=​"headline" id=​"5932598f3446726f40000026">​<sent xmlns=​"urn:​xmpp:​carbons:​2">​<forwarded xmlns=​"urn:​xmpp:​forward:​0">​<message xmlns=​"jabber:​client" to=​"27183475-46121@chat.quickblox.com" id=​"5932598f3446726f40000026" from=​"26345193-46121@chat.quickblox.com/​1571722472-quickblox-2691870" type=​"headline">​<extraParams xmlns=​"jabber:​client">​<callType>​1​</callType>​<callerID>​27183475​</callerID>​<opponentsIDs>​<opponentID>​26345193​</opponentID>​</opponentsIDs>​<sessionID>​c7bc18fc-746f-445b-b631-40e1cfa6ca85​</sessionID>​<moduleIdentifier>​WebRTCVideoChat​</moduleIdentifier>​<signalType>​reject​</signalType>​<platform>​web​</platform>​</extraParams>​</message>​</forwarded>​</sent>​</message>​
  181. quickblox.min.js:52658 [QBWebRTC]: onReject. UserID:26345193. SessionID: c7bc18fc-746f-445b-b631-40e1cfa6ca85
  182. app.js:80 onRejectCallListener. The other person rejected the call.
  183. quickblox.min.js:52664 [QBWebRTC]: Ignore 'OnReject', there is no information about peer connection by some reason
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement