 			onLocalDescription = =>
 				@transport.sendDescription
 					to: data.from
-					from: @selfId
 					type: 'answer'
 					description:
 						sdp: answer.sdp

			cancelButtonText: "No"
		, (isConfirm) =>
			if isConfirm
				@joinCall
					audio: data.audio
					video: data.video
			else
				@stop()


			@log 'WebRTCTransportClass - onRoom', type, data

			switch type
				when 'status'
					if @callbacks['onRemoteStatus']?.length > 0
						fn(data) for fn in @callbacks['onRemoteStatus']

	onUserStream: (type, data) ->
		if data.room isnt @webrtcInstance.room then return
		@log 'WebRTCTransportClass - onUser', type, data

		switch type
			when 'call'
				if @callbacks['onRemoteCall']?.length > 0
					fn(data) for fn in @callbacks['onRemoteCall']

			when 'join'
				if @callbacks['onRemoteJoin']?.length > 0
					fn(data) for fn in @callbacks['onRemoteJoin']

			when 'candidate'
				if @callbacks['onRemoteCandidate']?.length > 0
					fn(data) for fn in @callbacks['onRemoteCandidate']

			when 'description'
				if @callbacks['onRemoteDescription']?.length > 0
					fn(data) for fn in @callbacks['onRemoteDescription']

	startCall: (media) ->
		@log 'WebRTCTransportClass - startCall', @webrtcInstance.room, @webrtcInstance.selfId
		RocketChat.Notifications.notifyUsersOfRoom @webrtcInstance.room, 'webrtc', 'call',
			from: @webrtcInstance.selfId
			room: @webrtcInstance.room
			audio: media.audio
			video: media.video

	joinCall: (media) ->
		@log 'WebRTCTransportClass - joinCall', @webrtcInstance.room, @webrtcInstance.selfId
		RocketChat.Notifications.notifyUsersOfRoom @webrtcInstance.room, 'webrtc', 'join',
			from: @webrtcInstance.selfId
			room: @webrtcInstance.room
			audio: media.audio
			video: media.video

	sendCandidate: (data) ->
		data.from = @webrtcInstance.selfId
		data.room = @webrtcInstance.room
		@log 'WebRTCTransportClass - sendCandidate', data
		RocketChat.Notifications.notifyUser data.to, 'webrtc', 'candidate', data

	sendDescription: (data) ->
		data.from = @webrtcInstance.selfId
		data.room = @webrtcInstance.room
		@log 'WebRTCTransportClass - sendDescription', data
		RocketChat.Notifications.notifyUser data.to, 'webrtc', 'description', data

	sendStatus: (data) ->
		@log 'WebRTCTransportClass - sendStatus', data, @webrtcInstance.room
		data.from = @webrtcInstance.selfId
		RocketChat.Notifications.notifyRoom @webrtcInstance.room, 'webrtc', 'status', data

	onRemoteCall: (fn) ->
