 
 		let type = desc.object(forKey: "type") as? String ?? ""
 		let sdp = desc.object(forKey: "sdp") as? String ?? ""
-		let rtcSessionDescription = RTCSessionDescription(type: rtcSdpTypeParser(type: type), sdp: sdp)
-
-		self.rtcPeerConnection.setRemoteDescription(rtcSessionDescription, completionHandler: { (error: Error?) in
-			if(error != nil){
-				NSLog("PluginRTCPeerConnection#setRemoteDescription() | failure callback: %@", String(describing: error))
-				errback(error!)
-				return;
-			}
-
+		let sdpType = RTCSessionDescription.type(for: type)
+		let rtcSessionDescription = RTCSessionDescription(type: sdpType, sdp: sdp)
+
+		self.onSetDescriptionSuccessCallback = { [unowned self] () -> Void in
 			NSLog("PluginRTCPeerConnection#setRemoteDescription() | success callback")
 
 			let data = [
-				"type": self.rtcSdpTypeToString(type: self.rtcPeerConnection.remoteDescription!.type),
+				"type": RTCSessionDescription.string(for: self.rtcPeerConnection.remoteDescription!.type),
 				"sdp": self.rtcPeerConnection.remoteDescription!.sdp
 			]
 
 			callback(data as NSDictionary)
-		});
-	}
-
+		}
+
+		self.onSetDescriptionFailureCallback = { (error: Error) -> Void in
+			NSLog("PluginRTCPeerConnection#setRemoteDescription() | failure callback: %@", String(describing: error))
+
+			errback(error)
+		}
+
+		self.rtcPeerConnection.setRemoteDescription(rtcSessionDescription, completionHandler: {
+			(error: Error?) in
+			if (error == nil) {
+				self.onSetDescriptionSuccessCallback();
+			} else {
+				self.onSetDescriptionFailureCallback(error!);
+			}
+		})
+	}
 
 	func addIceCandidate(
 		_ candidate: NSDictionary,

		self.eventListener([
			"type": "icecandidate",
			"candidate": [
				"sdpMid": candidate.sdpMid!,
				"sdpMLineIndex": candidate.sdpMLineIndex,
				"candidate": candidate.sdp
			],
			"localDescription": [
				"type": rtcSdpTypeToString(type: self.rtcPeerConnection.localDescription!.type),
				"sdp": self.rtcPeerConnection.localDescription!.sdp
			]
		])
	}
	 

	var eventListener: (_ data: NSDictionary) -> Void
	var eventListenerForAddStream: (_ pluginMediaStream: PluginMediaStream) -> Void
	var eventListenerForRemoveStream: (_ id: String) -> Void

	var onCreateLocalDescriptionSuccessCallback: ((_ rtcSessionDescription: RTCSessionDescription) -> Void)!
	var onCreateLocalDescriptionFailureCallback: ((_ error: Error) -> Void)!
	var onCreateRemoteDescriptionSuccessCallback: ((_ rtcSessionDescription: RTCSessionDescription) -> Void)!
	var onCreateRemoteDescriptionFailureCallback: ((_ error: Error) -> Void)!
	var onSetDescriptionSuccessCallback: (() -> Void)!
	var onSetDescriptionFailureCallback: ((_ error: Error) -> Void)!
	var onGetStatsCallback: ((_ array: NSArray) -> Void)!
		
	var streamIds: [String] = []
	var isAudioInputSelected: Bool = false

