 	}
 
 	@objc(MediaStreamTrack_clone:) func MediaStreamTrack_clone(_ command: CDVInvokedUrlCommand) {
-		NSLog("iosrtcPlugin#MediaStreamTrack_clone()")
+		
 
 		let existingTrackId = command.argument(at: 0) as! String
 		let newTrackId = command.argument(at: 1) as! String
 		let pluginMediaStreamTrack = self.pluginMediaStreamTracks[existingTrackId]
-
+        NSLog("iosrtcPlugin#MediaStreamTrack_clone() existing=%@ new=%@", existingTrackId, newTrackId)
 		if pluginMediaStreamTrack == nil {
 			NSLog("iosrtcPlugin#MediaStreamTrack_clone() | ERROR: pluginMediaStreamTrack with id=%@ does not exist", String(existingTrackId))
 			return;
 		}
 
 		if self.pluginMediaStreams[newTrackId] == nil {
-			let rtcMediaStreamTrack = self.pluginMediaStreamTracks[existingTrackId]!.rtcMediaStreamTrack;
+			var rtcMediaStreamTrack = self.pluginMediaStreamTracks[existingTrackId]!.rtcMediaStreamTrack;
+            // twilio uses the sdp local description to map the track ids to the media id.
+            // if the original rtcMediaStreamTrack is not cloned, the rtcPeerConnection 
+			// will not add the track and as such will not be found by Twilio. 
+			// it is unable to do the mapping and find track and thus
+            // will not publish the local track.
+            if pluginMediaStreamTrack?.kind == "video" {
+                if let rtcVideoTrack = rtcMediaStreamTrack as? RTCVideoTrack{
+                    NSLog("iosrtcPlugin#MediaStreamTrack_clone() cloning video source");
+                    rtcMediaStreamTrack = self.rtcPeerConnectionFactory.videoTrack(with: rtcVideoTrack.source, trackId: newTrackId);
+                }
+            } else if pluginMediaStreamTrack?.kind == "audio" {
+                if let rtcAudioTrack = rtcMediaStreamTrack as? RTCAudioTrack{
+                    NSLog("iosrtcPlugin#MediaStreamTrack_clone() cloning audio source");
+                    rtcMediaStreamTrack = self.rtcPeerConnectionFactory.audioTrack(with: rtcAudioTrack.source, trackId: newTrackId);
+                }
+            }
 			let newPluginMediaStreamTrack = PluginMediaStreamTrack(rtcMediaStreamTrack: rtcMediaStreamTrack, trackId: newTrackId)
 
 			self.saveMediaStreamTrack(newPluginMediaStreamTrack)

	}

	@objc(MediaStream_addTrack:) func MediaStream_addTrack(_ command: CDVInvokedUrlCommand) {
		NSLog("iosrtcPlugin#MediaStream_addTrack()")

		let id = command.argument(at: 0) as! String
		let trackId = command.argument(at: 1) as! String
		let pluginMediaStream = self.pluginMediaStreams[id]
		let pluginMediaStreamTrack = self.pluginMediaStreamTracks[trackId]

		if pluginMediaStream == nil {
			NSLog("iosrtcPlugin#MediaStream_addTrack() | ERROR: pluginMediaStream with id=%@ does not exist", String(id))
			return

	}

	@objc(RTCPeerConnection_getStats:) func RTCPeerConnection_getStats(_ command: CDVInvokedUrlCommand) {
//		NSLog("iosrtcPlugin#RTCPeerConnection_getStats()")

		let pcId = command.argument(at: 0) as! Int
		let pluginRTCPeerConnection = self.pluginRTCPeerConnections[pcId]
