setRemoteDescription error wit copy & paste offer

I am testing webrtc for the first time to try to see if I can establish p-to-p connections between two android phones. What I am trying to do is to initiate a connection from one phone and send the offer thru email to the other phone. Then from the other phone I copy the offer from the email and paste into a text field and parse it to setRemoteDescription with a press of button, and so forth. Basically doing the steps manually.

This is my code for creating sending the offer:

pc.createOffer().then((desc) => {
  pc.setLocalDescription(desc).then(() => {
    this.sendOffer(JSON.stringify(desc));
  });
});

When I paste the offer and press a button, the following codes execute and error out:

configuration = {iceServers: [{url: ‘stun:stun.l.google.com:19302’}]};
const pc = new RTCPeerConnection(configuration);
const remoteOffer = JSON.parse(this.state.remoteOffer.trim());
pc.setRemoteDescription(new RTCSessionDescription(remoteOffer))
.then(() => {
console.log(‘Success’);
});

Here’s the error I got
Possible Unhandled Promise Rejection (id: 0): “SessionDescription is NULL.”
I checked the value of remoteOffer, it contains property “sdp” and “type”, where “sdp” = full sdp value, and “type” = “offer”.

I couldn’t get pass this step. What am I missing?

And this is a sample offer that got sent through the email. It contains the “\r\n” formatting characters, but I think they are fixed in JSON.parse.

{“sdp”:“v=0\r\no=- 8081389036817593320 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS 49a3a7bb-0c66-43b3-b406-d63dc77218c5\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 102 0 8 106 105 13 110 112 113 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:M7y7\r\na=ice-pwd:VC8u1mSHWI0Z2UUIN5QDCC3i\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 5F:F1:AD:D9:FE:A3:68:B3:67:99:38:56:F5:E2:D9:D4:A9:36:5D:6F:B4:0C:B4:CE:6D:AD:1C:78:E0:4E:65:82\r\na=setup:actpass\r\na=mid:audio\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=sendrecv\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:104 ISAC/32000\r\na=rtpmap:9 G722/8000\r\na=rtpmap:102 ILBC/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:106 CN/32000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:110 telephone-event/48000\r\na=rtpmap:112 telephone-event/32000\r\na=rtpmap:113 telephone-event/16000\r\na=rtpmap:126 telephone-event/8000\r\na=ssrc:1513535253 cname:QEYd9i4FFnjjULKe\r\na=ssrc:1513535253 msid:49a3a7bb-0c66-43b3-b406-d63dc77218c5 29a68456-c218-4d1f-a79b-65afd52d6074\r\na=ssrc:1513535253 mslabel:49a3a7bb-0c66-43b3-b406-d63dc77218c5\r\na=ssrc:1513535253 label:29a68456-c218-4d1f-a79b-65afd52d6074\r\nm=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 127 123 125\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:M7y7\r\na=ice-pwd:VC8u1mSHWI0Z2UUIN5QDCC3i\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 5F:F1:AD:D9:FE:A3:68:B3:67:99:38:56:F5:E2:D9:D4:A9:36:5D:6F:B4:0C:B4:CE:6D:AD:1C:78:E0:4E:65:82\r\na=setup:actpass\r\na=mid:video\r\na=extmap:14 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:13 urn:3gpp:video-orientation\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\na=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type\r\na=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing\r\na=extmap:8 http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07\r\na=extmap:9 http://www.webrtc.org/experiments/rtp-hdrext/color-space\r\na=sendrecv\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:96 VP8/90000\r\na=rtcp-fb:96 goog-remb\r\na=rtcp-fb:96 transport-cc\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtpmap:97 rtx/90000\r\na=fmtp:97 apt=96\r\na=rtpmap:98 VP9/90000\r\na=rtcp-fb:98 goog-remb\r\na=rtcp-fb:98 transport-cc\r\na=rtcp-fb:98 ccm fir\r\na=rtcp-fb:98 nack\r\na=rtcp-fb:98 nack pli\r\na=rtpmap:99 rtx/90000\r\na=fmtp:99 apt=98\r\na=rtpmap:100 H264/90000\r\na=rtcp-fb:100 goog-remb\r\na=rtcp-fb:100 transport-cc\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 nack pli\r\na=fmtp:100 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f\r\na=rtpmap:101 rtx/90000\r\na=fmtp:101 apt=100\r\na=rtpmap:127 red/90000\r\na=rtpmap:123 rtx/90000\r\na=fmtp:123 apt=127\r\na=rtpmap:125 ulpfec/90000\r\na=ssrc-group:FID 1353148659 2837616420\r\na=ssrc:1353148659 cname:QEYd9i4FFnjjULKe\r\na=ssrc:1353148659 msid:49a3a7bb-0c66-43b3-b406-d63dc77218c5 a6f14043-ceda-4c65-8865-cdf4529df46c\r\na=ssrc:1353148659 mslabel:49a3a7bb-0c66-43b3-b406-d63dc77218c5\r\na=ssrc:1353148659 label:a6f14043-ceda-4c65-8865-cdf4529df46c\r\na=ssrc:2837616420 cname:QEYd9i4FFnjjULKe\r\na=ssrc:2837616420 msid:49a3a7bb-0c66-43b3-b406-d63dc77218c5 a6f14043-ceda-4c65-8865-cdf4529df46c\r\na=ssrc:2837616420 mslabel:49a3a7bb-0c66-43b3-b406-d63dc77218c5\r\na=ssrc:2837616420 label:a6f14043-ceda-4c65-8865-cdf4529df46c\r\n”,“type”:“offer”}

Update:
I just tested that the google STUN server is not working probably due to my router firewall (tested from https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ with error code 701). would that be the reason that it is not working?

I figured out the problem. The email automatically adds a line break somewhere in the middle which caused the error. It works after I remove the line break.