[SIP01]SIP Header Fields里面各字段用途
INVITE sip:bob@biloxi.com SIP/2.0
Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bK776asdhds
Max-Forwards: 70
To: Bob <sip:bob@biloxi.com>
From: Alice <sip:alice@atlanta.com>;tag=1928301774
Call-ID: a84b4c76e66710@pc33.atlanta.com
CSeq: 314159 INVITE
Contact: <sip:alice@pc33.atlanta.com>
Content-Type: application/sdp
Content-Length: 142 (Alice’s SDP not shown)
1. Via
Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bK776asdhds
1.1 用来标识Responeses消息的返回路径(todo:各router的区别),包含SIP版本,通过的路径,branch;每个Request-Line(请求消息)路过代理Server时都会记录,然后原路返回;
1.2 用来检查路由环,因为每经过server都会把他放在via里面,每都一个Server里先检查via头里面有没有这个server如果有,出现了路由环Spiral:Alice calls Bob@example.com ,example.com 把信息传给Bob的PC,返回时又转给了Joe@example.com,这样又回到了example.com proxy上,所以这不是一个死循环【PS: 和loop不一样】;
1.3 Branch是一个事务ID(Transaction ID),用于区分同一个Client所发起的不同Transaction,它不会对未来的request 或者是response造成影响,对于遵循RFC3261规范的实现,这个branch参数的值必须用magic cookie”z9hG4bK”打头. 其它部分是对“To, From, Call-ID头域和Request-URI”按一定的算法加密后得到;
1.4 与CallID的区别:CallID是用来在session层,branch用在transation层
Call-ID contains a globally unique identifier for this call,generated by the combination of a random string and the softphone's host name or IP address. The combination of the To tag, From tag,and Call-ID completely defines a peer-to-peer SIP relationship between Alice and Bob and is referred to as a dialog.
2.Max-Forwards
Max-Forwards: 70
serves to limit the number of hops a request can make on the way to its destination. It consists of an integer that is decremented by one at each hop.
2.1 用于表示这个包最多可以传送多少跳,当Max-Forwards==0&&没到达目的地时,系统会返回483(Too many hops);一般会在有Request的包里面;
2.2 默认为70;
2.3 原理:每经过一跳时【Todo:一个代理?】都会减一向下一跳传去.
3. To
To: Bob <sip:bob@biloxi.com>
3.1 目的地的绝对地址,包含补叫的display name 和被 叫URL,&前面带的是设备号或被叫号码,&后带的是Proxy地址;
3.2 这个地址用于给Proxy们找路由的,一般会经过Proxy一步步定位到最精确的位置【改为其它精确地址】.
4. From
From: Alice <sip:alice@atlanta.com>;tag=1928301774
4.1 格式与To一样,表示Caller的绝对地址,但是会加一个Tag标签;
4.2 Tag 他是一个随机码【Todo:可不可变?】用于 identification purposes.
5. Call-ID
Call-ID: a84b4c76e66710@pc33.atlanta.com
5.1 Call-ID由本地设备(Client)生成,全局唯一,每次呼叫这个值唯一不变,与其它的session是不同的;
5.2 对于用户发出Invite消息,本地会生成From Tag 和Call-ID全局唯一码,被叫方代理生成 To tag全局唯一码,这三个随机码做为整个对话中对话标识(dialog indentifier).
6. Cseq
CSeq: 314159 INVITE
6.1 又叫Command Seqence(命令队列),每发一个新的请求,这个数就会+1,最大2*31;
6.2 用来标识命令和命令顺序,整数部用于同一session(CallID决定)中不同的请求排序,它会与将请求和应答想匹配:比如:Alice 发1 Invite 没返回--->再发 2 Invite--->没返回--->再发3 Invite--->这时返回了2 Invite就知道是第2个请求得到了响应(这个数是一直递增1的); 【因为在同一个transtation里面,所以invite其它消息都没有变化的,就用cseq来区别了】
-
Ack的CSeq:这个是与Invite里面的一样的,这使代理为非成功最终应答产生Ack时不用再建立新的CSeq,保证唯一性,只用client代理创建哦;
-
Cancel的CSeq:这个也是与Invite里面的一样的,这也是为什么CSeq里面要加Method的原因,如果不加,client就不知道这个是cancel还是invite的应答了;
以上几个字段是所有 SIP
消息体所必须的,其它头字段有些是可选的,有些在特定请求也是必须
7. Contact
Contact:
<sip:alice@pc33.atlanta.com>Contact contains a SIP or SIPS URI that represents a direct route
to contact Alice, usually composed of a username at a fully qualified
domain name (FQDN). While an FQDN is preferred, many end systems do not have
registered domain names, so IP addresses are permitted. While the Via header
field tells other elements where to send the response, the Contact header field
tells other elements where to send future requests.7.1 包含源的URI信息,用来给响应消息直接和源建立连接用;
7.2 注意和From的差别:这个是可以让被叫方Bob直接找到呼叫方的绝对地址。
8. Content-Type,Content-Length
Content-Type: application/sdp %%指明消息体的类型为SDP【Todo:
SDP会话描述协议】Content-Length: 142 %%指明消息体的字节大小
[SIP01]SIP Header Fields里面各字段用途的更多相关文章
- EntityFramework Core 1.1+ Backing Fields(返回字段)
前言 通过我发表的博文可知最近一段时间会将持续讲解EntityFramework Core特性,在此之前我提到过Backing Fields,回头翻了翻感觉写的还不够好,于是乎再来讲解一番,也是自己再 ...
- 【Azure 云服务】Azure Cloud Service 为 Web Role(IIS Host)增加自定义字段 (把HTTP Request Header中的User-Agent字段增加到IIS输出日志中)
问题描述 把Web Role服务发布到Azure Cloud Service后,需要在IIS的输出日志中,把每一个请求的HTTP Request Header中的User-Agent内容也输出到日志中 ...
- Status Code: 431 Request Header Fields Too Large
Status Code: 431 Request Header Fields Too Large
- ORM研究3 - odoo fields常用的字段属性
之前我们已经讲解了odoo ORM中的一些对字段常用的API操作方法,今天我们继续研究一下Odoo orm中字段的一些通用属性字段的使用,学会它们可以为自己创建数据映射并使用有更好的帮助. 通用字段属 ...
- FreeSWITCH协议参数之自定义sip header
一.主动发送 1. 加入sip_h_前缀 这样FreeSWITCH就能自动加上后面的扩展头. 2. 示例 <action application="set" data=&qu ...
- List of HTTP header fields
https://en.wikipedia.org/wiki/List_of_HTTP_header_fields Content-Type The MIME type of the body of t ...
- http2协议翻译(转)
超文本传输协议版本 2 IETF HTTP2草案(draft-ietf-httpbis-http2-13) 摘要 本规范描述了一种优化的超文本传输协议(HTTP).HTTP/2通过引进报头字段压缩以及 ...
- RFC3261--sip
本文转载自 http://www.ietf.org/rfc/rfc3261.txt 中文翻译可参考 http://wenku.baidu.com/view/3e59517b1711cc7931b716 ...
- TCP/IP协议族(二) HTTP报文头解析
本篇博客我们就来详细的聊一下HTTP协议的常用头部字段,当然我们将其分为请求头和响应头进行阐述.下方是报文头每个字段的格式,首先是头部字段的名称,如Accept,冒号后方紧跟的是该字段名所对应的值,每 ...
随机推荐
- 控件的WndProc WindowProc
SubClassWndProc This example shows how to use the WndProc method and the WindowProc property to subc ...
- Unity Mecanim 动画系统
1. Animator 组件 Controller:使用的Animator Controller文件. Avatar:使用的骨骼文件. Apply Root Motion:绑定该组件的GameObje ...
- etcd raft library
https://github.com/coreos/etcd/tree/master/raft import "github.com/coreos/etcd/raft" ----- ...
- mysql 错误集锦
Got fatal error 1236 from master when reading data from binary log: 'could not find next log; the fi ...
- linux安装wifi驱动,开热点
本次安装的debian系统安装的时候提示wifi硬件需要安装非自由固件才能运行,并告诉本硬件要安装的固件名字叫做iwlwifi-2030-6.ucode.是iwlwifi驱动适配我的wireless硬 ...
- Android开发实战之拥有Material Design风格的侧滑布局
在实现开发要求中,有需要会使用抽屉式布局,类似于QQ5.0的侧滑菜单,实现的方式有很多种,可以自定义控件,也可以使用第三方开源库. 同样的谷歌也推出了自己的侧滑组件——DrawLayout,使用方式也 ...
- [cogs2638]数列操作ψ(双标记线段树)
题目大意:给定一个数列a,你需要支持的操作:区间and,区间or,询问区间最大值 解题关键: 1.双标记线段树,注意优先级(超时) 当涉及多重标记时,定义出标记的优先级,修改操作时用优先级高(先下放) ...
- 保持在Div 底部的方法
<!DOCTYPE> <html> <head> <meta http-equiv="content-type" content=&quo ...
- -other linker flags - 详解
• 值:-objC,-all_load,-force_load • -objC: 在iOS 中,使用-all_load时,如果静态库中有类别时会出问题,使用其他两个值则不会有问题. • -al ...
- rtx 二次开发,查找所有部门
1>rtx二次开发操作类 using System; using System.Collections.Generic; using System.Linq; using System.Text ...