class IAXTransaction

An IAX2 transaction. More...

Full nameTelEngine::IAXTransaction
Definition#include <libs/yiax/yateiax.h>
InheritsTelEngine::Mutex [public ], TelEngine::RefObject [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Static Methods

Public Members

Protected Methods


Detailed Description

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:
engineThe engine that owns this transaction
frameA valid full frame
lcallnoLocal call number
addrAddress from where the frame was received
dataPointer 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:
engineThe engine that owns this transaction
typeTransaction type
lcallnoLocal call number
addrAddress to use
ieListStarting IE list
dataPointer 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:
dataUser 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:
frameIAX 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:
dataReceived data
tStampMini frame timestamp
voiceTrue 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:
dataData to send
formatData 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:
timeThe 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:
valueThe 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:
causeOptional reason for hangup
codeOptional 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:
causeOptional reason for reject
codeOptional 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:
responseResponse 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:
dtmfDTMF 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:
textText 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:
noiseNoise 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:
trunkFramePointer to IAXMetaTrunkFrame used to send trunked media

Returns: False trunking is already enabled for this transactio or trunkFrame is 0

void  print ()

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:
engineThe engine that owns this transaction
frameA valid full frame
lcallnoLocal call number
addrAddress from where the frame was received
dataPointer 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:
engineThe engine that owns this transaction
typeTransaction type: see Type enumeration
lcallnoLocal call number
addrAddress to use
ieListStarting IE list
dataPointer to arbitrary user data

void  init (IAXIEList& ieList)

init

[protected]

Init data members from an IE list

Parameters:
ieListIE 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:
frameReceived frame if inbound is true, otherwise a transmitted one
inboundTrue 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:
frameFrame to test

Returns: True if frame can be added to incoming frame list

bool  changeState (State newState)

changeState

[protected]

Change the transaction state

Parameters:
newStatethe 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:
evTypeIAXEvent type to generate
localIf true it is a locally generated event
frameFrame to build event from
createIEListIf 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:
evTypeIAXEvent type to generate
localIf true it is a locally generated event
frameFrame 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:
typeFrame type
subclassFrame subclass
dataFrame IE list
lenFrame IE list length
tStampFrame timestamp. If 0 the transaction timestamp will be used
ackOnlyFrame's acknoledge only flag

bool  sendFrame (IAXFrameOut* frame, bool vnak = false)

sendFrame

[protected]

Send a full frame to remote peer

Parameters:
frameFrame to send
vnakIf 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:
evTypeEvent type
localIf true it is a locally generated event.
frameFrame to create from
newStateThe 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:
frameFrame to create response for
findTypeFrame type to find
findSubclassFrame subclass to find
evTypeEvent type to generate
localLocal flag for the generated event.
newStateNew 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:
frameFrame to find response for
delFrameDelete 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:
frameFrame to find response for
delFrameDelete 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:
eventAlready 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:
eventAlready generated event

Returns: Pointer to a valid IAXEvent

IAXEvent*  processAuthRep (IAXEvent* event)

processAuthRep

[protected]

Process an authentication reply

Parameters:
eventAlready 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:
frameFrame to find response for
delFrameDelete 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:
eventAlready 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:
frameFrame to process
delFrameDelete 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:
frameFrame to process
delFrameDelete 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:
frameFrame to process
delFrameDelete 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:
typeFrame type to find.
subclassFrame 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:
frameOutFrame to find response for
typeFrame type to find
subclassFrame 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:
frameOutFrame 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:
subclassFrame subclass to send
frametypeFrame 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:
frameAknoledged 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:
subclassUnsupported frame's subclass

IAXEvent*  processInternalOutgoingRequest (IAXFrameOut* frame, bool& delFrame)

processInternalOutgoingRequest

[protected]

Internal protocol outgoing frames processing (PING/LAGRQ)

Parameters:
frameFrame to process
delFrameDelete 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:
frameFrame to process
delFrameDelete 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:
frameFrame to process
delFrameDelete 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:
frameFrame to process
delFrameDelete 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:
frameFrame to process.
delFrameDelete 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:
timeCurrent time

Returns: A valid IAXEvent or 0

IAXTransaction*  processVoiceFrame (const IAXFullFrame* frame)

processVoiceFrame

[protected]

Process received Voice frames

Parameters:
frameReceived 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:
seqNoRequested 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:
reasonThe reason of rejecting

Returns: A valid IAXEvent

void  eventTerminated (IAXEvent* event)

eventTerminated

[protected]

Event terminated feedback This method is thread safe

Parameters:
eventThe event notifying termination

inline IAXEvent*  keepEvent (IAXEvent* event)

keepEvent

[protected]

Set the current event

Parameters:
eventThe event notifying termination

Returns: event


Generated by: paulc on bussard on Tue Mar 8 18:42:27 2011, using kdoc 2.0a54.