Package javax.servlet.sip

Examples of javax.servlet.sip.SipURI


          request.getStateInfo());
     
      if (routerInfo != null && routerInfo.getNextApplicationName() != null)
      {
        SipConnector connector = _connectorManager.getDefaultConnector();
        SipURI route = new SipURIImpl(null, connector.getHost(), connector.getPort());
        RouterInfoUtil.encode(route, routerInfo);
        route.setLrParam(true);
       
        request.pushRoute(route);
      }
    }
View Full Code Here


    return null;
  }
 
  public void addAgent(UserAgent agent)
  {
    SipURI contact = (SipURI) getContact().clone();
   
    agent.setFactory(_context.getSipFactory());
    agent.setContact(new NameAddr(contact));
   
    synchronized(_userAgents)
View Full Code Here

 
  public static void mergeContact(String src, Address dest) throws ServletParseException
  {
    NameAddr source = new NameAddr(src);
   
    SipURI srcUri = (SipURI) source.getURI();
    SipURI destUri = (SipURI) dest.getURI();
   
    String user = srcUri.getUser();
    if (user != null)
      destUri.setUser(user);
   
    Iterator<String> it = srcUri.getHeaderNames();
    while (it.hasNext())
    {
      String name = it.next();
      destUri.setHeader(name, srcUri.getHeader(name));
    }
   
    it = srcUri.getParameterNames();
    while (it.hasNext())
    {
      String name = it.next();
      if (!ContactAddress.isReservedUriParam(name))
        destUri.setParameter(name, srcUri.getParameter(name));
    }
    String displayName = source.getDisplayName();
    if (displayName != null)
      dest.setDisplayName(displayName);
   
View Full Code Here

  public Object extract(Object input)
  {
    URI uri = (URI) input;
    if (uri.isSipURI())
    {
          SipURI sipuri = (SipURI) uri;
          int port = sipuri.getPort();
          if (port < 0)
          {
              String scheme = sipuri.getScheme();
              if (scheme.equals("sips"))
                  return "5061";
              else
                  return "5060";
          }
View Full Code Here

        uri = _request.getRequestURI();
     
      if (!uri.isSipURI())
        throw new IOException("Cannot route on URI: " + uri);
     
      SipURI target = (SipURI) uri;
     
      InetAddress address = InetAddress.getByName(target.getHost()); // TODO 3263
      int transport = SipConnectors.getOrdinal(target.getTransportParam()); // TODO opt
     
      if (transport == -1)
        transport = SipConnectors.UDP_ORDINAL;
     
      int port = target.getPort();
      if (port == -1)
        port = SipConnectors.getDefaultPort(transport);
   

      Via via = new Via(SipVersions.SIP_2_0, null, null);
View Full Code Here

  /**
   * @see ServletRequest#getParameter(String)
   */
  public String getParameter(String name)
    {
    SipURI paramUri = getParamUri();
   
    if (paramUri == null)
      return null;
   
    return paramUri.getParameter(name);
  }
View Full Code Here

   */
  public Map getParameterMap()
    {
    Map map = new HashMap();
   
    SipURI paramUri = getParamUri();
   
    if (paramUri != null)
        {
      Iterator it = paramUri.getParameterNames();
      while (it.hasNext())
            {
        String key = (String) it.next();
        map.put(key, new String[] {paramUri.getParameter(key)});
      }
    }
    return Collections.unmodifiableMap(map);
  }
View Full Code Here

  /**
   * @see javax.servlet.ServletRequest#getParameterNames()
   */
  public Enumeration getParameterNames()
    {
    SipURI paramUri = getParamUri();
   
    if (paramUri == null)
      return Collections.enumeration(Collections.EMPTY_LIST);
   
    return new IteratorToEnum(paramUri.getParameterNames());
  }
View Full Code Here

 

  @Test
  public void testSipUser() throws Exception
  {
    SipURI uri = sipURI("sip:user@host.com:3261");
    assertEquals("user", uri.getUser());
    assertEquals("host.com", uri.getHost());
  }
View Full Code Here

  }

  @Test
  public void testPassword() throws Exception
  {
    SipURI uri = sipURI("sip:user:passwd@host.com");
    assertEquals("passwd", uri.getUserPassword());
  }
View Full Code Here

TOP

Related Classes of javax.servlet.sip.SipURI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.