国标 invite请求的log分析

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了国标 invite请求的log分析相关的知识,希望对你有一定的参考价值。

参考技术A

设备:内网若干层拓扑结构
UAC:192.168.112.101 出口ip122.5.23.114
平台:云服务器上搭建的LiveGBS试用版
UAS:192.169.1.118 出口ip119.3.126.75:15060

源设备代表主动发起会话的一方, 目标设备代表最终响应会话的一方
源域名 :发起会话一方的域名
目的域名: 响应会话一方的域名
SipProvider: Recv <<<<<<<<<<<<<<<<<<<<<<<<<
SipProvider: SipProvider: Received new SIP message:
SipProvider: INVITE sip:34020000001310000001@3402000000 SIP/2.0 ---> 邀请流发送者id@目的域名或ip端口
SipProvider: Via: SIP/2.0/UDP 119.3.126.75:15060;rport;branch=z9hG4bK321405847 ---> via: 源域名或ip
SipProvider: From: sip:34020000002000000001@3402000000 ;tag=804405847 --- 流接受者@源域名
SipProvider: To: sip:34020000001310000001@3402000000 ---- to流发送者@目的域名
SipProvider: Call-ID: 367405846
SipProvider: CSeq: 1020 INVITE
SipProvider: Content-Type: APPLICATION/SDP
SipProvider: Contact: sip:34020000002000000001@119.3.126.75:15060 ---> 流接受者@源ip 端口
SipProvider: Max-Forwards: 70
SipProvider: User-Agent: LiveGBS v200821
SipProvider: Subject: 34020000001310000001:0200000001,34020000002020000001:0
SipProvider: Content-Length: 259
SipProvider:
SipProvider: v=0
SipProvider: o=34020000002000000001 0 0 IN IP4 119.3.126.75 ---------流媒体服务器地址
SipProvider: s=Play
SipProvider: c=IN IP4 119.3.126.75 ----------- 流媒体服务器地址
SipProvider: t=0 0
SipProvider: m=video 30028 TCP/RTP/AVP 96 97 98
SipProvider: a=recvonly
SipProvider: a=rtpmap:96 PS/90000
SipProvider: a=rtpmap:97 MPEG4/90000
SipProvider: a=rtpmap:98 H264/90000
SipProvider: a=setup:passive
SipProvider: a=connection:new
SipProvider: y=0200000001
SipProvider:

分析:

SIP/2.0 200 OK
Via: SIP/2.0/UDP 119.3.126.75:15060;branch=z9hG4bK321405847;rport=15060
To: sip:34020000001310000001@3402000000 ;tag=a85e371c4d077bf2
From: sip:34020000002000000001@3402000000 ;tag=804405847
Call-ID: 367405846
CSeq: 1020 INVITE
Contact: sip:34020000001110000001@122.5.23.114:49048
Server: DT50
Content-Length: 211
Content-Type: Application/SDP

v=0
o=34020000001110000001@3402000000 0 0 IN IP4 192.168.112.101
s=Play
u=
c=IN IP4 192.168.112.101
t=0 0
m=video 30028 RTP/AVP 96
a=rtpmap:96 PS/90000
a=sendonly
y=0200000001
f=v/2/5/25/1/60000a///

分析:
当前200Ok是INVITE的确认
Via:源域名或者ip地址, invite是UAS发起的,所以这里是服务器
From,to 都是从invite里面复制过来的
From是invite来自于 服务器id@源域名
To是invite要到媒体发送者@目的域名
Contact是媒体发送者编码@目的域名或ip端口

SipProvider:
SipProvider: Recv <<<<<<<<<<<<<<<<<<<<<<<<<
SipProvider: SipProvider: Received new SIP message:
SipProvider: ACK sip:34020000001310000001@3402000000 SIP/2.0
SipProvider: Via: SIP/2.0/UDP 119.3.126.75:15060;rport;branch=z9hG4bK9240613
SipProvider: From: sip:34020000002000000001@3402000000 ;tag=804405847
SipProvider: To: sip:34020000001310000001@3402000000 ;tag=a85e371c4d077bf2
SipProvider: Call-ID: 367405846
SipProvider: CSeq: 1020 ACK
SipProvider: Contact: sip:34020000002000000001@119.3.126.75:15060
SipProvider: Max-Forwards: 70
SipProvider: User-Agent: LiveGBS v200821
SipProvider: Content-Length: 0

ACKsip: 媒体服务器编码@目的域名或IP 地址端口SIP/2.0
ACKsip: 媒体流发送者设备编码@目的域名或IP 地址端口SIP/2.0
From还是源,会话发起一方。
To还是目的设备,响应会话一方

RestTemplate的使用

1、get请求带Cookie

String url = Config.XXX_BASE_URL + "/userlevel?inviterId=" + invit1;
String restInfo = MessageFormat.format("url:{0}, inviterId:{1}", url, invit1);
UtilFunctions.log.info("UserController#register call rest api info, " + restInfo);

HttpHeaders requestHeaders = new HttpHeaders();
List<String> cookieList = UtilFunctions.getCookieList(request);
requestHeaders.put("Cookie", cookieList);
HttpEntity<String> requestEntity = new HttpEntity<String>(null, requestHeaders);
restTemplate.exchange(url, HttpMethod.GET, requestEntity, JSONObject.class).getBody();
public static List<String> getCookieList(HttpServletRequest request) {
    List<String> cookieList = new ArrayList<>();
    
    Cookie[] cookies = request.getCookies();
    if (cookies == null || cookies.length == 0) {
        return cookieList;
    }

    for (Cookie cookie : cookies) {
        cookieList.add(cookie.getName() + "=" + cookie.getValue());
    }
    
    return cookieList;
}

 

以上是关于国标 invite请求的log分析的主要内容,如果未能解决你的问题,请参考以下文章

sip消息 sip请求

SIP Timer

SIP的常用消息

fb:chat-invite 的问题

SIP消息

client.accept_invite 不起作用,帐户尝试加入但它只是挂起