/**
   * Receive an instant message (SIP MESSAGE)
   *
   * @param intent Resolved intent
   * @param message Instant message request
   */
  public void receiveSipInstantMessage(Intent intent, SipRequest message) {
    // Broadcast intent related to the received invitation
    String contact = SipUtils.getAssertedIdentity(message);
    String number = PhoneUtils.extractNumberFromUri(contact);
    String displayName = SipUtils.getDisplayNameFromUri(message.getFrom());
    intent.putExtra(MultimediaMessageIntent.EXTRA_CONTACT, number);
    intent.putExtra(MultimediaMessageIntent.EXTRA_DISPLAY_NAME, displayName);
    intent.putExtra(MultimediaMessageIntent.EXTRA_CONTENT, message.getRawContent());

    // Broadcast intent related to the received invitation
    AndroidFactory.getApplicationContext().sendBroadcast(intent);
  }
  /**
   * Create INVITE request
   *
   * @param content Content part
   * @return Request
   * @throws SipException
   */
  private SipRequest createInviteRequest(String content) throws SipException {
    SipRequest invite =
        SipMessageFactory.createInvite(
            getDialogPath(), getFeatureTags(), getAcceptContactTags(), content);

    // Test if there is a subject
    if (getSubject() != null) {
      // Add a subject header
      invite.addHeader(SubjectHeader.NAME, StringUtils.encodeUTF8(getSubject()));
    }

    // Add a contribution ID header
    invite.addHeader(ChatUtils.HEADER_CONTRIBUTION_ID, getContributionID());

    return invite;
  }
Exemplo n.º 3
0
  /**
   * Create terminating dialog path
   *
   * @param invite Incoming invite
   */
  public void createTerminatingDialogPath(SipRequest invite) {
    // Set the call-id
    String callId = invite.getCallId();

    // Set target
    String target = invite.getContactURI();

    // Set local party
    String localParty = invite.getTo();

    // Set remote party
    String remoteParty = invite.getFrom();

    // Get the CSeq value
    long cseq = invite.getCSeq();

    // Set the route path with the Record-Route
    Vector<String> route = SipUtils.routeProcessing(invite, false);

    // Create a dialog path
    dialogPath =
        new SipDialogPath(
            getImsService().getImsModule().getSipManager().getSipStack(),
            callId,
            cseq,
            target,
            localParty,
            remoteParty,
            route);

    // Set the INVITE request
    dialogPath.setInvite(invite);

    // Set the remote tag
    dialogPath.setRemoteTag(invite.getFromTag());

    // Set the remote content part
    dialogPath.setRemoteContent(invite.getContent());

    // Set the session timer expire
    dialogPath.setSessionExpireTime(invite.getSessionTimerExpire());
  }