简体   繁体   English

JAIN SIP:在0.0.0.0上侦听时,标识SIP消息的入站IP

[英]JAIN SIP: Identify inbound IP for SIP message when listening on 0.0.0.0

When using the JAIN SIP API, I create a ListeningPoint instance with an address of 0.0.0.0 (ie. listen on all interfaces): 使用JAIN SIP API时,我创建了一个地址为0.0.0.0的ListeningPoint实例(即,在所有接口上进行监听):

sipStack.createListeningPoint("0.0.0.0", 5060, "TCP");

Is there a way for me to identify which IP interface an incoming SIP message arrived on (in order to derive an appropriate Contact header address in the response message, amongst other uses)? 我有什么方法可以识别传入的SIP消息到达哪个IP接口(以便在响应消息中导出适当的Contact标头地址,以及其他用途)?

It's not a good idea to listen to 0.0.0.0, there are cases where the SIP stack will have to guess what address to use too and it may guess wrong. 收听0.0.0.0并不是一个好主意,在某些情况下,SIP堆栈也必须猜测要使用的地址,并且可能会猜错。 I think it's not possible to tell the address using the standard APIs, but you can almost always use private APIs from implementations. 我认为无法使用标准API来告知地址,但是您几乎总是可以使用实现中的私有API。 For example https://jsip.ci.cloudbees.com/job/jsip/javadoc/gov/nist/javax/sip/message/SIPMessage.html#getLocalAddress() 例如https://jsip.ci.cloudbees.com/job/jsip/javadoc/gov/nist/javax/sip/message/SIPMessage.html#getLocalAddress()

You can also guess by the Via headers etc. But again not a good idea. 您也可以通过Via标头等进行猜测。但同样不是一个好主意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM