Package javax.sip.address

Examples of javax.sip.address.URI


    return llist.listIterator();
  }

  public Hop getNextHop(Request request) throws SipException {
    routerWasConsulted = true;
    URI uri = request.getRequestURI();
    ScenarioHarness.assertTrue("expected to be consulted only for tel uri",uri.getScheme().equals("tel"));
    return new HopImpl();
  }
View Full Code Here


                AuthorizationHeader authorization = null;
                String sipDomain;
                if ( this.accountManager instanceof SecureAccountManager ) {
                    UserCredentialHash credHash =
                        ((SecureAccountManager)this.accountManager).getCredentialHash(challengedTransaction,realm);
                    URI uri = reoriginatedRequest.getRequestURI();
                    sipDomain = credHash.getSipDomain();
                    authorization = this.getAuthorization(reoriginatedRequest
                            .getMethod(), uri.toString(),
                            (reoriginatedRequest.getContent() == null) ? "" : new String(
                            reoriginatedRequest.getRawContent()), authHeader, credHash);
                } else {
                    UserCredentials userCreds = ((AccountManager) this.accountManager).getCredentials(challengedTransaction, realm);
                    sipDomain = userCreds.getSipDomain();
View Full Code Here

        routeHeader = headerFactory.createRouteHeader(routeAddress);

        // LETS CREATE OUR REQUEST AND
        ArrayList list = new ArrayList();
        list.add(viaHeader);
        URI requestURI = null;
        Request request = null;
        Request cancel = null;
        Request inviteRequest = null;

        requestURI = addressFactory.createURI("sip:" + localAddress);
View Full Code Here

      ViaHeader via = ((ListeningPointImpl)provider.getListeningPoint(testProtocol)).getViaHeader();
      via.setRPort();
      List vias = Arrays.asList(via);     
      MaxForwardsHeader maxForwards = headerFactory.createMaxForwardsHeader(10);
       
        URI requestURI = addressFactory.createURI("sip:test@"+host+":"+SERVER_PORT);
        Request request = messageFactory.createRequest(requestURI, Request.INVITE, callId, cSeq, from, to, vias, maxForwards);
        System.out.println(request);
        assertTrue(request.toString().indexOf("rport=") == -1);       
       
        request.setRequestURI(requestURI);
View Full Code Here

     
    }
    // LETS CREATE OUR REQUEST AND
    ArrayList list = new ArrayList();
    list.add(viaHeader);
    URI requestURI = null;

    Request inviteRequest=null;
    try {
      requestURI = binder.getAddressFactory().createURI("sip:" + binder.getStackAddress());
      register = binder.getMessageFactory().createRequest(requestURI,
View Full Code Here

      // if we are calling to vmail this means we want to check our mail
      // box
      // sameUser = true
      boolean sameUser = sameUser(event);
      URI uri;

      if (sameUser) {
        // The user is the caller
        FromHeader fromHeader = (FromHeader) request
            .getHeader(FromHeader.NAME);
        uri = fromHeader.getAddress().getURI();
      } else {
        // The user is the callee - we are calling someone else
        ToHeader toHeader = (ToHeader) request.getHeader(ToHeader.NAME);
        uri = toHeader.getAddress().getURI();
      }
      // In the Profile Table the port is not used
      ((SipURI) uri).removePort();

      // Responding to the user
      // To know whether the user has the Voice mail service enabled
      boolean isSubscriber = isSubscriber(uri.toString());

      if (isSubscriber) {
        // Voice Mail service enabled
        String fileRoute = null;

        // Looking for the audio file to transmit
        Context initCtx = new InitialContext();
        Context myEnv = (Context) initCtx.lookup("java:comp/env");

        // check if the user is calling their own number to check voice
        // mail
        if (sameUser) {

        }
        // or someone else is calling the user to leave a voice message
        else {

          ToHeader toHeader = (ToHeader) request
              .getHeader(ToHeader.NAME);
          String fileName = ((SipURI) toHeader.getAddress().getURI())
              .getUser()
              + WAV_EXT;

          // Setting File Route where recording the voice message
          String route = (String) myEnv.lookup("filesRoute");
          fileRoute = route + fileName;
        }

        // SDP Description from the request
        String sdp = new String(request.getRawContent());

        // Creating Media Session
        MsSession mediaSession = msProvider.createSession();
        // Setting Media Session
        this.setMediaSession(mediaSession);
        MsConnection msConnection = mediaSession
            .createNetworkConnection(ENDPOINT_NAME);

        // Attaching session AC
        ActivityContextInterface msAci = null;
        try {
          msAci = msActivityFactory
              .getActivityContextInterface(msConnection);
          msAci.attach(this.getSbbLocalObject());
        } catch (Exception ex) {
          log.error("Internal server error", ex);
          getMessageFactory().createResponse(
              Response.SERVER_INTERNAL_ERROR, request);
          return;
        }

        // Attaching to SIP Dialog activity
        Dialog dial = getSipFactoryProvider().getSipProvider()
            .getNewDialog((Transaction) st);
        ActivityContextInterface dialogAci = sipACIF
            .getActivityContextInterface(dial);

        // attach this SBB object to the Dialog activity to receive
        // subsequent events on this Dialog
        dialogAci.attach(this.getSbbLocalObject());

        // Notify caller that we're TRYING to reach voice mail. Just a
        // formality, we know we can go further than TRYING at this
        // point
        response = getMessageFactory().createResponse(Response.TRYING,
            request);
        st.sendResponse(response);

        // RINGING. Another formality of the SIP protocol.
        response = getMessageFactory().createResponse(Response.RINGING,
            request);
        st.sendResponse(response);

        log.info("Creating RTP connection [" + ENDPOINT_NAME + "]");
        msConnection.modify("$", sdp);

      }
      // Voice Mail service disabled
      else {
        response = getMessageFactory().createResponse(
            Response.TEMPORARILY_UNAVAILABLE, request);
        log.info("########## NO VOICE MAIL AVAILABLE FOR USER: "
            + uri.toString());
        st.sendResponse(response);
      }

    } catch (TransactionRequiredLocalException e) {
      log.error(e.getMessage(), e);
View Full Code Here

        return;
      }

      request = event.getRequest();
      ToHeader toHeader = (ToHeader) request.getHeader(ToHeader.NAME);
      URI toURI = toHeader.getAddress().getURI();
      URI contactURI = isUserAvailable(toURI);
      if (contactURI != null) {
        // USER IS AVAILABLE
        localAci.setFilteredByMe(true);
        log.info("########## User "+toURI+" is available with contact "+contactURI);
       
View Full Code Here

   * Attempts to find a locally registered contact address for the given URI,
   * using the location service interface.
   */
  private URI isUserAvailable(URI uri) throws SipSendErrorResponseException {
    String addressOfRecord = uri.toString();
    URI target = null;
    Map bindings = null;

    try {
      bindings = locationService.getBindings(addressOfRecord);

View Full Code Here

    return userAndHost;
  }

  public SipURI convertAddressToSipURI(Address address) throws ParseException {
    URI sipURI = address.getURI();
    SipURI retVal = null;
    if (sipURI.isSipURI())
      retVal = (SipURI) sipURI;
    else {
      throw new ParseException("URI was not of type SipURI!", -1);
    }
    return retVal;
View Full Code Here

     * be rejected with a 483(Too Many Hops) error response.
     */
    MaxForwardsHeader maxForwardsHeader = headerFactory
        .createMaxForwardsHeader(70);

    final URI requestURI = convertAddressToSipURI(toAddress);

    /*
     * Create the request
     */
    CallIdHeader callIdHeader = sipProvider.getNewCallId();
View Full Code Here

TOP

Related Classes of javax.sip.address.URI

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.