file-type

探索Go语言编写的SIP UA库:client/b2bua与WebRTC集成

下载需积分: 50 | 60KB | 更新于2025-09-05 | 189 浏览量 | 2 下载量 举报 收藏
download 立即下载
标题和描述中所涉及的知识点详细说明: 1. Go-Sip-UA 库简介 Go-Sip-UA是一个使用Go语言编写的SIP用户代理库,它能够实现客户端(Client)和业务到业务的用户代理(B2BUA,Business-to-Business User Agent)的功能。SIP(Session Initiation Protocol)是一种应用层控制(信令)协议,用于创建、修改以及终止包括互联网电话、视频会议、即时通信、在线游戏和社交媒体在内的多媒体会话。 2. Go-Sip-UA 功能特点 - 支持多种传输协议:UDP、TCP、TLS、WebSocket(WS)和安全WebSocket(WSS)。 - 提供纯Go编写的简单SIP客户端,方便进行SIP会话的初始化和管理。 - 纯Go编写的简单B2BUA,支持最新SIP扩展RFC8599,并且兼容Google的FCM和Apple的PushKit,实现推送通知功能。 - RTP中继功能,可以将网络中不同的RTP流(例如UDP到UDP,WebRTC/ICE到UDP)进行中继,使得媒体流可以在不同的网络环境和协议之间传输。 - WebRTC2SIP网关,实现了WebRTC(一种支持网页浏览器进行实时语音对话或视频对话的API)与传统SIP协议之间的桥接,使得现代网页应用能够与传统SIP设备或者服务器通信。 3. 运行示例说明 文档给出了如何获取和运行Go-Sip-UA库的具体步骤: - 首先通过git clone命令从GitHub上克隆Go-Sip-UA的仓库到本地。 - 进入到克隆的仓库目录。 - 通过go run命令运行提供的客户端示例,该命令会执行examples/client/main.go文件中的代码。 - 如果需要运行B2BUA示例,文档未具体说明,但通常需要运行对应的示例代码。 4. B2BUA(业务到业务的用户代理)简介 B2BUA是SIP网络中的一个组件,可以注册和处理SIP呼叫请求,提供呼叫交换功能。它在两个SIP终端之间起到中介的作用,能够实现呼叫路由、媒体协商、呼叫计费等多种复杂功能。B2BUA最小化部署时可支持UDP、TCP、TLS、WebSocket等传输层协议,并能够快速地对TLS/WSS(WebSocket Secure)进行配置和使用。 5. 标签意义解析 - golang:表明Go-Sip-UA库是用Go语言(也称Golang)开发的。 - sip:明确该库与SIP协议相关。 - webrtc:指出库中还涉及到了WebRTC技术。 - sdp:SIP使用会话描述协议(Session Description Protocol, SDP)来交换媒体信息,表明该库支持相关的媒体协商功能。 - voip:强调该库可用于构建VoIP(Voice over Internet Protocol)应用。 - ippbx:提示该库可能适用于IP PBX(私有分支交换机)场景。 - b2bua:直接指出该库实现了B2BUA的功能。 - rfc8599:表示该库遵循了RFC8599标准,该标准定义了SIP相关的扩展功能。 - Go:Go语言的另一种简写形式。 6. 压缩包子文件的文件名称列表 - go-sip-ua-master:这表明了从GitHub克隆的Go-Sip-UA库的压缩包文件名为“go-sip-ua-master”,即这个压缩包里面包含了Go-Sip-UA库的全部源代码文件。 以上知识点展现了Go-Sip-UA库在SIP应用开发中的作用与优势,以及如何在实际项目中使用该库进行开发。开发者可以根据这些信息,评估是否将Go-Sip-UA作为开发SIP或WebRTC应用的工具,以及如何快速上手使用。

相关推荐

filetype

[email protected]> recv 1026 bytes from udp/[183.227.181.232]:1864 at 09:19:10.523919: ------------------------------------------------------------------------ INVITE sip:[email protected]:5080 SIP/2.0 Via: SIP/2.0/UDP 10.168.1.102:59028;branch=z9hG4bK-d87543-b7678846ac1d547d-1--d87543-;rport Max-Forwards: 70 Contact: <sip:[email protected]:1864> To: "18996228654"<sip:[email protected]:5080> From: "03512332064"<sip:[email protected]:5080>;tag=842b1e78 Call-ID: M2ZiZDEzZTk3ZTZmMDBmNDFkYTg1NDNhM2I5MDk4NWI. CSeq: 1 INVITE Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO Content-Type: application/sdp User-Agent: eyeBeam release 1011d stamp 40820 Content-Length: 435 v=0 o=- 8 2 IN IP4 10.168.1.102 s=CounterPath eyeBeam 1.5 c=IN IP4 10.168.1.102 t=0 0 m=audio 15344 RTP/AVP 0 8 18 101 a=alt:1 3 : 0E+mq1nU hFt+pKdF 172.28.16.1 15344 a=alt:2 2 : 65/yrvXK tFeCv5wr 172.17.144.1 15344 a=alt:3 1 : dKt7HfUt 78IDBaMu 10.168.1.102 15344 a=fmtp:18 annexb=no a=fmtp:101 0-15 a=rtpmap:18 G729/8000 a=rtpmap:101 telephone-event/8000 a=sendrecv a=x-rtp-session-id:02EC42FF7A2C4B7B91C41D4000CC93D6 2025-07-19 09:19:10.517138 100.00% [NOTICE] switch_channel.c:1142 New Channel sofia/external/[email protected]:5080 [4bd59857-2eb6-4470-987d-446b63d19f14] 2025-07-19 09:19:10.517138 100.00% [INFO] sofia.c:10460 sofia/external/[email protected]:5080 receiving invite from 183.227.181.232:1864 version: 1.10.12-release git a88d069 2024-08-02 21:02:27Z 64bit call-id: M2ZiZDEzZTk3ZTZmMDBmNDFkYTg1NDNhM2I5MDk4NWI. 2025-07-19 09:19:10.517138 100.00% [INFO] mod_dialplan_xml.c:639 Processing 03512332064 <03512332064>->18996228654 in context public send 448 bytes to udp/[183.227.181.232]:1864 at 09:19:10.526257: ------------------------------------------------------------------------ SIP/2.0 100 Trying Via: SIP/2.0/UDP 10.168.1.102:59028;branch=z9hG4bK-d87543-b7678846ac1d547d-1--d87543-;rport=1864;received=183.227.181.232 From: "03512332064"<sip:[email protected]:5080>;tag=842b1e78 To: "18996228654"<sip:[email protected]:5080> Call-ID: M2ZiZDEzZTk3ZTZmMDBmNDFkYTg1NDNhM2I5MDk4NWI. CSeq: 1 INVITE User-Agent: FreeSWITCH-mod_sofia/1.10.12-release+git~20240802T210227Z~a88d069d6f~64bit Content-Length: 0 EXECUTE [depth=0] sofia/external/[email protected]:5080 set(outside_call=true) EXECUTE [depth=0] sofia/external/[email protected]:5080 export(RFC2822_DATE=Sat, 19 Jul 2025 09:19:10 +0800) EXECUTE [depth=0] sofia/external/[email protected]:5080 log(INFO Calling outbound number: 18996228654) 2025-07-19 09:19:10.517138 100.00% [INFO] mod_dptools.c:1865 Calling outbound number: 18996228654 EXECUTE [depth=0] sofia/external/[email protected]:5080 bridge(sofia/gateway/121_40_149_63_6086/18996228654) 2025-07-19 09:19:10.517138 100.00% [NOTICE] switch_channel.c:1142 New Channel sofia/external/18996228654 [35bf0415-4fe3-4206-8d41-eda1d8e43604] 2025-07-19 09:19:10.517138 100.00% [INFO] sofia_glue.c:1659 sofia/external/18996228654 sending invite call-id: (null) send 1145 bytes to udp/[121.40.149.63]:6086 at 09:19:10.529992: ------------------------------------------------------------------------ INVITE sip:[email protected]:6086 SIP/2.0 Via: SIP/2.0/UDP 27.25.152.174:5080;rport;branch=z9hG4bKF27pv3mFS6p9g Max-Forwards: 69 From: "03512332064" <sip:[email protected]>;tag=pa6eaSDe6Xyej To: <sip:[email protected]:6086> Call-ID: 3718d4b7-dee1-123e-558e-246e963b2e1c CSeq: 101890183 INVITE Contact: <sip:[email protected]:5080;transport=udp;gw=121_40_149_63_6086> User-Agent: FreeSWITCH-mod_sofia/1.10.12-release+git~20240802T210227Z~a88d069d6f~64bit Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY Supported: timer, path, replaces Allow-Events: talk, hold, conference, refer Content-Type: application/sdp Content-Disposition: session Content-Length: 246 X-FS-Support: update_display,send_info Remote-Party-ID: "03512332064" <sip:[email protected]>;party=calling;screen=yes;privacy=off v=0 o=FreeSWITCH 1752856774 1752856775 IN IP4 27.25.152.174 s=FreeSWITCH c=IN IP4 27.25.152.174 t=0 0 m=audio 31176 RTP/AVP 0 8 101 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-15 a=ptime:20 send 1145 bytes to udp/[121.40.149.63]:6086 at 09:19:11.530080: ------------------------------------------------------------------------ INVITE sip:[email protected]:6086 SIP/2.0 Via: SIP/2.0/UDP 27.25.152.174:5080;rport;branch=z9hG4bKF27pv3mFS6p9g Max-Forwards: 69 From: "03512332064" <sip:[email protected]>;tag=pa6eaSDe6Xyej To: <sip:[email protected]:6086> Call-ID: 3718d4b7-dee1-123e-558e-246e963b2e1c CSeq: 101890183 INVITE Contact: <sip:[email protected]:5080;transport=udp;gw=121_40_149_63_6086> User-Agent: FreeSWITCH-mod_sofia/1.10.12-release+git~20240802T210227Z~a88d069d6f~64bit Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY Supported: timer, path, replaces Allow-Events: talk, hold, conference, refer Content-Type: application/sdp Content-Disposition: session Content-Length: 246 X-FS-Support: update_display,send_info Remote-Party-ID: "03512332064" <sip:[email protected]>;party=calling;screen=yes;privacy=off v=0 o=FreeSWITCH 1752856774 1752856775 IN IP4 27.25.152.174 s=FreeSWITCH c=IN IP4 27.25.152.174 t=0 0 m=audio 31176 RTP/AVP 0 8 101 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-15 a=ptime:20 send 1145 bytes to udp/[121.40.149.63]:6086 at 09:19:13.530314: ------------------------------------------------------------------------ INVITE sip:[email protected]:6086 SIP/2.0 Via: SIP/2.0/UDP 27.25.152.174:5080;rport;branch=z9hG4bKF27pv3mFS6p9g Max-Forwards: 69 From: "03512332064" <sip:[email protected]>;tag=pa6eaSDe6Xyej To: <sip:[email protected]:6086> Call-ID: 3718d4b7-dee1-123e-558e-246e963b2e1c CSeq: 101890183 INVITE Contact: <sip:[email protected]:5080;transport=udp;gw=121_40_149_63_6086> User-Agent: FreeSWITCH-mod_sofia/1.10.12-release+git~20240802T210227Z~a88d069d6f~64bit Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY Supported: timer, path, replaces Allow-Events: talk, hold, conference, refer Content-Type: application/sdp Content-Disposition: session Content-Length: 246 X-FS-Support: update_display,send_info Remote-Party-ID: "03512332064" <sip:[email protected]>;party=calling;screen=yes;privacy=off v=0 o=FreeSWITCH 1752856774 1752856775 IN IP4 27.25.152.174 s=FreeSWITCH c=IN IP4 27.25.152.174 t=0 0 m=audio 31176 RTP/AVP 0 8 101 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-15 a=ptime:20 send 1145 bytes to udp/[121.40.149.63]:6086 at 09:19:17.530507: ------------------------------------------------------------------------ INVITE sip:[email protected]:6086 SIP/2.0 Via: SIP/2.0/UDP 27.25.152.174:5080;rport;branch=z9hG4bKF27pv3mFS6p9g Max-Forwards: 69 From: "03512332064" <sip:[email protected]>;tag=pa6eaSDe6Xyej To: <sip:[email protected]:6086> Call-ID: 3718d4b7-dee1-123e-558e-246e963b2e1c CSeq: 101890183 INVITE Contact: <sip:[email protected]:5080;transport=udp;gw=121_40_149_63_6086> User-Agent: FreeSWITCH-mod_sofia/1.10.12-release+git~20240802T210227Z~a88d069d6f~64bit Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY Supported: timer, path, replaces Allow-Events: talk, hold, conference, refer Content-Type: application/sdp Content-Disposition: session Content-Length: 246 X-FS-Support: update_display,send_info Remote-Party-ID: "03512332064" <sip:[email protected]>;party=calling;screen=yes;privacy=off v=0 o=FreeSWITCH 1752856774 1752856775 IN IP4 27.25.152.174 s=FreeSWITCH c=IN IP4 27.25.152.174 t=0 0 m=audio 31176 RTP/AVP 0 8 101 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-15 a=ptime:20 send 1145 bytes to udp/[121.40.149.63]:6086 at 09:19:25.531945: ------------------------------------------------------------------------ INVITE sip:[email protected]:6086 SIP/2.0 Via: SIP/2.0/UDP 27.25.152.174:5080;rport;branch=z9hG4bKF27pv3mFS6p9g Max-Forwards: 69 From: "03512332064" <sip:[email protected]>;tag=pa6eaSDe6Xyej To: <sip:[email protected]:6086> Call-ID: 3718d4b7-dee1-123e-558e-246e963b2e1c CSeq: 101890183 INVITE Contact: <sip:[email protected]:5080;transport=udp;gw=121_40_149_63_6086> User-Agent: FreeSWITCH-mod_sofia/1.10.12-release+git~20240802T210227Z~a88d069d6f~64bit Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY Supported: timer, path, replaces Allow-Events: talk, hold, conference, refer Content-Type: application/sdp Content-Disposition: session Content-Length: 246 X-FS-Support: update_display,send_info Remote-Party-ID: "03512332064" <sip:[email protected]>;party=calling;screen=yes;privacy=off v=0 o=FreeSWITCH 1752856774 1752856775 IN IP4 27.25.152.174 s=FreeSWITCH c=IN IP4 27.25.152.174 t=0 0 m=audio 31176 RTP/AVP 0 8 101 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-15 a=ptime:20 send 1145 bytes to udp/[121.40.149.63]:6086 at 09:19:41.532767: ------------------------------------------------------------------------ INVITE sip:[email protected]:6086 SIP/2.0 Via: SIP/2.0/UDP 27.25.152.174:5080;rport;branch=z9hG4bKF27pv3mFS6p9g Max-Forwards: 69 From: "03512332064" <sip:[email protected]>;tag=pa6eaSDe6Xyej To: <sip:[email protected]:6086> Call-ID: 3718d4b7-dee1-123e-558e-246e963b2e1c CSeq: 101890183 INVITE Contact: <sip:[email protected]:5080;transport=udp;gw=121_40_149_63_6086> User-Agent: FreeSWITCH-mod_sofia/1.10.12-release+git~20240802T210227Z~a88d069d6f~64bit Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY Supported: timer, path, replaces Allow-Events: talk, hold, conference, refer Content-Type: application/sdp Content-Disposition: session Content-Length: 246 X-FS-Support: update_display,send_info Remote-Party-ID: "03512332064" <sip:[email protected]>;party=calling;screen=yes;privacy=off v=0 o=FreeSWITCH 1752856774 1752856775 IN IP4 27.25.152.174 s=FreeSWITCH c=IN IP4 27.25.152.174 t=0 0 m=audio 31176 RTP/AVP 0 8 101 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-15 a=ptime:20 2025-07-19 09:19:42.517142 100.00% [NOTICE] sofia.c:8736 Hangup sofia/external/18996228654 [CS_CONSUME_MEDIA] [RECOVERY_ON_TIMER_EXPIRE] 2025-07-19 09:19:42.537141 100.00% [NOTICE] switch_core_session.c:1762 Session 6 (sofia/external/18996228654) Ended 2025-07-19 09:19:42.537141 100.00% [NOTICE] switch_core_session.c:1766 Close Channel sofia/external/18996228654 [CS_DESTROY] 2025-07-19 09:19:42.537141 100.00% [INFO] mod_dptools.c:3635 Originate Failed. Cause: RECOVERY_ON_TIMER_EXPIRE 2025-07-19 09:19:42.537141 100.00% [NOTICE] switch_channel.c:5012 Hangup sofia/external/[email protected]:5080 [CS_EXECUTE] [RECOVERY_ON_TIMER_EXPIRE] send 845 bytes to udp/[183.227.181.232]:1864 at 09:19:42.544835: ------------------------------------------------------------------------ SIP/2.0 408 Request Timeout Via: SIP/2.0/UDP 10.168.1.102:59028;branch=z9hG4bK-d87543-b7678846ac1d547d-1--d87543-;rport=1864;received=183.227.181.232 Max-Forwards: 70 From: "03512332064"<sip:[email protected]:5080>;tag=842b1e78 To: "18996228654" <sip:[email protected]:5080>;tag=N1cp8Xva9m8Up Call-ID: M2ZiZDEzZTk3ZTZmMDBmNDFkYTg1NDNhM2I5MDk4NWI. CSeq: 1 INVITE User-Agent: FreeSWITCH-mod_sofia/1.10.12-release+git~20240802T210227Z~a88d069d6f~64bit Accept: application/sdp Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY Supported: timer, path, replaces Allow-Events: talk, hold, conference, refer Reason: Q.850;cause=102;text="RECOVERY_ON_TIMER_EXPIRE" Content-Length: 0 Remote-Party-ID: "18996228654" <sip:[email protected]>;party=calling;privacy=off;screen=no 2025-07-19 09:19:42.537141 100.00% [NOTICE] switch_core_session.c:1762 Session 5 (sofia/external/[email protected]:5080) Ended 2025-07-19 09:19:42.537141 100.00% [NOTICE] switch_core_session.c:1766 Close Channel sofia/external/[email protected]:5080 [CS_DESTROY] recv 374 bytes from udp/[183.227.181.232]:1864 at 09:19:42.577655: ------------------------------------------------------------------------ ACK sip:[email protected]:5080 SIP/2.0 Via: SIP/2.0/UDP 10.168.1.102:59028;branch=z9hG4bK-d87543-b7678846ac1d547d-1--d87543-;rport To: "18996228654" <sip:[email protected]:5080>;tag=N1cp8Xva9m8Up From: "03512332064"<sip:[email protected]:5080>;tag=842b1e78 Call-ID: M2ZiZDEzZTk3ZTZmMDBmNDFkYTg1NDNhM2I5MDk4NWI. CSeq: 1 ACK Content-Length: 0

ywnwx
  • 粉丝: 38
上传资源 快速赚钱