Search in sources :

Example 6 with SipException

use of javax.sip.SipException in project XobotOS by xamarin.

the class SipHelper method sendInviteBusyHere.

public void sendInviteBusyHere(RequestEvent event, ServerTransaction inviteTransaction) throws SipException {
    try {
        Request request = event.getRequest();
        Response response = mMessageFactory.createResponse(Response.BUSY_HERE, request);
        if (inviteTransaction == null) {
            inviteTransaction = getServerTransaction(event);
        }
        if (inviteTransaction.getState() != TransactionState.COMPLETED) {
            if (DEBUG)
                Log.d(TAG, "send BUSY HERE: " + response);
            inviteTransaction.sendResponse(response);
        }
    } catch (ParseException e) {
        throw new SipException("sendInviteBusyHere()", e);
    }
}
Also used : Response(javax.sip.message.Response) Request(javax.sip.message.Request) ParseException(java.text.ParseException) SipException(javax.sip.SipException)

Example 7 with SipException

use of javax.sip.SipException in project XobotOS by xamarin.

the class SipHelper method sendResponse.

public void sendResponse(RequestEvent event, int responseCode) throws SipException {
    try {
        Request request = event.getRequest();
        Response response = mMessageFactory.createResponse(responseCode, request);
        if (DEBUG && (!Request.OPTIONS.equals(request.getMethod()) || DEBUG_PING)) {
            Log.d(TAG, "send response: " + response);
        }
        getServerTransaction(event).sendResponse(response);
    } catch (ParseException e) {
        throw new SipException("sendResponse()", e);
    }
}
Also used : Response(javax.sip.message.Response) Request(javax.sip.message.Request) ParseException(java.text.ParseException) SipException(javax.sip.SipException)

Example 8 with SipException

use of javax.sip.SipException in project XobotOS by xamarin.

the class SipHelper method sendReferNotify.

public void sendReferNotify(Dialog dialog, String content) throws SipException {
    try {
        Request request = dialog.createRequest(Request.NOTIFY);
        request.addHeader(mHeaderFactory.createSubscriptionStateHeader("active;expires=60"));
        // set content here
        request.setContent(content, mHeaderFactory.createContentTypeHeader("message", "sipfrag"));
        request.addHeader(mHeaderFactory.createEventHeader(ReferencesHeader.REFER));
        if (DEBUG)
            Log.d(TAG, "send NOTIFY: " + request);
        dialog.sendRequest(mSipProvider.getNewClientTransaction(request));
    } catch (ParseException e) {
        throw new SipException("sendReferNotify()", e);
    }
}
Also used : Request(javax.sip.message.Request) ParseException(java.text.ParseException) SipException(javax.sip.SipException)

Example 9 with SipException

use of javax.sip.SipException in project XobotOS by xamarin.

the class SipHelper method sendOptions.

public ClientTransaction sendOptions(SipProfile caller, SipProfile callee, String tag) throws SipException {
    try {
        Request request = (caller == callee) ? createRequest(Request.OPTIONS, caller, tag) : createRequest(Request.OPTIONS, caller, callee, tag);
        ClientTransaction clientTransaction = mSipProvider.getNewClientTransaction(request);
        clientTransaction.sendRequest();
        return clientTransaction;
    } catch (Exception e) {
        throw new SipException("sendOptions()", e);
    }
}
Also used : ClientTransaction(javax.sip.ClientTransaction) Request(javax.sip.message.Request) SipException(javax.sip.SipException) TransactionAlreadyExistsException(javax.sip.TransactionAlreadyExistsException) InvalidArgumentException(javax.sip.InvalidArgumentException) ParseException(java.text.ParseException) PeerUnavailableException(javax.sip.PeerUnavailableException) SipException(javax.sip.SipException) TransactionUnavailableException(javax.sip.TransactionUnavailableException)

Example 10 with SipException

use of javax.sip.SipException in project XobotOS by xamarin.

the class SipHelper method sendRegister.

public ClientTransaction sendRegister(SipProfile userProfile, String tag, int expiry) throws SipException {
    try {
        Request request = createRequest(Request.REGISTER, userProfile, tag);
        if (expiry == 0) {
            // remove all previous registrations by wildcard
            // rfc3261#section-10.2.2
            request.addHeader(createWildcardContactHeader());
        } else {
            request.addHeader(createContactHeader(userProfile));
        }
        request.addHeader(mHeaderFactory.createExpiresHeader(expiry));
        ClientTransaction clientTransaction = mSipProvider.getNewClientTransaction(request);
        clientTransaction.sendRequest();
        return clientTransaction;
    } catch (ParseException e) {
        throw new SipException("sendRegister()", e);
    }
}
Also used : ClientTransaction(javax.sip.ClientTransaction) Request(javax.sip.message.Request) ParseException(java.text.ParseException) SipException(javax.sip.SipException)

Aggregations

SipException (javax.sip.SipException)37 ParseException (java.text.ParseException)25 IOException (java.io.IOException)16 SIPRequest (gov.nist.javax.sip.message.SIPRequest)15 Request (javax.sip.message.Request)15 InvalidArgumentException (javax.sip.InvalidArgumentException)14 ObjectInUseException (javax.sip.ObjectInUseException)10 SIPResponse (gov.nist.javax.sip.message.SIPResponse)9 ClientTransaction (javax.sip.ClientTransaction)8 Response (javax.sip.message.Response)8 Via (gov.nist.javax.sip.header.Via)6 SIPClientTransaction (gov.nist.javax.sip.stack.SIPClientTransaction)6 DialogDoesNotExistException (javax.sip.DialogDoesNotExistException)6 TransactionDoesNotExistException (javax.sip.TransactionDoesNotExistException)6 Hop (javax.sip.address.Hop)6 SipURI (javax.sip.address.SipURI)6 SIPDialog (gov.nist.javax.sip.stack.SIPDialog)5 ListeningPointImpl (gov.nist.javax.sip.ListeningPointImpl)3 From (gov.nist.javax.sip.header.From)3 RSeq (gov.nist.javax.sip.header.RSeq)3