首页 > 代码库 > 注册(十) 重注册没有带鉴权信息

注册(十) 重注册没有带鉴权信息

REGISTER sip:ims1.fj.chinamobile.com SIP/2.0
From: "+865939008841"<sip:+865939008841@ims1.fj.chinamobile.com>;tag=8603f0-c0a80b3e-13c4-374-1f209932-374;user=phone
To: "+865939008841"<sip:+865939008841@ims1.fj.chinamobile.com>;user=phone
Call-ID: 8ae9f0-c0a80b3e-13c4-34-6e7e1fdc-34
CSeq: 13 REGISTER
Via: SIP/2.0/UDP 192.168.11.62:5060;branch=z9hG4bK-374-d7fea-2000dcd3
Allow: INVITE,ACK,CANCEL,BYE,REGISTER,REFER,NOTIFY,PRACK,CANCEL,SUBSCRIBE,OPTIONS,INFO,UPDATE
Max-Forwards: 70
Supported: 100rel,replaces,timer
Contact: <sip:+865939008841@192.168.11.62:5060>
Expires: 120
Content-Length: 0


(1)UAC向UAS端发起注册请求


SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.11.62:5060;branch=z9hG4bK-374-d7fea-2000dcd3
To: "+865939008841"<sip:+865939008841@ims1.fj.chinamobile.com>;tag=ztesipURAfluCoiBj4R96kd*1-3-16648*jadg.1;user=phone
From: "+865939008841"<sip:+865939008841@ims1.fj.chinamobile.com>;tag=8603f0-c0a80b3e-13c4-374-1f209932-374;user=phone
Call-ID: 8ae9f0-c0a80b3e-13c4-34-6e7e1fdc-34
CSeq: 13 REGISTER
Content-Length: 0
WWW-Authenticate: **********


(2)UAS对UAC发出的注册请求回401,告诉UAC,发注册请求的时候需要带上鉴权信息


REGISTER sip:ims1.fj.chinamobile.com SIP/2.0
From: "+865939008841"<sip:+865939008841@ims1.fj.chinamobile.com>;tag=8603f0-c0a80b3e-13c4-374-1f209932-374;user=phone
To: "+865939008841"<sip:+865939008841@ims1.fj.chinamobile.com>;user=phone
Call-ID: 8ae9f0-c0a80b3e-13c4-34-6e7e1fdc-34
CSeq: 14 REGISTER
Via: SIP/2.0/UDP 192.168.11.62:5060;branch=z9hG4bK-374-d804f-724f8e76
Max-Forwards: 70
Supported: 100rel,replaces,timer
Contact: <sip:+865939008841@192.168.11.62:5060>
Expires: 120
Authorization: *******************
Content-Length: 0


(3)UAC重新向UAS发起带鉴权的注册请求


SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.11.62:5060;branch=z9hG4bK-374-d804f-724f8e76
To: "+865939008841"<sip:+865939008841@ims1.fj.chinamobile.com>;tag=ztesipYyIcyPP9U2eyP5FyYh*1-3-16640*jadj.1;user=phone
From: "+865939008841"<sip:+865939008841@ims1.fj.chinamobile.com>;tag=8603f0-c0a80b3e-13c4-374-1f209932-374;user=phone
Call-ID: 8ae9f0-c0a80b3e-13c4-34-6e7e1fdc-34
CSeq: 14 REGISTER
Contact: <sip:+865939008841@192.168.11.62:5060>;expires=120
Content-Length: 0


(4)UAS对注册请求验证通过,回复200 OK,告诉UAC注册成功


REGISTER sip:ims1.fj.chinamobile.com SIP/2.0
From: "+865939008841"<sip:+865939008841@ims1.fj.chinamobile.com>;tag=861d40-c0a80b3e-13c4-3b1-7474b8a4-3b1;user=phone
To: "+865939008841"<sip:+865939008841@ims1.fj.chinamobile.com>;user=phone
Call-ID: 8ae9f0-c0a80b3e-13c4-34-6e7e1fdc-34
CSeq: 15 REGISTER
Via: SIP/2.0/UDP 192.168.11.62:5060;branch=z9hG4bK-3b1-e6b75-39afd526
Allow: INVITE,ACK,CANCEL,BYE,REGISTER,REFER,NOTIFY,PRACK,CANCEL,SUBSCRIBE,OPTIONS,INFO,UPDATE
Max-Forwards: 70
Supported: 100rel,replaces,timer
Contact: <sip:+865939008841@192.168.11.62:5060>
Expires: 120
Content-Length: 0

(5)UAC的注册时间快到期时(200 OK中的expires值,表示注册有效期),重新发起注册请求,该注册请求就是重注册消息,并且没有带鉴权信息


SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.11.62:5060;branch=z9hG4bK-3b1-e6b75-39afd526
To: "+865939008841"<sip:+865939008841@ims1.fj.chinamobile.com>;tag=ztesipjMILOUE2AvXMyb4KtVr3i27F*1-3-16648*jafa.1;user=phone
From: "+865939008841"<sip:+865939008841@ims1.fj.chinamobile.com>;tag=861d40-c0a80b3e-13c4-3b1-7474b8a4-3b1;user=phone
Call-ID: 8ae9f0-c0a80b3e-13c4-34-6e7e1fdc-34
CSeq: 15 REGISTER
Content-Length: 0
WWW-Authenticate: **********


(6)UAS对UAC发出的注册请求回401,告诉UAC,发注册请求的时候需要带上鉴权信息


REGISTER sip:ims1.fj.chinamobile.com SIP/2.0
From: "+865939008841"<sip:+865939008841@ims1.fj.chinamobile.com>;tag=861d40-c0a80b3e-13c4-3b1-7474b8a4-3b1;user=phone
To: "+865939008841"<sip:+865939008841@ims1.fj.chinamobile.com>;user=phone
Call-ID: 8ae9f0-c0a80b3e-13c4-34-6e7e1fdc-34
CSeq: 16 REGISTER
Via: SIP/2.0/UDP 192.168.11.62:5060;branch=z9hG4bK-3b1-e6c15-7b8886ba
Max-Forwards: 70
Supported: 100rel,replaces,timer
Contact: <sip:+865939008841@192.168.11.62:5060>
Expires: 120
Authorization: *****************
Content-Length: 0


(7)UAC重新向UAS发起带鉴权的注册请求


SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.11.62:5060;branch=z9hG4bK-3b1-e6c15-7b8886ba
To: "+865939008841"<sip:+865939008841@ims1.fj.chinamobile.com>;tag=ztesiplXtFtE6q1kQZpceBVvUXXjPd*1-3-16640*jafe.1;user=phone
From: "+865939008841"<sip:+865939008841@ims1.fj.chinamobile.com>;tag=861d40-c0a80b3e-13c4-3b1-7474b8a4-3b1;user=phone
Call-ID: 8ae9f0-c0a80b3e-13c4-34-6e7e1fdc-34
CSeq: 16 REGISTER
Contact: <sip:+865939008841@192.168.11.62:5060>;expires=120
P-Associated-URI: <sip:+865939008841@ims1.fj.chinamobile.com>
P-Associated-URI: <tel:+865939008841>
Content-Length: 0

(8)UAS对注册请求验证通过,回复200 OK,告诉UAC注册刷新成功

(9)当注册的时间再一次快到期时,重复(5)-(8)步骤来刷新注册有效期