Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.sip
Class OperationSetAutoAnswerSipImpl

java.lang.Object
  extended by net.java.sip.communicator.service.protocol.event.CallPeerAdapter
      extended by net.java.sip.communicator.impl.protocol.sip.OperationSetAutoAnswerSipImpl
All Implemented Interfaces:
EventListener, CallPeerListener, OperationSet, OperationSetAdvancedAutoAnswer, OperationSetBasicAutoAnswer

public class OperationSetAutoAnswerSipImpl
extends CallPeerAdapter
implements OperationSetBasicAutoAnswer, OperationSetAdvancedAutoAnswer

An Operation Set defining options to auto answer/forward incoming calls. Forward calls to specified number using same provider. Auto answering calls unconditional, on existence of certain header name, or on existence of specified header name and value.

Author:
Damian Minkov

Field Summary
 
Fields inherited from interface net.java.sip.communicator.service.protocol.OperationSetBasicAutoAnswer
AUTO_ANSWER_UNCOND_PROP
 
Fields inherited from interface net.java.sip.communicator.service.protocol.OperationSetAdvancedAutoAnswer
AUTO_ANSWER_COND_NAME_PROP, AUTO_ANSWER_COND_VALUE_PROP, AUTO_ANSWER_FWD_NUM_PROP
 
Constructor Summary
OperationSetAutoAnswerSipImpl(OperationSetBasicTelephonySipImpl telephonySip)
          Creates this operation set, loads stored values, populating local variable settings.
 
Method Summary
 void clear()
          Clear any previous settings.
(package private)  boolean followCallCheck(javax.sip.message.Request invite, CallSipImpl call)
          Makes a check after creating call locally, should we answer it.
 String getAutoAnswerHeaderName()
          Returns the name of the header if conditional auto answer is set.
 String getAutoAnswerHeaderValue()
          Returns the value of the header for the conditional auto answer.
 String getCallForward()
          Get the value for automatically forward all calls to the specified number using the same provider..
 boolean isAutoAnswerConditionSet()
          Is the auto answer option set to conditionally answer all incoming calls.
 boolean isAutoAnswerUnconditionalSet()
          Is the auto answer option set to unconditionally answer all incoming calls.
 void peerStateChanged(CallPeerChangeEvent evt)
          If we peer was not in proper state wait for it and then answer.
(package private)  boolean preCallCheck(javax.sip.message.Request invite, javax.sip.ServerTransaction serverTransaction)
          Makes a check before locally creating call, should we just forward it.
 void setAutoAnswerCondition(String headerName, String value)
          Sets a specified header and its value if they exist in the incoming call packet this will activate auto answer.
 void setAutoAnswerUnconditional()
          Sets the auto answer option to unconditionally answer all incoming calls.
 void setCallForward(String numberTo)
          Set to automatically forward all calls to the specified number using the same provider.
 
Methods inherited from class net.java.sip.communicator.service.protocol.event.CallPeerAdapter
peerAddressChanged, peerDisplayNameChanged, peerImageChanged, peerTransportAddressChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationSetAutoAnswerSipImpl

OperationSetAutoAnswerSipImpl(OperationSetBasicTelephonySipImpl telephonySip)
Creates this operation set, loads stored values, populating local variable settings.

Parameters:
telephonySip - the parent opset.
Method Detail

setAutoAnswerUnconditional

public void setAutoAnswerUnconditional()
Sets the auto answer option to unconditionally answer all incoming calls.

Specified by:
setAutoAnswerUnconditional in interface OperationSetBasicAutoAnswer

isAutoAnswerUnconditionalSet

public boolean isAutoAnswerUnconditionalSet()
Is the auto answer option set to unconditionally answer all incoming calls.

Specified by:
isAutoAnswerUnconditionalSet in interface OperationSetBasicAutoAnswer
Returns:
is auto answer set to unconditional.

setAutoAnswerCondition

public void setAutoAnswerCondition(String headerName,
                                   String value)
Sets a specified header and its value if they exist in the incoming call packet this will activate auto answer. If value is empty or null it will be considered as any (will search only for a header with that name and ignore the value)

Specified by:
setAutoAnswerCondition in interface OperationSetAdvancedAutoAnswer
Parameters:
headerName - the name of the header to search
value - the value for the header, can be null.

isAutoAnswerConditionSet

public boolean isAutoAnswerConditionSet()
Is the auto answer option set to conditionally answer all incoming calls.

Specified by:
isAutoAnswerConditionSet in interface OperationSetAdvancedAutoAnswer
Returns:
is auto answer set to conditional.

setCallForward

public void setCallForward(String numberTo)
Set to automatically forward all calls to the specified number using the same provider.

Specified by:
setCallForward in interface OperationSetAdvancedAutoAnswer
Parameters:
numberTo - number to use for forwarding

getCallForward

public String getCallForward()
Get the value for automatically forward all calls to the specified number using the same provider..

Specified by:
getCallForward in interface OperationSetAdvancedAutoAnswer
Returns:
numberTo number to use for forwarding

clear

public void clear()
Clear any previous settings.

Specified by:
clear in interface OperationSetAdvancedAutoAnswer
Specified by:
clear in interface OperationSetBasicAutoAnswer

getAutoAnswerHeaderName

public String getAutoAnswerHeaderName()
Returns the name of the header if conditional auto answer is set.

Specified by:
getAutoAnswerHeaderName in interface OperationSetAdvancedAutoAnswer
Returns:
the name of the header if conditional auto answer is set.

getAutoAnswerHeaderValue

public String getAutoAnswerHeaderValue()
Returns the value of the header for the conditional auto answer.

Specified by:
getAutoAnswerHeaderValue in interface OperationSetAdvancedAutoAnswer
Returns:
the value of the header for the conditional auto answer.

preCallCheck

boolean preCallCheck(javax.sip.message.Request invite,
                     javax.sip.ServerTransaction serverTransaction)
Makes a check before locally creating call, should we just forward it.

Parameters:
invite - the current invite to check.
serverTransaction - the transaction.
Returns:
true if we have processed and no further processing is needed, false otherwise.

followCallCheck

boolean followCallCheck(javax.sip.message.Request invite,
                        CallSipImpl call)
Makes a check after creating call locally, should we answer it.

Parameters:
invite - the current invite to check.
call - the created call to answer if needed.
Returns:
true if we have processed and no further processing is needed, false otherwise.

peerStateChanged

public void peerStateChanged(CallPeerChangeEvent evt)
If we peer was not in proper state wait for it and then answer.

Specified by:
peerStateChanged in interface CallPeerListener
Overrides:
peerStateChanged in class CallPeerAdapter
Parameters:
evt - the CallPeerChangeEvent instance containing the

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.