|
1 | 1 | using System; |
2 | 2 | using System.Text; |
3 | 3 | using Microsoft.Extensions.Logging; |
| 4 | +using Polyfills; |
4 | 5 | using SIPSorcery.SIP; |
5 | 6 | using SIPSorcery.UnitTests; |
6 | 7 | using Xunit; |
@@ -165,8 +166,44 @@ public void ParseCryptoSIPMessage() |
165 | 166 | logger.BeginScope(TestHelper.GetCurrentMethodName()); |
166 | 167 |
|
167 | 168 | string sipMsg = |
168 | | - $"INVITE sip:33@10.2.0.110:5061;transport=tls SIP/2.0{CRLF}Via: SIP/2.0/TLS 10.2.19.102:58179;rport;branch=z9hG4bKPj9893426a070f4c26ab494ceb746836a6{CRLF}Max-Forwards: 70{CRLF}From: <sip:a@10.2.0.110>;tag=b0d60b9dda9043818dea1f0e8ff9667c{CRLF}To: <sip:33@10.2.0.110>{CRLF}Contact: <sip:a@10.2.19.102:58179;ob>{CRLF}Call-ID: 6410bc5eb6724efd8717831ac2af5c35{CRLF}CSeq: 9941 INVITE{CRLF}Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS{CRLF}Supported: replaces, 100rel, timer, norefersub{CRLF}Session-Expires: 1800{CRLF}Min-SE: 90{CRLF}User-Agent: MicroSIP/3.19.8{CRLF}Content-Type: application/sdp{CRLF}Content-Length: 720{CRLF}{CRLF}v=0{CRLF}o=- 3784977145 3784977145 IN IP4 10.2.19.102{CRLF}s=pjmedia{CRLF}b=AS:84{CRLF}t=0 0{CRLF}a=X-nat:0{CRLF}m=audio 4000 RTP/AVP 8 0 101{CRLF}c=IN IP4 10.2.19.102{CRLF}b=TIAS:64000{CRLF}a=rtcp:4001 IN IP4 10.2.19.102{CRLF}a=sendrecv{CRLF}a=rtpmap:8 PCMA/8000{CRLF}a=rtpmap:0 PCMU/8000{CRLF}a=rtpmap:101 telephone-event/8000{CRLF}a=fmtp:101 0-16{CRLF}a=ssrc:370289018 cname:089912e5446c1847{CRLF}a=crypto:1 AES_256_CM_HMAC_SHA1_80 inline:i/aQZXuTQXF8NcIPG/8ClKLXjzJZiZkFqNerJJaWtX9ShjuamMQgFocXUEkWCQ=={CRLF}a=crypto:2 AES_256_CM_HMAC_SHA1_32 inline:WEXYOzOomH16+KpVRc8RKHkGUEW6DdvYHWSFKePVy9RzC5DB2Ciw+4t9huV8KA=={CRLF}a=crypto:3 AES_CM_128_HMAC_SHA1_80 inline:6wGxadTFLGO9iKPSC8XfRQsOFDRFgJdmpBfdWp9r{CRLF}a=crypto:4 AES_CM_128_HMAC_SHA1_32 inline:SdihJallj5frjwWc5yeXbMZlJSLlS+o2bkH3Jsle" |
169 | | - ; |
| 169 | + """ |
| 170 | + INVITE sip:33@10.2.0.110:5061;transport=tls SIP/2.0 |
| 171 | + Via: SIP/2.0/TLS 10.2.19.102:58179;rport;branch=z9hG4bKPj9893426a070f4c26ab494ceb746836a6 |
| 172 | + Max-Forwards: 70 |
| 173 | + From: <sip:a@10.2.0.110>;tag=b0d60b9dda9043818dea1f0e8ff9667c |
| 174 | + To: <sip:33@10.2.0.110> |
| 175 | + Contact: <sip:a@10.2.19.102:58179;ob> |
| 176 | + Call-ID: 6410bc5eb6724efd8717831ac2af5c35 |
| 177 | + CSeq: 9941 INVITE |
| 178 | + Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS |
| 179 | + Supported: replaces, 100rel, timer, norefersub |
| 180 | + Session-Expires: 1800 |
| 181 | + Min-SE: 90 |
| 182 | + User-Agent: MicroSIP/3.19.8 |
| 183 | + Content-Type: application/sdp |
| 184 | + Content-Length: 720 |
| 185 | +
|
| 186 | + v=0 |
| 187 | + o=- 3784977145 3784977145 IN IP4 10.2.19.102 |
| 188 | + s=pjmedia |
| 189 | + b=AS:84 |
| 190 | + t=0 0 |
| 191 | + a=X-nat:0 |
| 192 | + m=audio 4000 RTP/AVP 8 0 101 |
| 193 | + c=IN IP4 10.2.19.102 |
| 194 | + b=TIAS:64000 |
| 195 | + a=rtcp:4001 IN IP4 10.2.19.102 |
| 196 | + a=sendrecv |
| 197 | + a=rtpmap:8 PCMA/8000 |
| 198 | + a=rtpmap:0 PCMU/8000 |
| 199 | + a=rtpmap:101 telephone-event/8000 |
| 200 | + a=fmtp:101 0-16 |
| 201 | + a=ssrc:370289018 cname:089912e5446c1847 |
| 202 | + a=crypto:1 AES_256_CM_HMAC_SHA1_80 inline:i/aQZXuTQXF8NcIPG/8ClKLXjzJZiZkFqNerJJaWtX9ShjuamMQgFocXUEkWCQ== |
| 203 | + a=crypto:2 AES_256_CM_HMAC_SHA1_32 inline:WEXYOzOomH16+KpVRc8RKHkGUEW6DdvYHWSFKePVy9RzC5DB2Ciw+4t9huV8KA== |
| 204 | + a=crypto:3 AES_CM_128_HMAC_SHA1_80 inline:6wGxadTFLGO9iKPSC8XfRQsOFDRFgJdmpBfdWp9r |
| 205 | + a=crypto:4 AES_CM_128_HMAC_SHA1_32 inline:SdihJallj5frjwWc5yeXbMZlJSLlS+o2bkH3Jsle |
| 206 | + """.ReplaceLineEndings(CRLF); |
170 | 207 |
|
171 | 208 | SIPMessageBuffer sipMessageBuffer = SIPMessageBuffer.ParseSIPMessage(Encoding.UTF8.GetBytes(sipMsg), null, null); |
172 | 209 | Assert.True(sipMessageBuffer != null, "The SIP message not parsed correctly."); |
|
0 commit comments