diff --git a/Extensions/XEP-0065/TURNSocket.m b/Extensions/XEP-0065/TURNSocket.m index 3899d73c9e..d79a279668 100644 --- a/Extensions/XEP-0065/TURNSocket.m +++ b/Extensions/XEP-0065/TURNSocket.m @@ -174,7 +174,7 @@ + (BOOL)isNewStartTURNRequest:(XMPPIQ *)iq if (isTcpBytestreamQuery) { - NSString *uuid = [iq elementID]; + NSString *uuid = [[query attributeForName:@"sid"] stringValue]; @synchronized(existingTurnSockets) { @@ -270,9 +270,6 @@ - (id)initWithStream:(XMPPStream *)stream incomingTURNRequest:(XMPPIQ *)iq xmppStream = stream; jid = [iq from]; - // Store a copy of the ID (which will be our uuid) - uuid = [[iq elementID] copy]; - // Setup initial state for a server connection state = STATE_INIT; isClient = NO; @@ -280,6 +277,8 @@ - (id)initWithStream:(XMPPStream *)stream incomingTURNRequest:(XMPPIQ *)iq // Extract streamhost information from turn request NSXMLElement *query = [iq elementForName:@"query" xmlns:@"http://jabber.org/protocol/bytestreams"]; streamhosts = [[query elementsForName:@"streamhost"] mutableCopy]; + // Store a copy of the Session ID + uuid = [[[query attributeForName:@"sid"] stringValue] copy]; // Configure everything else [self performPostInitSetup];