Пример #1
0
 @Override
 public synchronized void accept(final Map<String, String> headers) throws SignalException {
   checkState();
   _accepted = true;
   try {
     ((SIPIncomingCall) this).doInvite(headers);
     return;
   } catch (final Exception e) {
     throw new SignalException(e);
   }
 }
Пример #2
0
 @Override
 public synchronized void proxyTo(
     boolean recordRoute,
     boolean parallel,
     Map<String, String> headers,
     Endpoint... destinations) {
   checkState();
   _proxied = true;
   setSIPCallState(SIPCall.State.PROXIED);
   SIPHelper.proxyTo(
       getApplicationContext().getSipFactory(),
       _invite,
       headers,
       recordRoute,
       parallel,
       destinations);
 }
Пример #3
0
  @Override
  public synchronized void reject(final Reason reason, final Map<String, String> headers)
      throws SignalException {
    checkState();
    _rejected = true;
    setSIPCallState(SIPCall.State.REJECTED);

    terminate(CallCompleteEvent.Cause.DECLINE, null, headers);

    try {
      final SipServletResponse res =
          _invite.createResponse(reason == null ? Reason.DECLINE.getCode() : reason.getCode());
      SIPHelper.addHeaders(res, headers);
      res.send();
    } catch (final IOException e) {
      throw new SignalException(e);
    }
  }
Пример #4
0
 @Override
 public synchronized void acceptWithEarlyMedia(final Map<String, String> headers)
     throws SignalException, MediaException {
   checkState();
   _accepted = true;
   _acceptedWithEarlyMedia = true;
   try {
     ((SIPIncomingCall) this).doInviteWithEarlyMedia(headers);
     return;
   } catch (final Exception e) {
     if (e instanceof SignalException) {
       throw (SignalException) e;
     } else if (e instanceof MediaException) {
       throw (MediaException) e;
     } else {
       throw new SignalException(e);
     }
   }
 }
Пример #5
0
  @Override
  public synchronized void redirect(final Endpoint o, final Map<String, String> headers)
      throws SignalException {
    checkState();
    _redirected = true;
    setSIPCallState(SIPCall.State.REDIRECTED);

    terminate(CallCompleteEvent.Cause.REDIRECT, null, headers);

    if (o instanceof SIPEndpoint) {
      final SipServletResponse res =
          _invite.createResponse(SipServletResponse.SC_MOVED_TEMPORARILY);
      res.setHeader("Contact", ((SIPEndpoint) o).getURI().toString());
      SIPHelper.addHeaders(res, headers);
      try {
        res.send();
      } catch (final IOException e) {
        throw new SignalException(e);
      }
    } else {
      throw new IllegalArgumentException("Unable to redirect the call to a non-SIP participant.");
    }
  }