com.headissue.jtapi.test
Class EventMonitor

java.lang.Object
  extended by com.headissue.jtapi.test.EventMonitor
All Implemented Interfaces:
java.util.EventListener, javax.telephony.CallListener, javax.telephony.ConnectionListener, javax.telephony.TerminalConnectionListener

public class EventMonitor
extends java.lang.Object
implements javax.telephony.TerminalConnectionListener

Register for events on all terminals and addresses and print out the signalled event plus current status.

Author:
jw

Field Summary
(package private)  java.util.HashMap call2id
           
(package private)  int callCnt
           
(package private)  java.io.PrintStream debug
           
(package private)  java.io.PrintStream output
           
(package private)  javax.telephony.Provider provider
           
 
Constructor Summary
EventMonitor(javax.telephony.Provider p)
           
EventMonitor(java.lang.String _jtapiPeer, java.lang.String _providerArguments)
           
 
Method Summary
(package private)  int calcCallId(javax.telephony.Call _call)
          Return the call id.
(package private)  java.lang.String calcConNo(javax.telephony.Connection c)
          Return the connection number within the call.
(package private)  java.lang.String calcTCId(javax.telephony.TerminalConnection tc)
          Return a unique identifier for this TerminalConnection.
 void callActive(javax.telephony.CallEvent arg0)
           
 void callEventTransmissionEnded(javax.telephony.CallEvent arg0)
           
 void callInvalid(javax.telephony.CallEvent arg0)
           
static java.lang.String callState2Name(int _state)
          Return a string representation of the call states defined by the call class.
static java.lang.String cause2Name(int _cause)
          Return a string representation of the causes defined by the javax.telephony.Event class.
 void connectionAlerting(javax.telephony.ConnectionEvent arg0)
           
 void connectionConnected(javax.telephony.ConnectionEvent arg0)
           
 void connectionCreated(javax.telephony.ConnectionEvent arg0)
           
 void connectionDisconnected(javax.telephony.ConnectionEvent arg0)
           
 void connectionFailed(javax.telephony.ConnectionEvent arg0)
           
 void connectionInProgress(javax.telephony.ConnectionEvent arg0)
           
static java.lang.String connectionState2Name(int _state)
          Return a string representation of the state defined by the Connection class.
 void connectionUnknown(javax.telephony.ConnectionEvent arg0)
           
static java.lang.String constant2Name(java.lang.Class c, java.lang.String _prefix, int _signal)
          Convert a defined constant to a string.
(package private) static java.lang.String fill(java.lang.String s, java.lang.String _pattern)
          Primitive for leading 0 or spaces.
 java.lang.Class filterInterface(java.lang.Class _interfaceType, java.lang.Class _objClass)
          Returns an implemented interface of the objects' class which is of type _interfaceType.
 void listenOnEverything()
           
static void main(java.lang.String[] args)
           
 void multiCallMetaMergeEnded(javax.telephony.MetaEvent arg0)
           
 void multiCallMetaMergeStarted(javax.telephony.MetaEvent arg0)
           
 void multiCallMetaTransferEnded(javax.telephony.MetaEvent arg0)
           
 void multiCallMetaTransferStarted(javax.telephony.MetaEvent arg0)
           
 void printCallInformation(javax.telephony.Call c)
          Print all we know about the call.
 void receiveAllEvents(java.lang.String _name, javax.telephony.Event ev)
          Receive an event and print its information
 java.lang.String shortClassName(java.lang.Class c)
           
 void showDialplan()
           
 void singleCallMetaProgressEnded(javax.telephony.MetaEvent arg0)
           
 void singleCallMetaProgressStarted(javax.telephony.MetaEvent arg0)
           
 void singleCallMetaSnapshotEnded(javax.telephony.MetaEvent arg0)
           
 void singleCallMetaSnapshotStarted(javax.telephony.MetaEvent arg0)
           
 void terminalConnectionActive(javax.telephony.TerminalConnectionEvent arg0)
           
 void terminalConnectionCreated(javax.telephony.TerminalConnectionEvent arg0)
           
 void terminalConnectionDropped(javax.telephony.TerminalConnectionEvent arg0)
           
 void terminalConnectionPassive(javax.telephony.TerminalConnectionEvent arg0)
           
 void terminalConnectionRinging(javax.telephony.TerminalConnectionEvent arg0)
           
static java.lang.String terminalConnectionState2Name(int _state)
          Return a string representation of the state defined by the TerminalConnection class.
 void terminalConnectionUnknown(javax.telephony.TerminalConnectionEvent arg0)
           
 void timeStamp()
          Print a timestamp to the output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

call2id

java.util.HashMap call2id

callCnt

int callCnt

output

java.io.PrintStream output

debug

java.io.PrintStream debug

provider

javax.telephony.Provider provider
Constructor Detail

EventMonitor

public EventMonitor(javax.telephony.Provider p)

EventMonitor

public EventMonitor(java.lang.String _jtapiPeer,
                    java.lang.String _providerArguments)
             throws javax.telephony.JtapiPeerUnavailableException
Throws:
javax.telephony.JtapiPeerUnavailableException
Method Detail

main

public static final void main(java.lang.String[] args)
                       throws java.lang.Exception
Throws:
java.lang.Exception

showDialplan

public void showDialplan()

listenOnEverything

public void listenOnEverything()

filterInterface

public java.lang.Class filterInterface(java.lang.Class _interfaceType,
                                       java.lang.Class _objClass)
Returns an implemented interface of the objects' class which is of type _interfaceType. This is used to print usefull debug information e.g. for the type of event we received.


shortClassName

public java.lang.String shortClassName(java.lang.Class c)

calcCallId

int calcCallId(javax.telephony.Call _call)
Return the call id. The call id is genereated by the EventMonitor for each unique call object.


calcConNo

java.lang.String calcConNo(javax.telephony.Connection c)
Return the connection number within the call. The format is: <callId>/<connectionNo>


calcTCId

java.lang.String calcTCId(javax.telephony.TerminalConnection tc)
Return a unique identifier for this TerminalConnection. The format is: <callId>/<connectionNo>/<terminalConnectionNo>.


constant2Name

public static java.lang.String constant2Name(java.lang.Class c,
                                             java.lang.String _prefix,
                                             int _signal)
Convert a defined constant to a string. This is used by example for the call states which are defined as Call.ACTIVE, Call.IDLE, Call.INVALID. We use the reflection API to find out the name of a constant. This is done by scanning fields that are declared static and are all upper case.

Parameters:
c - the class where the constant is defined
_prefix - a name prefix that is used if no constant is found
_signal - the signal number/constant that is defined by the class
Returns:
a string representation of the signal number

callState2Name

public static java.lang.String callState2Name(int _state)
Return a string representation of the call states defined by the call class.


terminalConnectionState2Name

public static java.lang.String terminalConnectionState2Name(int _state)
Return a string representation of the state defined by the TerminalConnection class.


connectionState2Name

public static java.lang.String connectionState2Name(int _state)
Return a string representation of the state defined by the Connection class.


cause2Name

public static java.lang.String cause2Name(int _cause)
Return a string representation of the causes defined by the javax.telephony.Event class.


printCallInformation

public void printCallInformation(javax.telephony.Call c)
Print all we know about the call. This is the state the associated connections and terminalconnections plus their information fields.


fill

static java.lang.String fill(java.lang.String s,
                             java.lang.String _pattern)
Primitive for leading 0 or spaces. Extend string to the length of _pattern by adding the first charactes of _pattern to it. E.g. a fill(num,"00") produces a two digit number. Only works for s.length<=_pattern.length.


timeStamp

public void timeStamp()
Print a timestamp to the output.


receiveAllEvents

public void receiveAllEvents(java.lang.String _name,
                             javax.telephony.Event ev)
Receive an event and print its information

Parameters:
_name - the event name
ev - the event object

terminalConnectionActive

public void terminalConnectionActive(javax.telephony.TerminalConnectionEvent arg0)
Specified by:
terminalConnectionActive in interface javax.telephony.TerminalConnectionListener

terminalConnectionCreated

public void terminalConnectionCreated(javax.telephony.TerminalConnectionEvent arg0)
Specified by:
terminalConnectionCreated in interface javax.telephony.TerminalConnectionListener

terminalConnectionDropped

public void terminalConnectionDropped(javax.telephony.TerminalConnectionEvent arg0)
Specified by:
terminalConnectionDropped in interface javax.telephony.TerminalConnectionListener

terminalConnectionPassive

public void terminalConnectionPassive(javax.telephony.TerminalConnectionEvent arg0)
Specified by:
terminalConnectionPassive in interface javax.telephony.TerminalConnectionListener

terminalConnectionRinging

public void terminalConnectionRinging(javax.telephony.TerminalConnectionEvent arg0)
Specified by:
terminalConnectionRinging in interface javax.telephony.TerminalConnectionListener

terminalConnectionUnknown

public void terminalConnectionUnknown(javax.telephony.TerminalConnectionEvent arg0)
Specified by:
terminalConnectionUnknown in interface javax.telephony.TerminalConnectionListener

connectionAlerting

public void connectionAlerting(javax.telephony.ConnectionEvent arg0)
Specified by:
connectionAlerting in interface javax.telephony.ConnectionListener

connectionConnected

public void connectionConnected(javax.telephony.ConnectionEvent arg0)
Specified by:
connectionConnected in interface javax.telephony.ConnectionListener

connectionCreated

public void connectionCreated(javax.telephony.ConnectionEvent arg0)
Specified by:
connectionCreated in interface javax.telephony.ConnectionListener

connectionDisconnected

public void connectionDisconnected(javax.telephony.ConnectionEvent arg0)
Specified by:
connectionDisconnected in interface javax.telephony.ConnectionListener

connectionFailed

public void connectionFailed(javax.telephony.ConnectionEvent arg0)
Specified by:
connectionFailed in interface javax.telephony.ConnectionListener

connectionInProgress

public void connectionInProgress(javax.telephony.ConnectionEvent arg0)
Specified by:
connectionInProgress in interface javax.telephony.ConnectionListener

connectionUnknown

public void connectionUnknown(javax.telephony.ConnectionEvent arg0)
Specified by:
connectionUnknown in interface javax.telephony.ConnectionListener

callActive

public void callActive(javax.telephony.CallEvent arg0)
Specified by:
callActive in interface javax.telephony.CallListener

callInvalid

public void callInvalid(javax.telephony.CallEvent arg0)
Specified by:
callInvalid in interface javax.telephony.CallListener

callEventTransmissionEnded

public void callEventTransmissionEnded(javax.telephony.CallEvent arg0)
Specified by:
callEventTransmissionEnded in interface javax.telephony.CallListener

singleCallMetaProgressStarted

public void singleCallMetaProgressStarted(javax.telephony.MetaEvent arg0)
Specified by:
singleCallMetaProgressStarted in interface javax.telephony.CallListener

singleCallMetaProgressEnded

public void singleCallMetaProgressEnded(javax.telephony.MetaEvent arg0)
Specified by:
singleCallMetaProgressEnded in interface javax.telephony.CallListener

singleCallMetaSnapshotStarted

public void singleCallMetaSnapshotStarted(javax.telephony.MetaEvent arg0)
Specified by:
singleCallMetaSnapshotStarted in interface javax.telephony.CallListener

singleCallMetaSnapshotEnded

public void singleCallMetaSnapshotEnded(javax.telephony.MetaEvent arg0)
Specified by:
singleCallMetaSnapshotEnded in interface javax.telephony.CallListener

multiCallMetaMergeStarted

public void multiCallMetaMergeStarted(javax.telephony.MetaEvent arg0)
Specified by:
multiCallMetaMergeStarted in interface javax.telephony.CallListener

multiCallMetaMergeEnded

public void multiCallMetaMergeEnded(javax.telephony.MetaEvent arg0)
Specified by:
multiCallMetaMergeEnded in interface javax.telephony.CallListener

multiCallMetaTransferStarted

public void multiCallMetaTransferStarted(javax.telephony.MetaEvent arg0)
Specified by:
multiCallMetaTransferStarted in interface javax.telephony.CallListener

multiCallMetaTransferEnded

public void multiCallMetaTransferEnded(javax.telephony.MetaEvent arg0)
Specified by:
multiCallMetaTransferEnded in interface javax.telephony.CallListener


Copyright 2006 headissue GmbH. All Rights Reserved.