|
|
This class holds all the data needded for the management of an IAX2 transaction which might be a call leg, a register/unregister or a poke one
enum Type { Incorrect, New, RegReq, RegRel, Poke, } | Type |
The transaction type as enumeration
enum State { Connected, NewLocalInvite, NewLocalInvite_AuthRecv, NewLocalInvite_RepSent, NewRemoteInvite, NewRemoteInvite_AuthSent, NewRemoteInvite_RepRecv, Unknown, Terminated, Terminating, } | State |
The transaction state as enumeration
IAXTransaction* factoryIn (IAXEngine* engine, IAXFullFrame* frame, u_int16_t lcallno, const SocketAddr& addr,
void* data = 0)
| factoryIn |
[static]
Constructs an incoming transaction from a received full frame with an IAX control message that needs a new transaction
Parameters:
engine | The engine that owns this transaction |
frame | A valid full frame |
lcallno | Local call number |
addr | Address from where the frame was received |
data | Pointer to arbitrary user data |
IAXTransaction* factoryOut (IAXEngine* engine, Type type, u_int16_t lcallno, const SocketAddr& addr,
IAXIEList& ieList, void* data = 0)
| factoryOut |
[static]
Constructs an outgoing transaction with an IAX control message that needs a new transaction
Parameters:
engine | The engine that owns this transaction |
type | Transaction type |
lcallno | Local call number |
addr | Address to use |
ieList | Starting IE list |
data | Pointer to arbitrary user data |
~IAXTransaction ()
| ~IAXTransaction |
[virtual]
Destructor
inline IAXEngine* getEngine ()
| getEngine |
[const]
The IAX engine this transaction belongs to
Returns: Pointer to the IAXEngine of this transaction
inline Type type ()
| type |
[const]
Get the type of this transaction
Returns: The type of the transaction as enumeration
inline State state ()
| state |
[const]
Get the state of this transaction
Returns: The state of the transaction as enumeration
inline u_int64_t timeStamp ()
| timeStamp |
[const]
Get the timestamp of this transaction
Returns: The timestamp of this transaction
inline bool outgoing ()
| outgoing |
[const]
Get the direction of this transaction
Returns: True if it is an outgoing transaction
inline void setUserData (void* data)
| setUserData |
Store a pointer to arbitrary user data
Parameters:
data | User provided pointer |
inline void* getUserData ()
| getUserData |
[const]
Return the opaque user data stored in the transaction
Returns: Pointer set by user
inline u_int16_t localCallNo ()
| localCallNo |
[const]
Retrieve the local call number
Returns: 15-bit local call number
inline u_int16_t remoteCallNo ()
| remoteCallNo |
[const]
Retrieve the remote call number
Returns: 15-bit remote call number
inline const SocketAddr& remoteAddr ()
| remoteAddr |
[const]
Retrieve the remote host+port address
Returns: A reference to the remote address
inline const String& username ()
| username |
Retrieve the username
Returns: A reference to the username
inline const String& callingNo ()
| callingNo |
Retrieve the calling number
Returns: A reference to the calling number
inline const String& callingName ()
| callingName |
Retrieve the calling name
Returns: A reference to the calling name
inline const String& calledNo ()
| calledNo |
Retrieve the called number
Returns: A reference to the called number
inline const String& calledContext ()
| calledContext |
Retrieve the called context
Returns: A reference to the called context
inline const String& challenge ()
| challenge |
Retrieve the challenge sent/received during authentication
Returns: A reference to the challenge
inline u_int32_t format ()
| format |
Retrieve the media format used during initialization
Returns: The initial media format
inline u_int32_t formatIn ()
| formatIn |
Retrieve the incoming media format
Returns: The incoming media format
inline u_int32_t formatOut ()
| formatOut |
[const]
Retrieve the outgoing media format
Returns: The outgoing media format
inline u_int32_t capability ()
| capability |
[const]
Retrieve the media capability of this transaction
Returns: The media capability of this transaction
inline u_int32_t expire ()
| expire |
[const]
Retrieve the expiring time for a register/unregister transaction
Returns: The expiring time for a register/unregister transaction
inline const String& authdata ()
| authdata |
Retrieve the authentication data sent/received during authentication
Returns: A reference to the authentication data
IAXTransaction* processFrame (IAXFrame* frame)
| processFrame |
Process a frame from remote peer This method is thread safe.
Parameters:
frame | IAX frame belonging to this transaction to process |
Returns: 'this' if successful or NULL if the frame is invalid
IAXTransaction* processMedia (DataBlock& data, u_int32_t tStamp, bool voice = false)
| processMedia |
Process received mini frame data
Parameters:
data | Received data |
tStamp | Mini frame timestamp |
voice | True if received mini frame inside a Voice full frame |
Returns: 0
IAXTransaction* sendMedia (const DataBlock& data, u_int32_t format)
| sendMedia |
Send media data to remote peer. Update the outgoing media format if changed
Parameters:
data | Data to send |
format | Data format |
Returns: 'this' if successful or 0
IAXEvent* getEvent (u_int64_t time)
| getEvent |
Get an IAX event from the queue This method is thread safe.
Parameters:
time | The time this method was called |
Returns: Pointer to an IAXEvent or 0 if none available
unsigned char getMaxFrameList ()
| getMaxFrameList |
[static]
Get the maximum allowed number of full frames in the incoming frame list
Returns: The maximum allowed number of full frames in the incoming frame list
bool setMaxFrameList (unsigned char value)
| setMaxFrameList |
[static]
Set the maximum allowed number of full frames in the incoming frame list
Parameters:
value | The new value of m_maxInFrames |
Returns: False if value is greater then IAX2_MAX_TRANSINFRAMELIST
inline bool sendAnswer ()
| sendAnswer |
Send an ANSWER frame to remote peer This method is thread safe
Returns: False if the current transaction state is not Connected
inline bool sendRinging ()
| sendRinging |
Send a RINGING frame to remote peer This method is thread safe
Returns: False if the current transaction state is not Connected
inline bool sendProgress ()
| sendProgress |
Send a PROCEEDING frame to remote peer This method is thread safe
Returns: False if the current transaction state is not Connected
bool sendAccept ()
| sendAccept |
Send an ACCEPT/REGACK frame to remote peer This method is thread safe
Returns: False if the transaction type is not New and state is NewRemoteInvite or NewRemoteInvite_AuthRep or if the transaction type is not RegReq and state is NewRemoteInvite or type is not RegReq/RegRel and state is NewRemoteInvite_AuthRep
bool sendHangup (const char* cause = 0, u_int8_t code = 0)
| sendHangup |
Send a HANGUP frame to remote peer This method is thread safe
Parameters:
cause | Optional reason for hangup |
code | Optional code of reason |
Returns: False if the transaction type is not New or state is Terminated/Terminating
bool sendReject (const char* cause = 0, u_int8_t code = 0)
| sendReject |
Send a REJECT/REGREJ frame to remote peer This method is thread safe
Parameters:
cause | Optional reason for reject |
code | Optional code of reason |
Returns: False if the transaction type is not New/RegReq/RegRel or state is Terminated/Terminating
bool sendAuth ()
| sendAuth |
Send an AUTHREQ/REGAUTH frame to remote peer This method is thread safe
Returns: False if the current transaction state is not NewRemoteInvite
bool sendAuthReply (const String& response)
| sendAuthReply |
Send an AUTHREP/REGREQ/REGREL frame to remote peer as a response to AUTHREQ/REGREQ/REGREL This method is thread safe
Parameters:
response | Response to send |
Returns: False if the current transaction state is not NewLocalInvite_AuthRecv
inline bool sendDtmf (u_int8_t dtmf)
| sendDtmf |
Send a DTMF frame to remote peer This method is thread safe
Parameters:
dtmf | DTMF char to send |
Returns: False if the current transaction state is not Connected or dtmf is grater then 127
bool sendText (const char* text)
| sendText |
Send a TEXT frame to remote peer This method is thread safe
Parameters:
text | Text to send |
Returns: False if the current transaction state is not Connected
inline bool sendNoise (u_int8_t noise)
| sendNoise |
Send a NOISE frame to remote peer This method is thread safe
Parameters:
noise | Noise value to send |
Returns: False if the current transaction state is not Connected or noise is grater then 127
bool abortReg ()
| abortReg |
Abort a registration transaction This method is thread safe
Returns: False transaction is not a registration one or is already terminating
bool enableTrunking (IAXMetaTrunkFrame* trunkFrame)
| enableTrunking |
Enable trunking for this transaction
Parameters:
trunkFrame | Pointer to IAXMetaTrunkFrame used to send trunked media |
Returns: False trunking is already enabled for this transactio or trunkFrame is 0
void print ()
|
Print transaction data on stdin
static String s_iax_modNoAuthMethod | s_iax_modNoAuthMethod |
static String s_iax_modNoMediaFormat | s_iax_modNoMediaFormat |
static String s_iax_modInvalidAuth | s_iax_modInvalidAuth |
static String s_iax_modNoUsername | s_iax_modNoUsername |
IAXTransaction (IAXEngine* engine, IAXFullFrame* frame, u_int16_t lcallno, const SocketAddr& addr,
void* data = 0)
| IAXTransaction |
[protected]
Constructor: constructs an incoming transaction from a received full frame with an IAX control message that needs a new transaction
Parameters:
engine | The engine that owns this transaction |
frame | A valid full frame |
lcallno | Local call number |
addr | Address from where the frame was received |
data | Pointer to arbitrary user data |
IAXTransaction (IAXEngine* engine, Type type, u_int16_t lcallno, const SocketAddr& addr, IAXIEList& ieList,
void* data = 0)
| IAXTransaction |
[protected]
Constructor: constructs an outgoing transaction with an IAX control message that needs a new transaction
Parameters:
engine | The engine that owns this transaction |
type | Transaction type: see Type enumeration |
lcallno | Local call number |
addr | Address to use |
ieList | Starting IE list |
data | Pointer to arbitrary user data |
void init (IAXIEList& ieList)
| init |
[protected]
Init data members from an IE list
Parameters:
ieList | IE list to init from |
bool incrementSeqNo (const IAXFullFrame* frame, bool inbound)
| incrementSeqNo |
[protected]
Increment sequence numbers (inbound or outbound) for the frames that need it
Parameters:
frame | Received frame if inbound is true, otherwise a transmitted one |
inbound | True for inbound frames |
Returns: True if incremented.
bool isFrameAcceptable (const IAXFullFrame* frame)
| isFrameAcceptable |
[protected]
Test if frame is acceptable (not an out of order or a late one)
Parameters:
frame | Frame to test |
Returns: True if frame can be added to incoming frame list
bool changeState (State newState)
| changeState |
[protected]
Change the transaction state
Parameters:
newState | the new transaction state |
Returns: False if trying to change a termination state into a non termination one
IAXEvent* terminate (u_int8_t evType, bool local, const IAXFullFrame* frame = 0, bool createIEList = true)
| terminate |
[protected]
Terminate the transaction.
Parameters:
evType | IAXEvent type to generate |
local | If true it is a locally generated event |
frame | Frame to build event from |
createIEList | If true create IE list in the generated event |
Returns: Pointer to a valid IAXEvent
IAXEvent* waitForTerminate (u_int8_t evType, bool local, const IAXFullFrame* frame)
| waitForTerminate |
[protected]
Wait for ACK to terminate the transaction. No more events will be generated
Parameters:
evType | IAXEvent type to generate |
local | If true it is a locally generated event |
frame | Frame to build event from |
Returns: Pointer to a valid IAXEvent
void postFrame (IAXFrame::Type type, u_int32_t subclass, void* data = 0, u_int16_t len = 0, u_int32_t tStamp = 0,
bool ackOnly = false)
| postFrame |
[protected]
Constructs an IAXFrameOut frame, send it to remote peer and put it in the transmission list This method is thread safe
Parameters:
type | Frame type |
subclass | Frame subclass |
data | Frame IE list |
len | Frame IE list length |
tStamp | Frame timestamp. If 0 the transaction timestamp will be used |
ackOnly | Frame's acknoledge only flag |
bool sendFrame (IAXFrameOut* frame, bool vnak = false)
| sendFrame |
[protected]
Send a full frame to remote peer
Parameters:
frame | Frame to send |
vnak | If true the transmission is a response to a VNAK frame |
Returns: True on success
IAXEvent* createEvent (u_int8_t evType, bool local, const IAXFullFrame* frame, State newState)
| createEvent |
[protected]
Create an event
Parameters:
evType | Event type |
local | If true it is a locally generated event. |
frame | Frame to create from |
newState | The transaction new state |
Returns: Pointer to an IAXEvent or 0 (invalid IE list)
IAXEvent* createResponse (IAXFrameOut* frame, u_int8_t findType, u_int8_t findSubclass, u_int8_t evType, bool local, State newState)
| createResponse |
[protected]
Create an event from a received frame that is a response to a sent frame and change the transaction state to newState. Remove the response from incoming list.
Parameters:
frame | Frame to create response for |
findType | Frame type to find |
findSubclass | Frame subclass to find |
evType | Event type to generate |
local | Local flag for the generated event. |
newState | New transaction state if an event was generated |
Returns: Pointer to an IAXEvent or 0 (invalid IE list)
IAXEvent* getEventResponse (IAXFrameOut* frame, bool& delFrame)
| getEventResponse |
[protected]
Find a response for a previously sent frame
Parameters:
frame | Frame to find response for |
delFrame | Delete frame flag. If true on exit, a response was found |
Returns: Pointer to an IAXEvent or 0
IAXEvent* getEventResponse_New (IAXFrameOut* frame, bool& delFrame)
| getEventResponse_New |
[protected]
Find a response for a previously sent frame if the transaction type is New
Parameters:
frame | Frame to find response for |
delFrame | Delete frame flag. If true on exit, a response was found |
Returns: Pointer to an IAXEvent or 0
IAXEvent* processAuthReq (IAXEvent* event)
| processAuthReq |
[protected]
Process an authentication request. If valid, send an authentication reply
Parameters:
event | Already generated event |
Returns: Pointer to a valid IAXEvent
IAXEvent* processAccept (IAXEvent* event)
| processAccept |
[protected]
Process an accept. If not valid (call m_engine->acceptFormatAndCapability) send a reject. Otherwise return the event
Parameters:
event | Already generated event |
Returns: Pointer to a valid IAXEvent
IAXEvent* processAuthRep (IAXEvent* event)
| processAuthRep |
[protected]
Process an authentication reply
Parameters:
event | Already generated event |
Returns: Pointer to a valid IAXEvent
IAXEvent* getEventResponse_Reg (IAXFrameOut* frame, bool& delFrame)
| getEventResponse_Reg |
[protected]
Find a response for a previously sent frame if the transaction type is RegReq/RegRel
Parameters:
frame | Frame to find response for |
delFrame | Delete frame flag. If true on exit, a response was found |
Returns: Pointer to an IAXEvent or 0
IAXEvent* processRegAck (IAXEvent* event)
| processRegAck |
[protected]
Update transaction data from the event
Parameters:
event | Already generated event |
Returns: The received event
IAXEvent* getEventStartTrans (IAXFullFrame* frame, bool& delFrame)
| getEventStartTrans |
[protected]
Find out if an incoming frame would start a transaction
Parameters:
frame | Frame to process |
delFrame | Delete frame flag. If true on exit, frame is valid |
Returns: Pointer to an IAXEvent or 0
IAXEvent* getEventRequest (IAXFullFrame* frame, bool& delFrame)
| getEventRequest |
[protected]
Find out if a frame is a remote request
Parameters:
frame | Frame to process |
delFrame | Delete rame flag. If true on exit, a request was found |
Returns: Pointer to an IAXEvent or 0
IAXEvent* getEventRequest_New (IAXFullFrame* frame, bool& delFrame)
| getEventRequest_New |
[protected]
Find out if a frame is a remote request if transaction type is New
Parameters:
frame | Frame to process |
delFrame | Delete rame flag. If true on exit, a request was found |
Returns: Pointer to an IAXEvent or 0
IAXFullFrame* findInFrame (IAXFrame::Type type, u_int32_t subclass)
| findInFrame |
[protected]
Search for a frame in m_inFrames having the given type and subclass
Parameters:
type | Frame type to find. |
subclass | Frame subclass to find. |
Returns: Pointer to frame if found or 0.
bool findInFrameTimestamp (const IAXFullFrame* frameOut, IAXFrame::Type type, u_int32_t subclass)
| findInFrameTimestamp |
[protected]
Search in m_inFrames for a frame with the same timestamp as frameOut and deletes it.
Parameters:
frameOut | Frame to find response for |
type | Frame type to find |
subclass | Frame subclass to find |
Returns: True if found.
bool findInFrameAck (const IAXFullFrame* frameOut)
| findInFrameAck |
[protected]
Search in m_inFrames for an ACK frame which confirm the received frame and deletes it
Parameters:
frameOut | Frame to find response for |
Returns: True if found.
void ackInFrames ()
| ackInFrames |
[protected]
Acknoledge the last received full frame
bool sendConnected (IAXFullFrame::ControlType subclass, IAXFrame::Type frametype = IAXFrame::Control)
| sendConnected |
[protected]
Send a frame to remote peer in state Connected This method is thread safe
Parameters:
subclass | Frame subclass to send |
frametype | Frame type to send |
Returns: False if the current transaction state is not Connected
void sendAck (const IAXFullFrame* frame)
| sendAck |
[protected]
Send an ACK frame
Parameters:
frame | Aknoledged frame |
void sendInval ()
| sendInval |
[protected]
Send an INVAL frame
void sendVNAK ()
| sendVNAK |
[protected]
Send an VNAK frame
void sendUnsupport (u_int32_t subclass)
| sendUnsupport |
[protected]
Send an Unsupport frame
Parameters:
subclass | Unsupported frame's subclass |
IAXEvent* processInternalOutgoingRequest (IAXFrameOut* frame, bool& delFrame)
| processInternalOutgoingRequest |
[protected]
Internal protocol outgoing frames processing (PING/LAGRQ)
Parameters:
frame | Frame to process |
delFrame | Delete frame flag. If true on exit, a response was found |
Returns: 0.
IAXEvent* processInternalIncomingRequest (const IAXFullFrame* frame, bool& delFrame)
| processInternalIncomingRequest |
[protected]
Internal protocol incoming frames processing (PING/LAGRQ)
Parameters:
frame | Frame to process |
delFrame | Delete frame flag. If true on exit, a request was found |
Returns: 0.
IAXEvent* processMidCallControl (const IAXFullFrame* frame, bool& delFrame)
| processMidCallControl |
[protected]
Process mid call control frames
Parameters:
frame | Frame to process |
delFrame | Delete frame flag. If true on exit, a request was found |
Returns: A valid IAXEvent or 0
IAXEvent* processMidCallIAXControl (const IAXFullFrame* frame, bool& delFrame)
| processMidCallIAXControl |
[protected]
Process mid call IAX control frames
Parameters:
frame | Frame to process |
delFrame | Delete frame flag. If true on exit, a request was found |
Returns: A valid IAXEvent or 0
IAXEvent* remoteRejectCall (const IAXFullFrame* frame, bool& delFrame)
| remoteRejectCall |
[protected]
Test if frame is a Reject/RegRej frame
Parameters:
frame | Frame to process. |
delFrame | Delete frame flag. If true on exit, a request was found |
Returns: A valid IAXEvent or 0.
IAXEvent* getEventTerminating (u_int64_t time)
| getEventTerminating |
[protected]
Terminate the transaction if state is Terminating on a remote request
Parameters:
time | Current time |
Returns: A valid IAXEvent or 0
IAXTransaction* processVoiceFrame (const IAXFullFrame* frame)
| processVoiceFrame |
[protected]
Process received Voice frames
Parameters:
frame | Received voice frame |
Returns: 0
IAXTransaction* retransmitOnVNAK (u_int16_t seqNo)
| retransmitOnVNAK |
[protected]
Send all frames from outgoing queue with outbound sequence number starting with seqNo.
Parameters:
seqNo | Requested sequence number |
Returns: 0
IAXEvent* internalAccept ()
| internalAccept |
[protected]
Generate an Accept event after internally accepting a transaction
Returns: A valid IAXEvent
IAXEvent* internalReject (String& reason)
| internalReject |
[protected]
Generate a Reject event after internally rejecting a transaction
Parameters:
reason | The reason of rejecting |
Returns: A valid IAXEvent
void eventTerminated (IAXEvent* event)
| eventTerminated |
[protected]
Event terminated feedback This method is thread safe
Parameters:
event | The event notifying termination |
inline IAXEvent* keepEvent (IAXEvent* event)
| keepEvent |
[protected]
Set the current event
Parameters:
event | The event notifying termination |
Returns: event
Generated by: paulc on bussard on Tue Apr 12 17:15:21 2011, using kdoc 2.0a54. |