请问如何部署sip 服务器 可以集成在一块的。比如很多 socket,rtmp 等非 HTTP 都能集成的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我现在在sailfin中部署好了,写了以下代码,doRegister功能正常,可是两台装有sipdroid的手机并不能invite对方,不知道是咋回事public class FirstSipServlet extends SipServlet { private static final long serialVersionUID = 1L; SipFactory sf = null; ServletContext ctx = null; TimerService ts = null; /** * _address keeps the mapping between sign-in name and actual contact * address. */ protected Map<URI, URI> _addresses = new HashMap<URI, URI>(); /** This is called by the container when starting up the service. */ public void init(ServletConfig config) throws ServletException { super.init(config); ctx = config.getServletContext(); sf = (SipFactory) ctx.getAttribute(SipServlet.SIP_FACTORY); ts = (TimerService) ctx.getAttribute(SipServlet.TIMER_SERVICE); } /** This is called by the container when shutting down the service. */ public void destroy() { try { System.out.println("Server is shutting down -- goodbye!"); } catch (Throwable e) { // ignore all errors when shutting down. e.printStackTrace(); } super.destroy(); } @Override protected void doRegister(SipServletRequest req) throws ServletException, IOException { System.out.println("doRegister"); URI toURI = req.getTo().getURI(); URI fromURI = req.getAddressHeader("Contact").getURI(); String contact = fromURI.toString(); contact = contact.substring(0, contact.indexOf(";")); fromURI = sf.createURI(contact); System.out.println("toURI=" + toURI + ";fromURI=" + fromURI); synchronized (_addresses) { if (req.getExpires() != 0) { // _addresses.put(AddressOfRecord, Contact); _addresses.put(toURI, fromURI); } else { _addresses.remove(toURI); } } req.createResponse(SipServletResponse.SC_OK).send(); } @Override protected void doInvite(SipServletRequest req) throws ServletException, IOException { // Invoked by the server (via the service method) to handle incoming // INVITE requests. System.out.println("doInvite"); Proxy proxy = req.getProxy(); URI toURI = req.getTo().getURI(); URI contactURI = req.getAddressHeader("Contact").getURI(); URI contactAddress = null; synchronized (_addresses) { contactAddress = _addresses.get(toURI); } System.out.println("toURI=" + toURI + ";contactAddress=" + contactAddress + ";contactURI=" + contactURI); // System.out.println("toAddr=" + toAddr + ";contactAddress=" + // contactAddress); // 根据URI 查询已经注册的用户代理的sip 地址 if (contactAddress == null) { SipServletResponse res = req.createResponse(SipServletResponse.SC_NOT_FOUND); System.out.println("contactAddress == null"); res.send(); } else { proxy.proxyTo(contactAddress); } }} 头疼。IE的onchange事件 有关SpringAOP拦截器的问题!!!急! 坐等大侠帮助! 如何删除如何删除jsp文件被Tomcat编译后的java中产生的格式字符 启动时报java.lang.reflect.InvocationTargetException JSP问题 Servlet小问题,就是看不懂啊,麻烦哪位大虾帮我看看,谢谢! 大家帮帮忙啊!!! jsp问题求助,急! 头痛的问题 append()是什么意思?它怎么用?都在哪用? 新手学java 在线考试系统,定时关闭窗口的问题!
我现在在sailfin中部署好了,写了以下代码,doRegister功能正常,可是两台装有sipdroid的手机并不能invite对方,不知道是咋回事
public class FirstSipServlet extends SipServlet { private static final long serialVersionUID = 1L; SipFactory sf = null;
ServletContext ctx = null;
TimerService ts = null; /**
* _address keeps the mapping between sign-in name and actual contact
* address.
*/
protected Map<URI, URI> _addresses = new HashMap<URI, URI>(); /** This is called by the container when starting up the service. */
public void init(ServletConfig config) throws ServletException {
super.init(config);
ctx = config.getServletContext();
sf = (SipFactory) ctx.getAttribute(SipServlet.SIP_FACTORY);
ts = (TimerService) ctx.getAttribute(SipServlet.TIMER_SERVICE);
} /** This is called by the container when shutting down the service. */
public void destroy() {
try {
System.out.println("Server is shutting down -- goodbye!");
} catch (Throwable e) { // ignore all errors when shutting down.
e.printStackTrace();
}
super.destroy();
} @Override
protected void doRegister(SipServletRequest req) throws ServletException, IOException {
System.out.println("doRegister");
URI toURI = req.getTo().getURI();
URI fromURI = req.getAddressHeader("Contact").getURI();
String contact = fromURI.toString();
contact = contact.substring(0, contact.indexOf(";"));
fromURI = sf.createURI(contact);
System.out.println("toURI=" + toURI + ";fromURI=" + fromURI); synchronized (_addresses) {
if (req.getExpires() != 0) {
// _addresses.put(AddressOfRecord, Contact);
_addresses.put(toURI, fromURI);
} else {
_addresses.remove(toURI);
}
}
req.createResponse(SipServletResponse.SC_OK).send();
} @Override
protected void doInvite(SipServletRequest req) throws ServletException, IOException {
// Invoked by the server (via the service method) to handle incoming
// INVITE requests.
System.out.println("doInvite"); Proxy proxy = req.getProxy(); URI toURI = req.getTo().getURI();
URI contactURI = req.getAddressHeader("Contact").getURI(); URI contactAddress = null; synchronized (_addresses) {
contactAddress = _addresses.get(toURI);
} System.out.println("toURI=" + toURI + ";contactAddress=" + contactAddress + ";contactURI=" + contactURI); // System.out.println("toAddr=" + toAddr + ";contactAddress=" +
// contactAddress);
// 根据URI 查询已经注册的用户代理的sip 地址
if (contactAddress == null) {
SipServletResponse res = req.createResponse(SipServletResponse.SC_NOT_FOUND);
System.out.println("contactAddress == null");
res.send();
} else {
proxy.proxyTo(contactAddress);
}
}
}