[英]Java SIP client like present in android
My requirement is to do a SIP registration using java servlet and then make an audio call. 我的要求是使用Java Servlet进行SIP注册,然后进行音频呼叫。 In android i have found simple way to do Android Supporting SIP however i am not able use same android code in java since SIP manager class is present in android.net packages.
在android中,我找到了一种简单的方法来实现支持SIP的Android,但是由于android.net包中存在SIP管理器类,因此我无法在java中使用相同的android代码。 What should i use for my users to do SIP registration in java servlet.
我应该为我的用户使用什么在java servlet中进行SIP注册。
below is android code 下面是android代码
if (sipManager == null) {
sipManager = SipManager.newInstance(this);
}
SipProfile.Builder builder = null;
try {
builder = new SipProfile.Builder("7001", "XXX.XXX.X.XXX");
builder.setPassword("XXX");
sipProfile = builder.build();
Intent i = new Intent();
i.setAction("android.SipDemo.INCOMING_CALL");
PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, Intent.FILL_IN_DATA);
sipManager.open(sipProfile, pi, null);
sipManager.setRegistrationListener(sipProfile.getUriString(), new SipRegistrationListener() {
public void onRegistering(String localProfileUri) {
}
public void onRegistrationDone(String localProfileUri, long expiryTime) {
}
public void onRegistrationFailed(String localProfileUri, int errorCode,
String errorMessage) {
}
});
} catch (ParseException pe) {
pe.printStackTrace();
} catch (SipException se) {
se.printStackTrace();
}
It is not clear from your question how do you envisage this to work. 从您的问题尚不清楚,您如何设想这一工作。 Servlets are server side, so if SIP messages are initiated from the server but I suspect what you really want is to initiate a SIP session, followed by an Audio stream established with some real-time streaming protocol from the client.
Servlet是服务器端的,因此,如果从服务器启动SIP消息,但我怀疑您真正想要的是启动SIP会话,然后是通过客户端的一些实时流协议建立的音频流。
There are Java APIs for SIP, and Sun / Oracle had a standard API for integrating with telecoms networks using SIP and IMS: https://www.oracle.com/technetwork/java/introduction-jain-sip-090386.html Not sure if they are still maintained. 有用于SIP的Java API,Sun / Oracle具有用于使用SIP和IMS与电信网络集成的标准API: https : //www.oracle.com/technetwork/java/introduction-jain-sip-090386.html不确定如果仍然保持。
However, I suspect that this is not what you really need. 但是,我怀疑这不是您真正需要的。 Maybe you should look at this client based WebRTC and SIP client:
也许您应该看一下基于此客户端的WebRTC和SIP客户端:
http://www.doubango.org/sipml5/ http://www.doubango.org/sipml5/
Your JSP would serve this Javascript, which allows the user to initiate a SIP session and establish the Audio call. 您的JSP将使用此Javascript,该Javascript允许用户启动SIP会话并建立音频呼叫。
From their documentation, it seems to be straightforward: 从他们的文档看来,这很简单:
SIPml.init(
function(e){
var stack = new SIPml.Stack({realm: 'example.org', impi: 'bob', impu: 'sip:bob@example.org', password: 'mysecret',
events_listener: { events: 'started', listener: function(e){
var callSession = stack.newSession('call-audiovideo', {
video_local: document.getElementById('video-local'),
video_remote: document.getElementById('video-remote'),
audio_remote: document.getElementById('audio-remote')
});
callSession.call('alice');
}
}
});
stack.start();
}
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.