sipXcallLib home page


PtEvent.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006 SIPez LLC.
3 // Licensed to SIPfoundry under a Contributor Agreement.
4 //
5 // Copyright (C) 2004-2006 SIPfoundry Inc.
6 // Licensed by SIPfoundry under the LGPL license.
7 //
8 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
9 // Licensed to SIPfoundry under a Contributor Agreement.
10 //
11 // $$
13 
14 
15 #ifndef _PtEvent_h_
16 #define _PtEvent_h_
17 
18 // SYSTEM INCLUDES
19 // APPLICATION INCLUDES
20 #include <utl/UtlString.h>
21 #include "ptapi/PtDefs.h"
22 
23 // DEFINES
24 #define MAX_OLD_CALLS 10
25 
26 // MACROS
27 // EXTERNAL FUNCTIONS
28 // EXTERNAL VARIABLES
29 // CONSTANTS
30 // STRUCTS
31 // TYPEDEFS
32 // FORWARD DECLARATIONS
33 class PtMetaEvent;
34 class TaoClientTask;
35 
39 
76 class PtEvent
77 {
78 /* //////////////////////////// PUBLIC //////////////////////////////////// */
79 public:
80 
82 
83  enum PtEventId
84  {
86 
87  // core
89 
90  CALL_ACTIVE = 101,
91  CALL_INVALID = 102,
93 
101 
106 
113 
115 
116  // call control
122 
131 
138 
148 
157 
162 
167 
172 
177 
182  };
183  //:Event Ids
184  // The following table defines the event ids for all of the events
185  // supported by the Pingtel system.
186  //
187  /* Provider Events */
196 
197  /* Address Events */
199  /* call control: */
205 
206  /* Terminal Events */
208 
209  /* Call Events */
217  /* call control */
222 
223  /* Multi-Call Events */
228 
229  /* Connection Events */
231  /* replaced by callctrl CONNECTION_IN_PROGRESS - Indicates that the state of the PtConnection object has changed to PtConnection::IN_PROGRESS. */
233  /* replaced by callctrl CONNECTION_CONNECTED - Indicates that the state of the PtConnection object has changed to PtConnection::CONNECTED. */
237  /* call control */
245 
246  /* Terminal Connection Events */
248  /* replaced by callctrl TERMINAL_CONNECTION_ACTIVE - Indicates that the state of the PtTerminalConnection object has changed to PtTerminalConnection::ACTIVE. */
249  /* TERMINAL_CONNECTION_PASSIVE - Indicates that the state of the PtTerminalConnection object has changed to PtTerminalConnection::PASSIVE. */
253  /* call control */
254  /* TERMINAL_CONNECTION_BRIDGED - Indicates that the state of the PtTerminalConnection object has changed to PtTerminalConnection::BRIDGED. */
256  /* TERMINAL_CONNECTION_IN_USE - Indicates that the state of the PtTerminalConnection object has changed to PtTerminalConnection::INUSE. */
258 
259  /* PhoneComponent events */
272 
274  {
275  /*
276  * WARNING: Do not change the order of these causes as they must match the JTAPI constants
277  */
278 
290 
291  // Call control
293  CAUSE_BUSY = 203,
299  CAUSE_PARK = 209,
305 
306 
307  /*
308  * These are our own constants, make sure the map in JTAPI
309  */
312  };
313  //:Event causes
314  // Specific event cause descriptions ...
326  /* call control */
342 
343  // Meta events
345  {
356  };
357  /* meta events */
367 
368 
369 
370 /* ============================ CREATORS ================================== */
371  PtEvent(int eventId = EVENT_INVALID,
372  int metaCode = 0,
373  int numOldCalls = 0,
374  const char* callId = NULL,
375  TaoClientTask *pClient = NULL,
376  int sipResponseCode = 0,
377  const char* sipResponseText = 0,
378  const char** pMetaEventCallIds = 0,
379  const char* newCallId = NULL,
380  PtEventCause cause = CAUSE_NORMAL,
381  int isLocal = -1);
382  //:Default constructor
383 
384  PtEvent(const PtEvent& rPtEvent);
385  //:Copy constructor
386 
387  virtual
388  ~PtEvent();
389  //:Destructor
390 
391 /* ============================ MANIPULATORS ============================== */
392 
393  PtEvent& operator=(const PtEvent& rhs);
394  //:Assignment operator
395 
396  virtual void setEventId(PtEventId eventId);
397  virtual void setMetaCode(PtMetaCode metaCode);
398  virtual void setEventCallId(const char* callId); // call id
399  virtual void setEventSipResponseCode(int sipResponseCode); // SIP response code
400  virtual void setEventSipResponseText(const char* sipResponseText); // SIP response text
401  virtual void setEventNewCallId(const char* newCallId); // new call id
402  virtual void setEventOldCallIds(int numOldCalls, UtlString* oldCallIds); // old call ids
403  virtual void setEventCause(PtEventCause cause); // cause
404  virtual void setEventLocal(int isLocal); // islocal?
405 
406 
407 /* ============================ ACCESSORS ================================= */
408 
409  PtStatus getId(PtEventId& rId);
410  //:Returns the event identifier.
411  // The <i>rId</i> argument is set to indicate the specific event that
412  // has occurred. For detailed descriptions of the event ids see the
413  // PtEventId enumeration.
417 
418  PtStatus getCause(PtEventCause& rCause);
419  //:Returns the cause of this event.
420  // For detailed descriptions of the event causes see the PtEventCause
421  // enumeration.
425 
426  virtual PtStatus getMetaEvent(PtBoolean& rMetaEventExists, PtMetaEvent*& pEvent) const ;
427  //:Returns meta event for this event.
428  // Meta events are used to group a set of related events. Meta events
429  // occur in pairs to indicate the start and end of the set of events.
430  // The events between, which belong to the logical set of events, will
431  // all have a meta event set to the start meta event.
434  // If this event is not associated with a meta event, <i>pEvent</i>
435  // has a eventID set to EVENT_INVALID.
438 
439  PtStatus getMetaCode(int& rMetaCode);
440  //:Returns the meta code associated with this event. The meta code provides
441  // a higher-level description of the event.
445 
446  PtStatus isNewMetaEvent(PtBoolean& rNewMetaEvent);
447  //:Returns true when this event is the start of a meta code group. This
448  // method is used to distinguish two contiguous groups of events bearing
449  // the same meta code.
453 
454  static const char* className();
455  //:Returns the name of this class.
457 
458  PtStatus getSipResponseCode(int& responseCode, UtlString& responseText);
459  //:Return the SIP response code associated with this event
463 
464 /* ============================ INQUIRY =================================== */
465  int isLocal() const ;
466  //:Return 0 if connection not local, 1 local.
467 
468  static PtBoolean isCallEvent(int eventId);
469 
470  static PtBoolean isConnectionEvent(int eventId);
471 
472  static PtBoolean isTerminalEvent(int eventId);
473 
474  static PtBoolean isTerminalComponentEvent(int eventId);
475 
476  static PtBoolean isTerminalConnectionEvent(int eventId);
477 
478  virtual PtBoolean isClass(const char* pClassName);
479  //:Determines if this object if of the specified type.
483 
484  virtual PtBoolean isInstanceOf(const char* pClassName);
485  //:Determines if this object is either an instance of or is derived from
486  //:the specified type.
490 
491  virtual PtBoolean isSame(const PtEvent& rEvent);
492  //:Compares events to determine if they are the same.
493  // Compares this event with <i>rEvent</i> to determine if they are the same event.
494  // Events are the same if they represent the same logical event occuring
495  // at the same instant on the same object.
499 
500  static PtBoolean isStateTransitionAllowed(int newState, int oldState);
501 
502 /* //////////////////////////// PROTECTED ///////////////////////////////// */
503 protected:
504 
505  int mIsLocal;
509 
512  // UtlString mOldCallIds[MAX_OLD_CALLS];
513 
514  UtlString mNewCallId;
515 
517  UtlString mCallId;
518 
520  UtlString mSipResponseText;
521 
522 
523 // PtEvent(PtEventId eventId, PtEventCause cause = CAUSE_NORMAL);
524 
525 /* //////////////////////////// PRIVATE /////////////////////////////////// */
526 private:
527 
528 };
529 
530 /* ============================ INLINE METHODS ============================ */
531 
532 #endif // _PtEvent_h_
Definition: PtEvent.h:125
Definition: PtEvent.h:98
Definition: PtEvent.h:293
PtStatus
Definition: PtDefs.h:49
Definition: PtEvent.h:146
Definition: PtEvent.h:145
virtual void setEventCause(PtEventCause cause)
Definition: PtEvent.cpp:177
Definition: PtEvent.h:285
PtEventId
Definition: PtEvent.h:83
Definition: PtEvent.h:302
Definition: PtEvent.h:121
virtual PtBoolean isInstanceOf(const char *pClassName)
param: (in) pClassName - The string to compare with the name of this class. retcode: TRUE - If the gi...
Definition: PtEvent.h:110
Definition: PtEvent.h:179
Definition: PtEvent.h:142
PtEventId mEventId
Definition: PtEvent.h:506
int mIsLocal
Definition: PtEvent.h:505
int PtBoolean
Definition: PtDefs.h:71
Definition: PtEvent.h:112
Definition: PtEvent.h:126
Definition: PtEvent.h:90
virtual PtBoolean isSame(const PtEvent &rEvent)
param: (in) pClassName - The string to compare with the name of this class. retcode: TRUE - If this o...
Definition: PtEvent.cpp:358
virtual void setMetaCode(PtMetaCode metaCode)
Definition: PtEvent.cpp:139
virtual void setEventLocal(int isLocal)
Definition: PtEvent.cpp:182
Definition: PtEvent.h:280
Definition: PtEvent.h:85
static PtBoolean isConnectionEvent(int eventId)
Definition: PtEvent.cpp:315
Definition: PtEvent.h:102
Definition: PtEvent.h:97
Definition: PtEvent.h:352
Definition: PtEvent.h:279
PtStatus getId(PtEventId &rId)
Definition: PtEvent.cpp:189
Definition: PtEvent.h:151
Definition: PtEvent.h:150
Definition: PtEvent.h:128
Definition: PtEvent.h:91
static const char * className()
param: (out) rNewMetaEvent - True if this event represents a new meta code grouping, false otherwise. retcode: PT_SUCCESS - Success retcode: PT_PROVIDER_UNAVAILABLE - The provider is not available
PtEvent & operator=(const PtEvent &rhs)
Definition: PtEvent.cpp:108
Definition: PtEvent.h:158
Definition: PtEvent.h:171
virtual void setEventSipResponseText(const char *sipResponseText)
Definition: PtEvent.cpp:154
PtEventCause mEventCause
Definition: PtEvent.h:507
Definition: PtMetaEvent.h:65
Definition: PtEvent.h:94
Definition: PtEvent.h:100
Definition: PtEvent.h:135
virtual ~PtEvent()
Definition: PtEvent.cpp:96
#define PT_CLASS_INFO_MEMBERS
Definition: PtDefs.h:73
Definition: PtEvent.h:118
Definition: PtEvent.h:297
Definition: PtEvent.h:350
char * mOldCallIds[MAX_OLD_CALLS]
Definition: PtEvent.h:511
virtual void setEventSipResponseCode(int sipResponseCode)
Definition: PtEvent.cpp:149
int mNumOldCalls
Definition: PtEvent.h:510
Definition: PtEvent.h:134
virtual void setEventNewCallId(const char *newCallId)
Definition: PtEvent.cpp:159
Definition: PtEvent.h:178
Definition: PtEvent.h:310
static PtBoolean isTerminalEvent(int eventId)
Definition: PtEvent.cpp:328
Definition: PtEvent.h:296
Definition: PtEvent.h:298
PtStatus isNewMetaEvent(PtBoolean &rNewMetaEvent)
param: (out) rMetaCode - The meta code for this event. retcode: PT_SUCCESS - Success retcode: PT_PROV...
Definition: PtEvent.h:292
Definition: PtEvent.h:139
Definition: PtEvent.h:303
static PtBoolean isStateTransitionAllowed(int newState, int oldState)
param: (in) rEvent - Event to compare with this object. retcode: TRUE - If the events are the same...
Definition: PtEvent.cpp:365
int mSipResponseCode
Definition: PtEvent.h:519
Definition: PtEvent.h:137
Definition: PtEvent.h:159
Definition: PtEvent.h:180
Definition: PtEvent.h:351
PtStatus getSipResponseCode(int &responseCode, UtlString &responseText)
returns: Returns the string representation of the name of this class
Definition: PtEvent.cpp:289
Definition: PtEvent.h:107
Definition: PtEvent.h:124
Definition: PtEvent.h:294
Definition: PtEvent.h:111
Definition: PtEvent.h:127
Definition: PtEvent.h:156
PtMetaCode
enumcode: CAUSE_CALL_CANCELLED - Cause code indicating the user has terminated call without going on-...
Definition: PtEvent.h:344
Definition: PtEvent.h:348
#define MAX_OLD_CALLS
Definition: PtEvent.h:24
virtual PtStatus getMetaEvent(PtBoolean &rMetaEventExists, PtMetaEvent *&pEvent) const
param: (out) rCause - The reference used to return the cause retcode: PT_SUCCESS - Success retcode: P...
Definition: PtEvent.cpp:218
virtual void setEventId(PtEventId eventId)
Definition: PtEvent.cpp:134
Definition: PtEvent.h:347
Definition: PtEvent.h:141
virtual PtBoolean isClass(const char *pClassName)
int isLocal() const
param: (out) responseCode - The SIP response code. param: (out) responseText - The SIP response text...
Definition: PtEvent.cpp:297
Definition: PtEvent.h:147
The PtEvent encapulates data associated with an event notification. The PtEvent is sent to an applica...
Definition: PtEvent.h:76
UtlString mCallId
Definition: PtEvent.h:517
Definition: PtEvent.h:304
TaoClientTask * mpClient
Definition: PtEvent.h:516
static PtBoolean isTerminalComponentEvent(int eventId)
Definition: PtEvent.cpp:333
Definition: PtEvent.h:99
Definition: PtEvent.h:108
Definition: PtEvent.h:287
Definition: PtEvent.h:130
Definition: PtEvent.h:132
Definition: PtEvent.h:149
Definition: PtEvent.h:119
virtual void setEventOldCallIds(int numOldCalls, UtlString *oldCallIds)
Definition: PtEvent.cpp:165
Definition: PtEvent.h:140
Definition: PtEvent.h:311
Definition: PtEvent.h:353
Definition: PtEvent.h:176
UtlString mSipResponseText
Definition: PtEvent.h:520
Definition: PtEvent.h:288
Definition: PtEvent.h:143
Definition: PtEvent.h:123
Definition: PtEvent.h:104
PtEvent(int eventId=EVENT_INVALID, int metaCode=0, int numOldCalls=0, const char *callId=NULL, TaoClientTask *pClient=NULL, int sipResponseCode=0, const char *sipResponseText=0, const char **pMetaEventCallIds=0, const char *newCallId=NULL, PtEventCause cause=CAUSE_NORMAL, int isLocal=-1)
enumcode: META_CALL_STARTING - Meta code description for the initiation or starting of a call...
Definition: PtEvent.cpp:34
Definition: PtEvent.h:109
static PtBoolean isCallEvent(int eventId)
Definition: PtEvent.cpp:302
PtEventCause
enumcode: PROVIDER_EVENT_TRANSMISSION_ENDED - Indicates that the application will no longer receive p...
Definition: PtEvent.h:273
Definition: PtEvent.h:300
Definition: PtEvent.h:355
Definition: PtEvent.h:129
Definition: PtEvent.h:96
Definition: PtEvent.h:349
Definition: PtEvent.h:105
UtlString mNewCallId
Definition: PtEvent.h:514
Definition: PtEvent.h:133
Definition: PtEvent.h:299
Definition: PtEvent.h:168
Definition: PtEvent.h:354
Definition: PtEvent.h:169
PtMetaCode mMetaCode
Definition: PtEvent.h:508
Definition: PtEvent.h:295
Definition: PtEvent.h:281
Definition: TaoClientTask.h:50
PtStatus getMetaCode(int &rMetaCode)
param: (out) rMetaEventExists - TRUE if a meta event is associated with this event. param: (out) rEvent - The reference used to return the meta event
Definition: PtEvent.cpp:212
static PtBoolean isTerminalConnectionEvent(int eventId)
Definition: PtEvent.cpp:342
Definition: PtEvent.h:153
PtStatus getCause(PtEventCause &rCause)
param: (out) rId - The reference used to return the id retcode: PT_SUCCESS - Success retcode: PT_PROV...
Definition: PtEvent.cpp:205
Definition: PtEvent.h:289
Definition: PtEvent.h:95
Definition: PtEvent.h:346
Definition: PtEvent.h:181
Definition: PtEvent.h:301
virtual void setEventCallId(const char *callId)
Definition: PtEvent.cpp:144
Definition: PtEvent.h:284
Definition: PtEvent.h:155