public class OperationSetBasicTelephonySipImpl extends AbstractOperationSetBasicTelephony<ProtocolProviderServiceSipImpl> implements MethodProcessor, OperationSetAdvancedTelephony<ProtocolProviderServiceSipImpl>, OperationSetSecureZrtpTelephony, OperationSetSecureSDesTelephony
HANGUP_REASON_BUSY_HERE, HANGUP_REASON_ENCRYPTION_REQUIRED, HANGUP_REASON_NORMAL_CLEARING, HANGUP_REASON_TIMEOUT, MAX_AUDIO_PORT_NUMBER_PROPERTY_NAME, MAX_DATA_CHANNEL_PORT_NUMBER_PROPERTY_NAME, MAX_MEDIA_PORT_NUMBER_PROPERTY_NAME, MAX_VIDEO_PORT_NUMBER_PROPERTY_NAME, MIN_AUDIO_PORT_NUMBER_PROPERTY_NAME, MIN_DATA_CHANNEL_PORT_NUMBER_PROPERTY_NAME, MIN_MEDIA_PORT_NUMBER_PROPERTY_NAME, MIN_VIDEO_PORT_NUMBER_PROPERTY_NAME
Constructor and Description |
---|
OperationSetBasicTelephonySipImpl(ProtocolProviderServiceSipImpl protocolProvider)
Creates a new instance and adds itself as an INVITE method
handler in the creating protocolProvider.
|
Modifier and Type | Method and Description |
---|---|
void |
answerCallPeer(CallPeer peer)
Indicates a user request to answer an incoming call from the specified
CallPeer.
|
(package private) void |
assertRegistered()
Verifies that our protocol provider is properly registered and throws
an OperationFailedException if that's not the case.
|
Call |
createCall(java.lang.String callee,
CallConference conference)
Creates a new Call and invites a specific CallPeer to
it given by her String URI.
|
protected CallSipImpl |
createOutgoingCall()
Initializes a new outgoing Call with no peers in it.
|
(package private) CallSipImpl |
createOutgoingCall(javax.sip.address.Address calleeAddress,
javax.sip.message.Message cause,
CallConference conference)
Initializes and establishes a new outgoing Call to a callee with
a specific Address.
|
java.util.Iterator<CallSipImpl> |
getActiveCalls()
Returns an iterator over all currently active calls.
|
protected ActiveCallsRepositorySipImpl |
getActiveCallsRepository()
Returns a reference to the
ActiveCallsRepositorySipImpl that we are
currently using. |
ProtocolProviderServiceSipImpl |
getProtocolProvider()
Returns the protocol provider that this operation set belongs to.
|
void |
hangupCallPeer(CallPeer peer)
Ends the call with the specified peer.
|
void |
hangupCallPeer(CallPeer peer,
int reasonCode,
java.lang.String reason)
Ends the call with the specified peer.
|
boolean |
isSecure(CallPeer peer)
Returns true to indicate that the call associated with the
given peer is secured, otherwise returns false.
|
boolean |
processDialogTerminated(javax.sip.DialogTerminatedEvent dialogTerminatedEvent)
Process an asynchronously reported DialogTerminatedEvent.
|
boolean |
processIOException(javax.sip.IOExceptionEvent exceptionEvent)
Process an asynchronously reported IO Exception.
|
boolean |
processRequest(javax.sip.RequestEvent requestEvent)
Processes a Request received on a SipProvider upon which this SipListener
is registered.
|
boolean |
processResponse(javax.sip.ResponseEvent responseEvent)
Analyzes the incoming responseEvent and then forwards it to the
proper event handler.
|
boolean |
processTimeout(javax.sip.TimeoutEvent timeoutEvent)
Processes a retransmit or expiration Timeout of an underlying
Transaction handled by this SipListener. |
boolean |
processTransactionTerminated(javax.sip.TransactionTerminatedEvent transactionTerminatedEvent)
Process an asynchronously reported TransactionTerminatedEvent.
|
void |
putOffHold(CallPeer peer)
Resumes communication with a call peer previously put on hold.
|
void |
putOnHold(CallPeer peer)
Puts the specified CallPeer "on hold".
|
void |
setTransferAuthority(TransferAuthority authority)
Transfer authority used for interacting with user for unknown calls
and the requests for transfer.
|
void |
shutdown()
Closes all active calls.
|
java.lang.String |
toString()
Returns a string representation of this OperationSetBasicTelephony
instance including information that would permit to distinguish it among
other instances when reading a log file.
|
void |
transfer(CallPeer transferee,
CallPeer transferTarget)
Transfers the call we have with transferee to
transferTarget.
|
void |
transfer(CallPeer peer,
java.lang.String target)
Transfers (in the sense of call transfer) a specific
CallPeer to a specific callee address which already
participates in an active Call.
|
addCallListener, createCall, createCall, createCall, createCall, createRecorder, fireCallEvent, fireCallEvent, fireCallEvent, removeCallListener, setMute
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addCallListener, createCall, createCall, createCall, createCall, createRecorder, removeCallListener, setMute
public OperationSetBasicTelephonySipImpl(ProtocolProviderServiceSipImpl protocolProvider)
protocolProvider
- a reference to the
ProtocolProviderServiceSipImpl instance that created
us.public Call createCall(java.lang.String callee, CallConference conference) throws OperationFailedException, java.text.ParseException
createCall
in interface OperationSetBasicTelephony<ProtocolProviderServiceSipImpl>
callee
- the address of the callee who we should invite to a new
Callconference
- the CallConference in which the newly-created
Call is to participateOperationFailedException
- with the corresponding code if we fail
to create the calljava.text.ParseException
- if callee is not a valid SIP address
Stringprotected CallSipImpl createOutgoingCall() throws OperationFailedException
createOutgoingCall(Address,
javax.sip.message.Message,CallConference)
.OperationFailedException
- if initializing the new outgoing
Call failsCallSipImpl createOutgoingCall(javax.sip.address.Address calleeAddress, javax.sip.message.Message cause, CallConference conference) throws OperationFailedException
calleeAddress
- the address of the callee that we'd like to connect
with.cause
- the Message, if any, which is the cause for the
outgoing call to be placed and which carries additional information to be
included in the call initiation (e.g. a Referred-To header and token in a
Refer request)conference
- the CallConference in which the newly-created
Call is to participateOperationFailedException
- with the corresponding code if we fail
to create the call.public java.util.Iterator<CallSipImpl> getActiveCalls()
getActiveCalls
in interface OperationSetBasicTelephony<ProtocolProviderServiceSipImpl>
protected ActiveCallsRepositorySipImpl getActiveCallsRepository()
ActiveCallsRepositorySipImpl
that we are
currently using.ActiveCallsRepositorySipImpl
that we are
currently using.public void putOffHold(CallPeer peer) throws OperationFailedException
putOffHold
in interface OperationSetBasicTelephony<ProtocolProviderServiceSipImpl>
peer
- the call peer to put on hold.OperationFailedException
- if we fail to construct or send the
INVITE request putting the remote side on/off hold.public void putOnHold(CallPeer peer) throws OperationFailedException
putOnHold
in interface OperationSetBasicTelephony<ProtocolProviderServiceSipImpl>
peer
- the peer that we'd like to put on hold.OperationFailedException
- if we fail to construct or send the
INVITE request putting the remote side on/off hold.public boolean processRequest(javax.sip.RequestEvent requestEvent)
processRequest
in interface MethodProcessor
requestEvent
- requestEvent fired from the SipProvider to the
SipListener representing a Request received from the network.public boolean processTransactionTerminated(javax.sip.TransactionTerminatedEvent transactionTerminatedEvent)
processTransactionTerminated
in interface MethodProcessor
transactionTerminatedEvent
- -- an event that indicates that the
transaction has transitioned into the terminated state.public boolean processResponse(javax.sip.ResponseEvent responseEvent)
processResponse
in interface MethodProcessor
responseEvent
- the responseEvent that we received
ProtocolProviderService.public boolean processTimeout(javax.sip.TimeoutEvent timeoutEvent)
Transaction
handled by this SipListener. This Event notifies the
application that a retransmission or transaction Timer expired in the
SipProvider's transaction state machine. The TimeoutEvent encapsulates
the specific timeout type and the transaction identifier either client or
server upon which the timeout occurred. The type of Timeout can by
determined by:
timeoutType = timeoutEvent.getTimeout().getValue();processTimeout
in interface MethodProcessor
timeoutEvent
- the timeoutEvent received indicating either the
message retransmit or transaction timed out.public boolean processIOException(javax.sip.IOExceptionEvent exceptionEvent)
processIOException
in interface MethodProcessor
exceptionEvent
- The Exception event that is reported to the
application.public boolean processDialogTerminated(javax.sip.DialogTerminatedEvent dialogTerminatedEvent)
processDialogTerminated
in interface MethodProcessor
dialogTerminatedEvent
- -- an event that indicates that the dialog
has transitioned into the terminated state.public void hangupCallPeer(CallPeer peer) throws java.lang.ClassCastException, OperationFailedException
hangupCallPeer
in interface OperationSetBasicTelephony<ProtocolProviderServiceSipImpl>
peer
- the peer that we'd like to hang up on.java.lang.ClassCastException
- if peer is not an instance of this
CallPeerSipImpl.OperationFailedException
- if we fail to terminate the call.public void hangupCallPeer(CallPeer peer, int reasonCode, java.lang.String reason) throws java.lang.ClassCastException, OperationFailedException
hangupCallPeer
in interface OperationSetBasicTelephony<ProtocolProviderServiceSipImpl>
peer
- the peer that we'd like to hang up on.reasonCode
- indicates if the hangup is following to a call failure
or simply a disconnect indicate by the reason.reason
- the reason of the hangup. If the hangup is due to a call
failure, then this string could indicate the reason of the failurejava.lang.ClassCastException
- if peer is not an instance of this
CallPeerSipImpl.OperationFailedException
- if we fail to terminate the call.public void answerCallPeer(CallPeer peer) throws OperationFailedException, java.lang.ClassCastException
answerCallPeer
in interface OperationSetBasicTelephony<ProtocolProviderServiceSipImpl>
peer
- the call peer that we need to send the ok to.OperationFailedException
- if we fail to create or send the
response.java.lang.ClassCastException
- if peer is not an instance of a
CallPeerSipImplpublic java.lang.String toString()
toString
in class java.lang.Object
public void shutdown()
public boolean isSecure(CallPeer peer)
isSecure
in interface OperationSetSecureTelephony
peer
- the CallPeer whose security we'd like to check.public void transfer(CallPeer transferee, CallPeer transferTarget) throws OperationFailedException
transfer
in interface OperationSetAdvancedTelephony<ProtocolProviderServiceSipImpl>
transferee
- the CallPeer that we are about to transfer.transferTarget
- the CallPeer that we are about to direct
transferee to.OperationFailedException
- if the transfer fails.public void transfer(CallPeer peer, java.lang.String target) throws OperationFailedException
The method is suitable for providing the implementation of attended call transfer (though no such requirement is imposed).
transfer
in interface OperationSetAdvancedTelephony<ProtocolProviderServiceSipImpl>
peer
- the CallPeer to be transfered to the specified
callee addresstarget
- the address in the form of CallPeer of the callee
to transfer peer toOperationFailedException
- if creating or sending the transferring
INVITE request fails.void assertRegistered() throws OperationFailedException
OperationFailedException
- if the protocol provider that created us
is not registered.public ProtocolProviderServiceSipImpl getProtocolProvider()
getProtocolProvider
in interface OperationSetBasicTelephony<ProtocolProviderServiceSipImpl>
public void setTransferAuthority(TransferAuthority authority)
setTransferAuthority
in interface OperationSetAdvancedTelephony<ProtocolProviderServiceSipImpl>
authority
- transfer authority.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.