コード例 #1
0
ファイル: SipRequester.java プロジェクト: Sipuada/sipuada
  public boolean sendRegister(final SipRequestState state, final SipProfile sipProfile) {

    SipRequest sipRequest = createSipRequest(SipRequestVerb.REGISTER, state, sipProfile, null);

    if (null != stateMachine
        && stateMachine.canRequestBeSent(SipRequestVerb.REGISTER, sipRequest.getRequest())) {
      sipConnection.setCurrentCallId(sipRequest.getCallIdHeader());
      sendRequest(SipRequestVerb.REGISTER, sipRequest.getRequest());
      return true;
    }
    return false;
  }
コード例 #2
0
ファイル: SipRequester.java プロジェクト: Sipuada/sipuada
  public boolean sendInvite(
      final SipRequestState state, final SipProfile sipProfile, final SipContact sipContact) {
    SipRequest sipRequest = createSipRequest(SipRequestVerb.INVITE, state, sipProfile, sipContact);

    if (null != stateMachine
        && stateMachine.canRequestBeSent(SipRequestVerb.INVITE, sipRequest.getRequest())) {
      sipConnection.setCurrentCallId(sipRequest.getCallIdHeader());
      sendRequest(SipRequestVerb.INVITE, sipRequest.getRequest());
      return true;
    }
    return false;
  }
コード例 #3
0
ファイル: SipRequester.java プロジェクト: Sipuada/sipuada
  private SipRequest createSipRequest(
      final SipRequestVerb sipRequestVerb,
      final SipRequestState state,
      final SipProfile sipProfile,
      final SipContact sipContact,
      final String textMessage) {

    // On REGISTER method, the sip contact must be the same as sip
    // profile sender.
    final SipContact newSipContact = (null == sipContact ? new SipContact(sipProfile) : sipContact);

    SipRequest sipRequest = null;
    try {
      sipRequest =
          new SipRequest(
              state,
              sipProfile,
              newSipContact,
              addressFactory,
              headerFactory,
              messageFactory,
              sipConnection.getProvider(),
              sipRequestVerbToRequestMethod(sipRequestVerb),
              sipConnection.getCallSequence(),
              70,
              300,
              textMessage);

      // update current CallId header of sipConnection
      sipConnection.setCurrentCallId(sipRequest.getCallIdHeader());
    } catch (ParseException | InvalidArgumentException | SipException | SdpException e) {
      e.printStackTrace();
    }

    return sipRequest;
  }