代码拉取完成,页面将自动刷新
同步操作将从 北京小程科技有限公司/SIP协议 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package sip
import (
"fmt"
"strings"
"testing"
)
func TestMessageBase(t *testing.T) {
tests := []struct {
item string
wantErr bool
}{
{`REGISTER sip:192.168.0.2:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.102:5060;branch=z9hG4bK-172441109;rport
From: "1010"<sip:1010@192.168.0.2>;tag=943080490
To: <sip:1010@192.168.0.2>
Call-ID: 012022699881-214NTIL@192.168.0.102
CSeq: 1 REGISTER
Expires: 600
Allow: INVITE,CANCEL,ACK,BYE,NOTIFY,REFER,OPTIONS,INFO,MESSAGE,UPDATE,PRACK
Max-Forwards: 70
User-Agent: NTIL214 SIP-Test UA
Content-Length:0
Contact: <sip:1010@192.168.0.102:5060>
`, false},
{`INVITE sip:1010@192.168.0.2 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.100:45508;branch=z9hG4bK1158493fb1e25c83f14f5e7ee368;rport
From: "1011" <sip:1011@192.168.0.2>;tag=22365c3a331
To: "1010" <sip:1010@192.168.0.2>
Call-ID: 93fb1e2-cd303fba92f18-6ebf2a6@192.168.0.100
CSeq: 1 INVITE
Contact: <sip:1011@192.168.0.100:45508>
User-Agent: VaxPhoneSDK(iOS)/v6.8
Max-Forwards: 70
Allow: ACK, INFO, BYE, CANCEL, INVITE, NOTIFY, OPTIONS, REFER, REGISTER, SUBSCRIBE, MESSAGE, PRACK
Content-Type: application/protocol/sdp
Content-Length: 386
v=0
o=1011 244548 244548 IN IP4 192.168.0.100
s=VaxSoft
c=IN IP4 192.168.0.100
t=0 0
m=audio 63978 RTP/AVP 0 8 18 3 97 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=rtpmap:3 GSM/8000
a=rtpmap:97 iLBC/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=sendrecv
m=video 39198 RTP/AVP 96
a=rtpmap:96 VP8/90000
a=sendrecv
`, false},
{`SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 192.168.0.100:45508;branch=z9hG4bK1158493fb1e25c83f14f5e7ee368;rport
From: "1011"<sip:1011@192.168.0.2>;tag=22365c3a331
To: <sip:1010@192.168.0.2>;tag=291589446
Call-ID: 93fb1e2-cd303fba92f18-6ebf2a6@192.168.0.100
CSeq: 1 INVITE
Allow: INVITE,CANCEL,ACK,BYE,NOTIFY,REFER,OPTIONS,INFO,MESSAGE,UPDATE,PRACK
Max-Forwards: 70
User-Agent: NTIL214 SIP-Test UA
Content-Length:0
Contact: <sip:1010@192.168.0.102:5060>
`, false},
{`SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.100:45508;branch=z9hG4bK1158493fb1e25c83f14f5e7ee368;rport
From: "1011"<sip:1011@192.168.0.2>;tag=22365c3a331
To: <sip:1010@192.168.0.2>;tag=291589446
Call-ID: 93fb1e2-cd303fba92f18-6ebf2a6@192.168.0.100
CSeq: 1 INVITE
Allow: INVITE,CANCEL,ACK,BYE,NOTIFY,REFER,OPTIONS,INFO,MESSAGE,UPDATE,PRACK
Max-Forwards: 70
User-Agent: NTIL214 SIP-Test UA
Content-Type: application/protocol/sdp
Content-Length:248
Contact: <sip:1010@192.168.0.102:5060>
v=0
o=1010 1405748996 8201 IN IP4 192.168.0.102
s=SIP Implement by NTIL@NTUT
c=IN IP4 192.168.0.102
t=0 0
m=audio 19998 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
m=video 0 RTP/AVP 96
a=sendrecv
`, false},
}
for i, tt := range tests {
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
item := strings.ReplaceAll(tt.item, "\n", CRLF)
_, err := NewMessage(strings.NewReader(item))
if (err != nil) != tt.wantErr {
t.Errorf("Message error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。