在 SIP UAC 上获取 RINGING 响应,而不从其他 UAC 发送该响应
我希望这是我关于这个 SIP 主题的最后一个问题,我已经设法克服了最后一个 问题 我通过请求朋友从远程计算机上帮助我,我能够在计算机之间进行连接,但根据说法,事情是这样的我看到的所有示例,被叫方应该调用振铃响应,但在我的应用程序案例中,我还没有实现它,但我仍然在主叫 UAC 上收到振铃响应,这是主叫端的 SIP 消息:
传出请求 5:
INVITE sip:[email protected] SIP/2.0
Contact: "Client 310" <sip:[email protected]>
From: "Client 310" <sip:[email protected]>
Max-Forwards: 32
CSeq: 2 INVITE
Call-ID: [email protected]
Allow: INVITE,CANCEL,ACK,BYE,OPTIONS
Content-Type: application/sdp
Proxy-Authorization: Digest username="310",nonce="012afffb",realm="asterisk",uri="sip:[email protected]",algorithm=MD5,response="d19ca5b98450b4be7bd4045edb8a3a2f"
Via: SIP/2.0/UDP hostName.hn:5060
To: "Client 320" <sip:[email protected]>;tag=as5a8fa200
Content-Length: 257
v=0
o=310 7108915969559970847 7108915969559970847 IN IP4 xxx.xxx.x.xxx
s=-
i=Nu-Art Software - TacB0sS VoIP information
c=IN IP4 xxx.xxx.x.xxx
m=audio 3312 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
传入响应 6:
SIP/2.0 100 Trying
Via: SIP/2.0/UDP hostName.hn:5060;branch=f8d171d3278788df9e03eb9cf3acba70-xxx.xxx.x.xxx-2-invite-hostName.hn-5060333732;received=79.181.6.233
From: "Client 310" <sip:[email protected]>
To: "Client 320" <sip:[email protected]>;tag=as5a8fa200
Call-ID: [email protected]
CSeq: 2 INVITE
User-Agent: Freeswitch 1.2.3
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO
Supported: replaces
Contact: <sip:[email protected]>
Content-Length: 0
传入响应 7:
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP hostName.hn:5060;branch=f8d171d3278788df9e03eb9cf3acba70-xxx.xxx.x.xxx-2-invite-hostName.hn-5060333732;received=79.181.6.233
From: "Client 310" <sip:[email protected]>
To: "Client 320" <sip:[email protected]>;tag=as5a8fa200
Call-ID: [email protected]
CSeq: 2 INVITE
User-Agent: Freeswitch 1.2.3
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO
Supported: replaces
Contact: <sip:[email protected]>
Content-Length: 0
调用:[电子邮件受保护] 正在响铃
传入响应 8:
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP hostName.hn:5060;branch=f8d171d3278788df9e03eb9cf3acba70-xxx.xxx.x.xxx-2-invite-hostName.hn-5060333732;received=79.181.6.233
From: "Client 310" <sip:[email protected]>
To: "Client 320" <sip:[email protected]>;tag=as5a8fa200
Call-ID: [email protected]
CSeq: 2 INVITE
User-Agent: Freeswitch 1.2.3
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO
Supported: replaces
Contact: <sip:[email protected]>
Content-Type: application/sdp
Content-Length: 264
v=0
o=root 27669 27669 IN IP4 yy.yy.yy.yy
s=session
c=IN IP4 yy.yy.yy.yy
t=0 0
m=audio 10914 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-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
传入响应 9:
SIP/2.0 503 Service Unavailable
Via: SIP/2.0/UDP hostName.hn:5060;branch=f8d171d3278788df9e03eb9cf3acba70-xxx.xxx.x.xxx-2-invite-hostName.hn-5060333732;received=79.181.6.233
From: "Client 310" <sip:[email protected]>
To: "Client 320" <sip:[email protected]>;tag=as5a8fa200
Call-ID: [email protected]
CSeq: 2 INVITE
User-Agent: Freeswitch 1.2.3
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO
Supported: replaces
Content-Length: 0
我不响应邀请,这就是所有这一切发生的原因,但如果我不是发送者,为什么我会收到铃声。
谢谢,
亚当。
更新:
如果您注意到我收到响应的时间:
传入响应 7:1275879030656 振铃
传入响应 8:1275879038734 会话进度
传入响应 9:1275879038781服务不可用
我不明白这里的逻辑,从第一个响铃到会话进度我有 8 秒,但是从从会话进度到服务不可用我有 47 毫秒?
这有什么意义呢? 50毫秒做什么?分析响应的时间 + 打开 RTP 会话的时间 + 构建响应的时间 + 构建 SDP 的时间 + 服务器接收消息所需的时间 - 503 消息到达我的 UAC 所需的时间,不是这个切割有点接近吗?我应该在什么时候响应服务器?
再次感谢 Wiz 的帮助。
I hope this would be my last question about this SIP subject, I have managed to overcome the last issue I had by asking a friend to help me from a remote computer, I'm able to connect between the computers, but here is the thing, according to all the examples I saw, the Callee should invoke the Ringing response, but in my application case I didn't implement it yet, but I still receive on the Caller UAC a Ringing response, this is the SIP messages that are on the caller end:
Outgoing Request 5:
INVITE sip:[email protected] SIP/2.0
Contact: "Client 310" <sip:[email protected]>
From: "Client 310" <sip:[email protected]>
Max-Forwards: 32
CSeq: 2 INVITE
Call-ID: [email protected]
Allow: INVITE,CANCEL,ACK,BYE,OPTIONS
Content-Type: application/sdp
Proxy-Authorization: Digest username="310",nonce="012afffb",realm="asterisk",uri="sip:[email protected]",algorithm=MD5,response="d19ca5b98450b4be7bd4045edb8a3a2f"
Via: SIP/2.0/UDP hostName.hn:5060
To: "Client 320" <sip:[email protected]>;tag=as5a8fa200
Content-Length: 257
v=0
o=310 7108915969559970847 7108915969559970847 IN IP4 xxx.xxx.x.xxx
s=-
i=Nu-Art Software - TacB0sS VoIP information
c=IN IP4 xxx.xxx.x.xxx
m=audio 3312 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
Incoming Response 6:
SIP/2.0 100 Trying
Via: SIP/2.0/UDP hostName.hn:5060;branch=f8d171d3278788df9e03eb9cf3acba70-xxx.xxx.x.xxx-2-invite-hostName.hn-5060333732;received=79.181.6.233
From: "Client 310" <sip:[email protected]>
To: "Client 320" <sip:[email protected]>;tag=as5a8fa200
Call-ID: [email protected]
CSeq: 2 INVITE
User-Agent: Freeswitch 1.2.3
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO
Supported: replaces
Contact: <sip:[email protected]>
Content-Length: 0
Incoming Response 7:
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP hostName.hn:5060;branch=f8d171d3278788df9e03eb9cf3acba70-xxx.xxx.x.xxx-2-invite-hostName.hn-5060333732;received=79.181.6.233
From: "Client 310" <sip:[email protected]>
To: "Client 320" <sip:[email protected]>;tag=as5a8fa200
Call-ID: [email protected]
CSeq: 2 INVITE
User-Agent: Freeswitch 1.2.3
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO
Supported: replaces
Contact: <sip:[email protected]>
Content-Length: 0
Call to: [email protected] is Ringing
Incoming Response 8:
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP hostName.hn:5060;branch=f8d171d3278788df9e03eb9cf3acba70-xxx.xxx.x.xxx-2-invite-hostName.hn-5060333732;received=79.181.6.233
From: "Client 310" <sip:[email protected]>
To: "Client 320" <sip:[email protected]>;tag=as5a8fa200
Call-ID: [email protected]
CSeq: 2 INVITE
User-Agent: Freeswitch 1.2.3
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO
Supported: replaces
Contact: <sip:[email protected]>
Content-Type: application/sdp
Content-Length: 264
v=0
o=root 27669 27669 IN IP4 yy.yy.yy.yy
s=session
c=IN IP4 yy.yy.yy.yy
t=0 0
m=audio 10914 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-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
Incoming Response 9:
SIP/2.0 503 Service Unavailable
Via: SIP/2.0/UDP hostName.hn:5060;branch=f8d171d3278788df9e03eb9cf3acba70-xxx.xxx.x.xxx-2-invite-hostName.hn-5060333732;received=79.181.6.233
From: "Client 310" <sip:[email protected]>
To: "Client 320" <sip:[email protected]>;tag=as5a8fa200
Call-ID: [email protected]
CSeq: 2 INVITE
User-Agent: Freeswitch 1.2.3
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO
Supported: replaces
Content-Length: 0
I do not respond to the invite, that is why all this is happening, but why am I getting a ringing if I'm not the one sending it.
Thanks,
Adam.
Update:
If you will notice the times that I get the responses:
Incoming Response 7: 1275879030656 Ringing
Incoming Response 8: 1275879038734 Session Progress
Incoming Response 9: 1275879038781 Service Unavailable
I don't understand the logic here, I have 8 sec from the first Ringing to the session progress, but from the Session Progress to the Service Unavailable I have 47ms?
How does this makes sense? 50 ms to do what? time to analyze the response + time to open an RTP session + time to construct a response + time to construct SDP + time it takes the server to receive the message - the time it takes the 503 message to arrive to my UAC, isn't this cutting little close? at which point am I suppose to response to the server?
Thanks again for all your help Wiz.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因为您调用的 FreeSwitch 服务器是 B2BUA 并且必须配置为生成独立于转接的呼叫线路进行回铃。如果您呼叫的服务器是不具备 B2BUA 功能的 SIP 代理,则在远端的 SIP 设备响应之前,您不会收到任何振铃或其他响应。
响应 7 和 8 将使您的软件电话响起。对于响应 7、180 Ringing,由您的软件电话生成提示音。对于使用 RTP 的响应 8, 183 会话进度,您的软件电话将从 FreeSwitch 服务器收到应呈现的进度指示。
更新:您所看到的时间安排再次归咎于您向 B2BUA 发出呼叫(在本例中为 FreeSwitch)。看起来它被配置为在收到新呼叫时自动发送振铃响应,同时它正在处理其拨号计划以计算出如何处理该呼叫。在该拨号计划中的某个位置似乎有一个命令来指示会话进度,这是 183 响应出现的地方,但随后它必须到达拨号计划的末尾或遇到导致 503 响应的错误。
如果您直接与无人机通信,则不太可能得到相同的响应模式。
呼叫端(您充当 UAC)所需的唯一操作是确认最终响应,在本例中为 503。您的 SIP 堆栈确实需要对 180 和 183 响应执行某些操作,以让用户知道发生了什么,但您不需要对它们做出响应,因为它们是所谓的信息响应,而 UAS 不希望对它们做出响应。实际上,SIP 标准有一个增强功能,用于处理临时响应的可靠处理,但它是可选的,如果我是您,我现在不会担心它。
Because the FreeSwitch server you are calling is a B2BUA and must be configured to generate ring back independently of the forwarded call leg. If the server you were calling was a SIP Proxy without B2BUA capabilities you would not get any ringing or other reponses until the SIP device at the far end responded.
Responses 7 and 8 will cause your softphone to ring. For response 7, 180 Ringing, it's up to your softphone to generate the tone. For response 8, 183 Session Progress with RTP, your softphone will receive a progress indication from the FreeSwitch server that it should be rendering.
Update: The reason for the timings you're seeing are again down to the fact that you're placing the call to a B2BUA, in this case FreeSwitch. It looks like it's configured to send a Ringing response automatically when a new call is received and in the meantime it is processing its dialplan to work out what to do with the call. Somewhere in that dialplan there appears to be a command to indicate session progress which is where the 183 response comes in but then it must get to the end of the dialplan or encounter an error which results in the 503 response.
It's unlikely you would get the same pattern of responses if you were communicating directly to a UAS.
The only action required from your end of the call, you are acting as the UAC, is to ACK the final response, in this case the 503. Your SIP stack does need to do something with the 180 and 183 responses to let the user know what's happening but you don't need to respond to them as they are what's called informational responses and the UAS doesn't want a response to them. There actually is an enhancement to the SIP standard dealing with reliable processing of provisional responses but it's optional and I wouldn't worry about it at this point if I was you.