#include <CallStateEventBuilder.h>

Classes derived from this one may build events in different representations for different purposes.
Before any call events are generated, an observer event indicating the start of a new sequence event should be called:
Call Events are generated by a sequence of calls, begining with one of the call*Event methods and ending with callEventComplete. The specific calls required for each event type are documented with the method that begins the sequence.
This base class provides the
Public Types | |
| enum | ObserverEvent { ObserverReset = 101 } |
| Meta-events about the observer itself. More... | |
Public Member Functions | |
| CallStateEventBuilder (const char *observerDnsName) | |
| Instantiate an event builder and set the observer name for its events. | |
| virtual | ~CallStateEventBuilder () |
| Destructor. | |
| virtual void | observerEvent (int sequenceNumber, const OsTime ×tamp, ObserverEvent eventCode, const char *eventMsg) |
| Generate a metadata event. | |
| virtual void | callRequestEvent (int sequenceNumber, const OsTime ×tamp, const UtlString &contact, const UtlString &references, const UtlString &branch_id, int via_count, const bool callerInternal) |
| Begin a Call Request Event - an INVITE without a to tag has been observed. | |
| virtual void | callSetupEvent (int sequenceNumber, const OsTime ×tamp, const UtlString &contact, const UtlString &calleeRoute, const UtlString &branch_id, int via_count) |
| Begin a Call Setup Event - a 2xx response to an INVITE has been observed. | |
| virtual void | callFailureEvent (int sequenceNumber, const OsTime ×tamp, const UtlString &branch_id, int via_count, int statusCode, const UtlString &statusMsg) |
| Begin a Call Failure Event - an error response to an INVITE has been observed. | |
| virtual void | callEndEvent (const int sequenceNumber, const OsTime ×tamp) |
| Begin a Call End Event - a BYE request has been observed. | |
| virtual void | callTransferEvent (const int sequenceNumber, const OsTime ×tamp, const UtlString &contact, const UtlString &refer_to, const UtlString &referred_by, const UtlString &request_uri) |
| Begin a Call Transfer Event - a REFER request has been observed. | |
| virtual void | addCallData (const int cseqNumber, const UtlString &callId, const UtlString &fromTag, const UtlString &toTag, const UtlString &fromField, const UtlString &toField) |
| Add the dialog and call information for the event being built. | |
| virtual void | addEventVia (const UtlString &via) |
| Add a via element for the event. | |
| virtual void | completeCallEvent () |
| Indicates that all information for the current call event has been added. | |
| virtual bool | finishElement (UtlString &event)=0 |
Protected Types | |
| enum | BuilderMethod { InvalidEvent = -1, BuilderReset, CallRequestEvent, CallSetupEvent, CallFailureEvent, CallEndEvent, CallTransferEvent, AddCallData, AddVia, CompleteCallEvent } |
| Input events for the builderStateOk FSM. More... | |
Protected Member Functions | |
| bool | builderStateIsOk (BuilderMethod method) |
| Event validity checking state machine. | |
| bool | builderStateReset () |
| Reset the validity checking finite state machine to the initial state. | |
Protected Attributes | |
| const char * | observerName |
Private Member Functions | |
| CallStateEventBuilder (const CallStateEventBuilder &) | |
| no copy constructor | |
| CallStateEventBuilder & | operator= (const CallStateEventBuilder &) |
| no assignment operator | |
Private Attributes | |
| int | buildState |
| enum ObserverEvent |
enum BuilderMethod [protected] |
Input events for the builderStateOk FSM.
Each of these events is passed to the state machine from the correspondingly named public builder method.
| CallStateEventBuilder | ( | const char * | observerDnsName | ) |
Instantiate an event builder and set the observer name for its events.
| observerDnsName | the DNS name to be recorded in all events |
| ~CallStateEventBuilder | ( | ) | [virtual] |
Destructor.
| CallStateEventBuilder | ( | const CallStateEventBuilder & | ) | [private] |
no copy constructor
| void observerEvent | ( | int | sequenceNumber, | |
| const OsTime & | timestamp, | |||
| ObserverEvent | eventCode, | |||
| const char * | eventMsg | |||
| ) | [virtual] |
Generate a metadata event.
This method generates a complete event - it does not require that the callEventComplete method be called.
| sequenceNumber | for ObserverReset, this should be zero |
| timestamp | obtain using getCurTime(OsTime) |
| eventMsg | for human consumption |
Reimplemented in CallStateEventBuilder_DB, and CallStateEventBuilder_XML.
| void callRequestEvent | ( | int | sequenceNumber, | |
| const OsTime & | timestamp, | |||
| const UtlString & | contact, | |||
| const UtlString & | references, | |||
| const UtlString & | branch_id, | |||
| int | via_count, | |||
| const bool | callerInternal | |||
| ) | [virtual] |
Begin a Call Request Event - an INVITE without a to tag has been observed.
Requires:
| timestamp | obtain using getCurTime(OsTime) |
Reimplemented in CallStateEventBuilder_DB, and CallStateEventBuilder_XML.
| void callSetupEvent | ( | int | sequenceNumber, | |
| const OsTime & | timestamp, | |||
| const UtlString & | contact, | |||
| const UtlString & | calleeRoute, | |||
| const UtlString & | branch_id, | |||
| int | via_count | |||
| ) | [virtual] |
Begin a Call Setup Event - a 2xx response to an INVITE has been observed.
Requires:
| timestamp | obtain using getCurTime(OsTime) |
Reimplemented in CallStateEventBuilder_DB, and CallStateEventBuilder_XML.
| void callFailureEvent | ( | int | sequenceNumber, | |
| const OsTime & | timestamp, | |||
| const UtlString & | branch_id, | |||
| int | via_count, | |||
| int | statusCode, | |||
| const UtlString & | statusMsg | |||
| ) | [virtual] |
Begin a Call Failure Event - an error response to an INVITE has been observed.
Requires:
| timestamp | obtain using getCurTime(OsTime) |
Reimplemented in CallStateEventBuilder_DB, and CallStateEventBuilder_XML.
| void callEndEvent | ( | const int | sequenceNumber, | |
| const OsTime & | timestamp | |||
| ) | [virtual] |
Begin a Call End Event - a BYE request has been observed.
Requires:
| timestamp | obtain using getCurTime(OsTime) |
Reimplemented in CallStateEventBuilder_DB, and CallStateEventBuilder_XML.
| void callTransferEvent | ( | const int | sequenceNumber, | |
| const OsTime & | timeStamp, | |||
| const UtlString & | contact, | |||
| const UtlString & | refer_to, | |||
| const UtlString & | referred_by, | |||
| const UtlString & | request_uri | |||
| ) | [virtual] |
Begin a Call Transfer Event - a REFER request has been observed.
Requires:
Requires:
| timeStamp | obtain using getCurTime(OsTime) |
Reimplemented in CallStateEventBuilder_DB, and CallStateEventBuilder_XML.
| void addCallData | ( | const int | cseqNumber, | |
| const UtlString & | callId, | |||
| const UtlString & | fromTag, | |||
| const UtlString & | toTag, | |||
| const UtlString & | fromField, | |||
| const UtlString & | toField | |||
| ) | [virtual] |
Add the dialog and call information for the event being built.
| toTag | may be a null string |
| fromField | may be a null string |
Reimplemented in CallStateEventBuilder_DB, and CallStateEventBuilder_XML.
| void addEventVia | ( | const UtlString & | via | ) | [virtual] |
Add a via element for the event.
Record a Via from the message for this event Calls to this routine are in reverse cronological order - the last call for an event should be the via added by the message originator
Reimplemented in CallStateEventBuilder_DB, and CallStateEventBuilder_XML.
| void completeCallEvent | ( | ) | [virtual] |
Indicates that all information for the current call event has been added.
Reimplemented in CallStateEventBuilder_DB, and CallStateEventBuilder_XML.
| virtual bool finishElement | ( | UtlString & | event | ) | [pure virtual] |
Implemented in CallStateEventBuilder_DB, and CallStateEventBuilder_XML.
| bool builderStateIsOk | ( | BuilderMethod | method | ) | [protected] |
Event validity checking state machine.
Each of the public builder methods calls this finite state machine to determine whether or not the call is valid. This allows all builders to share the same rules for what calls are allowed and required when constructing each event type (for this reason, this should not be redefined by derived classes).
In the initial state, the only valid call is builderStateOk(BuilderReset)
In the initial state, the only valid call is builderStateOk(ObserverStart)
| bool builderStateReset | ( | ) | [protected] |
Reset the validity checking finite state machine to the initial state.
| CallStateEventBuilder& operator= | ( | const CallStateEventBuilder & | ) | [private] |
no assignment operator
const char* observerName [protected] |
int buildState [private] |