Yate
IAXTransaction Class Reference

An IAX2 transaction. More...

#include <yateiax.h>

Inheritance diagram for IAXTransaction:
RefObject Mutex GenObject Lockable

Public Types

enum  Type {
  Incorrect , New , RegReq , RegRel ,
  Poke
}
 
enum  State {
  Connected , NewLocalInvite , NewLocalInvite_AuthRecv , NewLocalInvite_RepSent ,
  NewRemoteInvite , NewRemoteInvite_AuthSent , NewRemoteInvite_RepRecv , Unknown ,
  Terminated , Terminating
}
 

Public Member Functions

virtual ~IAXTransaction ()
 
IAXEnginegetEngine () const
 
Type type () const
 
const char * typeName ()
 
State state () const
 
const char * stateName ()
 
u_int64_t timeStamp () const
 
bool outgoing () const
 
void setUserData (void *data)
 
void * getUserData () const
 
u_int16_t localCallNo () const
 
u_int16_t remoteCallNo () const
 
const SocketAddrremoteAddr () const
 
const Stringusername ()
 
const StringcallingNo ()
 
const StringcallingName ()
 
const StringcalledNo ()
 
const StringcalledContext ()
 
const Stringchallenge ()
 
IAXFormatgetFormat (int type)
 
IAXMediaDatagetData (int type)
 
u_int32_t format (int type)
 
u_int32_t formatIn (int type)
 
u_int32_t formatOut (int type)
 
u_int32_t capability () const
 
u_int32_t expire () const
 
const Stringauthdata ()
 
void setDestroy ()
 
void start ()
 
IAXTransactionprocessFrame (IAXFrame *frame)
 
IAXTransactionprocessMedia (DataBlock &data, u_int32_t tStamp, int type=IAXFormat::Audio, bool full=false, bool mark=false)
 
unsigned int sendMedia (const DataBlock &data, unsigned int tStamp, u_int32_t format, int type=IAXFormat::Audio, bool mark=false)
 
IAXEventgetEvent (const Time &now=Time())
 
bool sendAnswer ()
 
bool sendRinging ()
 
bool sendProgress ()
 
bool sendAccept (unsigned int *expires=0)
 
bool sendHangup (const char *cause=0, u_int8_t code=0)
 
bool sendReject (const char *cause=0, u_int8_t code=0)
 
bool sendAuth ()
 
bool sendAuthReply (const String &response)
 
bool sendDtmf (u_int8_t dtmf)
 
bool sendText (const char *text)
 
bool sendNoise (u_int8_t noise)
 
bool abortReg ()
 
bool enableTrunking (IAXMetaTrunkFrame *trunkFrame, bool efficientUse)
 
void processCallToken (const DataBlock &callToken)
 
void processMiniNoTs (u_int32_t ts, ObjList &blocks, const Time &now=Time())
 
void print (bool printStats=false, bool printFrames=false, const char *location="status")
 
- Public Member Functions inherited from RefObject
 RefObject ()
 
virtual ~RefObject ()
 
virtual void * getObject (const String &name) const
 
virtual bool alive () const
 
bool ref ()
 
bool deref ()
 
int refcount () const
 
virtual void destruct ()
 
- Public Member Functions inherited from GenObject
 GenObject ()
 
virtual ~GenObject ()
 
virtual const StringtoString () const
 
virtual const StringtraceId () const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 
- Public Member Functions inherited from Mutex
 Mutex (bool recursive=false, const char *name=0)
 
 Mutex (const Mutex &original)
 
 ~Mutex ()
 
Mutexoperator= (const Mutex &original)
 
virtual bool lock (long maxwait=-1)
 
virtual bool unlock ()
 
virtual bool locked () const
 
const char * owner () const
 
bool recursive () const
 
- Public Member Functions inherited from Lockable
virtual ~Lockable ()
 
virtual bool check (long maxwait=-1)
 
virtual bool unlockAll ()
 

Static Public Member Functions

static IAXTransactionfactoryIn (IAXEngine *engine, IAXFullFrame *frame, u_int16_t lcallno, const SocketAddr &addr, void *data=0)
 
static IAXTransactionfactoryOut (IAXEngine *engine, Type type, u_int16_t lcallno, const SocketAddr &addr, IAXIEList &ieList, void *data=0)
 
static unsigned char getMaxFrameList ()
 
static bool setMaxFrameList (unsigned char value)
 
static const char * typeName (int type)
 
static const char * stateName (int state)
 
- Static Public Member Functions inherited from RefObject
static bool alive (const RefObject *obj)
 
static bool efficientIncDec ()
 
- Static Public Member Functions inherited from GenObject
static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 
- Static Public Member Functions inherited from Mutex
static int count ()
 
static int locks ()
 
static bool efficientTimedLock ()
 
- Static Public Member Functions inherited from Lockable
static void wait (unsigned long maxwait)
 
static unsigned long wait ()
 
static void startUsingNow ()
 
static void enableSafety (bool safe=true)
 
static bool safety ()
 

Static Public Attributes

static const TokenDict s_typeName []
 
static const TokenDict s_stateName []
 
static String s_iax_modNoAuthMethod
 
static String s_iax_modNoMediaFormat
 
static String s_iax_modInvalidAuth
 
static String s_iax_modNoUsername
 

Protected Member Functions

 IAXTransaction (IAXEngine *engine, IAXFullFrame *frame, u_int16_t lcallno, const SocketAddr &addr, void *data=0)
 
 IAXTransaction (IAXEngine *engine, Type type, u_int16_t lcallno, const SocketAddr &addr, IAXIEList &ieList, void *data=0)
 
virtual void destroyed ()
 
void init (IAXIEList &ieList)
 
bool incrementSeqNo (const IAXFullFrame *frame, bool inbound)
 
bool isFrameAcceptable (const IAXFullFrame *frame)
 
bool changeState (State newState)
 
IAXEventterminate (u_int8_t evType, bool local, IAXFullFrame *frame=0, bool createIEList=true)
 
IAXEventwaitForTerminate (u_int8_t evType=0, bool local=true, IAXFullFrame *frame=0)
 
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, bool mark=false)
 
void postFrameIes (IAXFrame::Type type, u_int32_t subclass, IAXIEList *ies, u_int32_t tStamp=0, bool ackOnly=false)
 
bool sendFrame (IAXFrameOut *frame, bool vnak=false)
 
IAXEventcreateEvent (u_int8_t evType, bool local, IAXFullFrame *frame, State newState)
 
IAXEventcreateResponse (IAXFrameOut *frame, u_int8_t findType, u_int8_t findSubclass, u_int8_t evType, bool local, State newState)
 
IAXEventgetEventResponse (IAXFrameOut *frame, bool &delFrame)
 
IAXEventgetEventResponse_New (IAXFrameOut *frame, bool &delFrame)
 
IAXEventprocessAuthReq (IAXEvent *event)
 
IAXEventprocessAccept (IAXEvent *event)
 
IAXEventprocessAuthRep (IAXEvent *event)
 
IAXEventgetEventResponse_Reg (IAXFrameOut *frame, bool &delFrame)
 
IAXEventprocessRegAck (IAXEvent *event)
 
IAXEventgetEventStartTrans (IAXFullFrame *frame, bool &delFrame)
 
IAXEventgetEventRequest (IAXFullFrame *frame, bool &delFrame)
 
IAXEventgetEventRequest_New (IAXFullFrame *frame, bool &delFrame)
 
IAXFullFramefindInFrame (IAXFrame::Type type, u_int32_t subclass)
 
bool findInFrameTimestamp (const IAXFullFrame *frameOut, IAXFrame::Type type, u_int32_t subclass)
 
bool findInFrameAck (const IAXFullFrame *frameOut)
 
void ackInFrames ()
 
bool sendConnected (IAXFullFrame::ControlType subclass, IAXFrame::Type frametype=IAXFrame::Control)
 
void sendAck (const IAXFullFrame *frame)
 
void sendVNAK ()
 
void sendUnsupport (u_int32_t subclass)
 
IAXEventprocessInternalOutgoingRequest (IAXFrameOut *frame, bool &delFrame)
 
IAXEventprocessInternalIncomingRequest (const IAXFullFrame *frame, bool &delFrame)
 
IAXEventprocessMidCallControl (IAXFullFrame *frame, bool &delFrame)
 
IAXEventprocessMidCallIAXControl (IAXFullFrame *frame, bool &delFrame)
 
IAXEventremoteRejectCall (IAXFullFrame *frame, bool &delFrame)
 
IAXTransactionprocessMediaFrame (const IAXFullFrame *frame, int type)
 
IAXTransactionretransmitOnVNAK (u_int16_t seqNo)
 
IAXEventinternalReject (const char *reason, u_int8_t code)
 
void eventTerminated (IAXEvent *event)
 
IAXEventkeepEvent (IAXEvent *event)
 
- Protected Member Functions inherited from RefObject
virtual void zeroRefs ()
 
bool resurrect ()
 

Friends

class IAXEvent
 
class IAXEngine
 

Detailed Description

An IAX2 transaction.

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

Member Enumeration Documentation

◆ State

enum State

The transaction state as enumeration

◆ Type

enum Type

The transaction type as enumeration

Constructor & Destructor Documentation

◆ ~IAXTransaction()

virtual ~IAXTransaction ( )
virtual

Destructor

◆ IAXTransaction() [1/2]

IAXTransaction ( IAXEngine * engine,
IAXFullFrame * frame,
u_int16_t lcallno,
const SocketAddr & addr,
void * data = 0 )
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

Referenced by factoryIn(), factoryOut(), processFrame(), processMedia(), processMediaFrame(), and retransmitOnVNAK().

◆ IAXTransaction() [2/2]

IAXTransaction ( IAXEngine * engine,
Type type,
u_int16_t lcallno,
const SocketAddr & addr,
IAXIEList & ieList,
void * data = 0 )
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

References type().

Member Function Documentation

◆ abortReg()

bool abortReg ( )

Abort a registration transaction This method is thread safe

Returns
False transaction is not a registration one or is already terminating

◆ ackInFrames()

void ackInFrames ( )
protected

Acknoledge the last received full frame

◆ authdata()

const String & authdata ( )
inline

Retrieve the authentication data sent/received during authentication

Returns
A reference to the authentication data

◆ calledContext()

const String & calledContext ( )
inline

Retrieve the called context

Returns
A reference to the called context

◆ calledNo()

const String & calledNo ( )
inline

Retrieve the called number

Returns
A reference to the called number

◆ callingName()

const String & callingName ( )
inline

Retrieve the calling name

Returns
A reference to the calling name

◆ callingNo()

const String & callingNo ( )
inline

Retrieve the calling number

Returns
A reference to the calling number

◆ capability()

u_int32_t capability ( ) const
inline

Retrieve the media capability of this transaction

Returns
The media capability of this transaction

◆ challenge()

const String & challenge ( )
inline

Retrieve the challenge sent/received during authentication

Returns
A reference to the challenge

◆ changeState()

bool changeState ( State newState)
protected

Change the transaction state

Parameters
newStatethe new transaction state
Returns
False if trying to change a termination state into a non termination one

◆ createEvent()

IAXEvent * createEvent ( u_int8_t evType,
bool local,
IAXFullFrame * frame,
State newState )
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)

◆ createResponse()

IAXEvent * createResponse ( IAXFrameOut * frame,
u_int8_t findType,
u_int8_t findSubclass,
u_int8_t evType,
bool local,
State newState )
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)

◆ destroyed()

virtual void destroyed ( )
protectedvirtual

Cleanup

Reimplemented from RefObject.

◆ enableTrunking()

bool enableTrunking ( IAXMetaTrunkFrame * trunkFrame,
bool efficientUse )

Enable trunking for this transaction

Parameters
trunkFramePointer to IAXMetaTrunkFrame used to send trunked media
efficientUseUse or not the trunk based on calls using it
Returns
False trunking is already enabled for this transactio or trunkFrame is 0

◆ eventTerminated()

void eventTerminated ( IAXEvent * event)
protected

Event terminated feedback This method is thread safe

Parameters
eventThe event notifying termination

◆ expire()

u_int32_t expire ( ) const
inline

Retrieve the expiring time for a register/unregister transaction

Returns
The expiring time for a register/unregister transaction

◆ factoryIn()

static IAXTransaction * factoryIn ( IAXEngine * engine,
IAXFullFrame * frame,
u_int16_t lcallno,
const SocketAddr & addr,
void * data = 0 )
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

References IAXTransaction().

◆ factoryOut()

static IAXTransaction * factoryOut ( IAXEngine * engine,
Type type,
u_int16_t lcallno,
const SocketAddr & addr,
IAXIEList & ieList,
void * data = 0 )
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

References IAXTransaction(), and type().

◆ findInFrame()

IAXFullFrame * findInFrame ( IAXFrame::Type type,
u_int32_t subclass )
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.

References type().

◆ findInFrameAck()

bool findInFrameAck ( const IAXFullFrame * frameOut)
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.

◆ findInFrameTimestamp()

bool findInFrameTimestamp ( const IAXFullFrame * frameOut,
IAXFrame::Type type,
u_int32_t subclass )
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.

References type().

◆ format()

u_int32_t format ( int type)
inline

Retrieve the media format used during initialization

Parameters
typeMedia type to retrieve
Returns
The initial media format for the given type

References IAXFormat::format(), getFormat(), and type().

Referenced by sendMedia().

◆ formatIn()

u_int32_t formatIn ( int type)
inline

Retrieve the incoming media format

Parameters
typeMedia type to retrieve
Returns
The incoming media format for the given type

References getFormat(), IAXFormat::in(), and type().

◆ formatOut()

u_int32_t formatOut ( int type)
inline

Retrieve the outgoing media format

Parameters
typeMedia type to retrieve
Returns
The outgoing media format for the given type

References getFormat(), IAXFormat::out(), and type().

◆ getData()

IAXMediaData * getData ( int type)
inline

Retrieve the media data for a given type

Parameters
typeMedia type to retrieve
Returns
IAXMediaData pointer or 0 for invalid type

References type().

◆ getEngine()

IAXEngine * getEngine ( ) const
inline

The IAX engine this transaction belongs to

Returns
Pointer to the IAXEngine of this transaction

◆ getEvent()

IAXEvent * getEvent ( const Time & now = Time())

Get an IAX event from the queue This method is thread safe.

Parameters
nowCurrent time
Returns
Pointer to an IAXEvent or 0 if none available

◆ getEventRequest()

IAXEvent * getEventRequest ( IAXFullFrame * frame,
bool & delFrame )
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

◆ getEventRequest_New()

IAXEvent * getEventRequest_New ( IAXFullFrame * frame,
bool & delFrame )
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

◆ getEventResponse()

IAXEvent * getEventResponse ( IAXFrameOut * frame,
bool & delFrame )
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

◆ getEventResponse_New()

IAXEvent * getEventResponse_New ( IAXFrameOut * frame,
bool & delFrame )
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

◆ getEventResponse_Reg()

IAXEvent * getEventResponse_Reg ( IAXFrameOut * frame,
bool & delFrame )
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

◆ getEventStartTrans()

IAXEvent * getEventStartTrans ( IAXFullFrame * frame,
bool & delFrame )
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

◆ getFormat()

IAXFormat * getFormat ( int type)
inline

Retrieve the media of a given type

Parameters
typeMedia type to retrieve
Returns
IAXFormat pointer or 0 for invalid type

References type().

Referenced by format(), formatIn(), and formatOut().

◆ getMaxFrameList()

static unsigned char 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

◆ getUserData()

void * getUserData ( ) const
inline

Return the opaque user data stored in the transaction

Returns
Pointer set by user

◆ incrementSeqNo()

bool incrementSeqNo ( const IAXFullFrame * frame,
bool inbound )
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.

◆ init()

void init ( IAXIEList & ieList)
protected

Init data members from an IE list

Parameters
ieListIE list to init from

◆ internalReject()

IAXEvent * internalReject ( const char * reason,
u_int8_t code )
protected

Generate a Reject event after internally rejecting a transaction

Parameters
reasonThe reason of rejecting
codeError code
Returns
A valid IAXEvent

◆ isFrameAcceptable()

bool isFrameAcceptable ( const IAXFullFrame * frame)
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

◆ keepEvent()

IAXEvent * keepEvent ( IAXEvent * event)
inlineprotected

Set the current event

Parameters
eventThe event notifying termination
Returns
event

◆ localCallNo()

u_int16_t localCallNo ( ) const
inline

Retrieve the local call number

Returns
15-bit local call number

◆ outgoing()

bool outgoing ( ) const
inline

Get the direction of this transaction

Returns
True if it is an outgoing transaction

◆ postFrame()

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,
bool mark = false )
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
markFrame mark flag

References type().

◆ postFrameIes()

void postFrameIes ( IAXFrame::Type type,
u_int32_t subclass,
IAXIEList * ies,
u_int32_t tStamp = 0,
bool ackOnly = false )
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
iesFrame IE list
tStampFrame timestamp. If 0 the transaction timestamp will be used
ackOnlyFrame's acknoledge only flag

References type().

◆ print()

void print ( bool printStats = false,
bool printFrames = false,
const char * location = "status" )

Print transaction data on stdin

Parameters
printStatsTrue to print media statistics
printFramesTrue to print in/out pending frames
locationAdditional location info to be shown in debug

◆ processAccept()

IAXEvent * processAccept ( IAXEvent * event)
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

◆ processAuthRep()

IAXEvent * processAuthRep ( IAXEvent * event)
protected

Process an authentication reply

Parameters
eventAlready generated event
Returns
Pointer to a valid IAXEvent

◆ processAuthReq()

IAXEvent * processAuthReq ( IAXEvent * event)
protected

Process an authentication request. If valid, send an authentication reply

Parameters
eventAlready generated event
Returns
Pointer to a valid IAXEvent

◆ processCallToken()

void processCallToken ( const DataBlock & callToken)

Process a received call token This method is thread safe

Parameters
callTokenReceived call token

◆ processFrame()

IAXTransaction * processFrame ( IAXFrame * frame)

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

References IAXTransaction().

◆ processInternalIncomingRequest()

IAXEvent * processInternalIncomingRequest ( const IAXFullFrame * frame,
bool & delFrame )
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.

◆ processInternalOutgoingRequest()

IAXEvent * processInternalOutgoingRequest ( IAXFrameOut * frame,
bool & delFrame )
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.

◆ processMedia()

IAXTransaction * processMedia ( DataBlock & data,
u_int32_t tStamp,
int type = IAXFormat::Audio,
bool full = false,
bool mark = false )

Process received media data

Parameters
dataReceived data
tStampMini frame timestamp multiplied by format multiplier
typeMedia type
fullTrue if received in a full frame
markMark flag
Returns
0

References IAXTransaction(), and type().

◆ processMediaFrame()

IAXTransaction * processMediaFrame ( const IAXFullFrame * frame,
int type )
protected

Process received media full frames

Parameters
frameReceived frame
typeMedia type
Returns
0

References IAXTransaction(), and type().

◆ processMidCallControl()

IAXEvent * processMidCallControl ( IAXFullFrame * frame,
bool & delFrame )
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

◆ processMidCallIAXControl()

IAXEvent * processMidCallIAXControl ( IAXFullFrame * frame,
bool & delFrame )
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

◆ processMiniNoTs()

void processMiniNoTs ( u_int32_t ts,
ObjList & blocks,
const Time & now = Time() )

Process incoming audio miniframes from trunk without timestamps

Parameters
tsTrunk frame timestamp
blocksReceived blocks
nowCurrent time

◆ processRegAck()

IAXEvent * processRegAck ( IAXEvent * event)
protected

Update transaction data from the event

Parameters
eventAlready generated event
Returns
The received event

◆ remoteAddr()

const SocketAddr & remoteAddr ( ) const
inline

Retrieve the remote host+port address

Returns
A reference to the remote address

◆ remoteCallNo()

u_int16_t remoteCallNo ( ) const
inline

Retrieve the remote call number

Returns
15-bit remote call number

◆ remoteRejectCall()

IAXEvent * remoteRejectCall ( IAXFullFrame * frame,
bool & delFrame )
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.

◆ retransmitOnVNAK()

IAXTransaction * retransmitOnVNAK ( u_int16_t seqNo)
protected

Send all frames from outgoing queue with outbound sequence number starting with seqNo.

Parameters
seqNoRequested sequence number
Returns
0

References IAXTransaction().

◆ sendAccept()

bool sendAccept ( unsigned int * expires = 0)

Send an ACCEPT/REGACK frame to remote peer This method is thread safe

Parameters
expiresOptional pointer to expiring time for register transactions
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

◆ sendAck()

void sendAck ( const IAXFullFrame * frame)
protected

Send an ACK frame

Parameters
frameAknoledged frame

◆ sendAnswer()

bool sendAnswer ( )
inline

Send an ANSWER frame to remote peer This method is thread safe

Returns
False if the current transaction state is not Connected

References sendConnected().

◆ sendAuth()

bool sendAuth ( )

Send an AUTHREQ/REGAUTH frame to remote peer This method is thread safe

Returns
False if the current transaction state is not NewRemoteInvite

◆ sendAuthReply()

bool sendAuthReply ( const String & response)

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

◆ sendConnected()

bool sendConnected ( IAXFullFrame::ControlType subclass,
IAXFrame::Type frametype = IAXFrame::Control )
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

Referenced by sendAnswer(), sendDtmf(), sendNoise(), sendProgress(), and sendRinging().

◆ sendDtmf()

bool sendDtmf ( u_int8_t dtmf)
inline

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

References sendConnected().

◆ sendFrame()

bool sendFrame ( IAXFrameOut * frame,
bool vnak = false )
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

◆ sendHangup()

bool sendHangup ( const char * cause = 0,
u_int8_t code = 0 )

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

◆ sendMedia()

unsigned int sendMedia ( const DataBlock & data,
unsigned int tStamp,
u_int32_t format,
int type = IAXFormat::Audio,
bool mark = false )

Send media data to remote peer. Update the outgoing media format if changed

Parameters
dataData to send
tStampData timestamp
formatData format
typeMedia type
markMark flag
Returns
The number of bytes sent

References format(), and type().

◆ sendNoise()

bool sendNoise ( u_int8_t noise)
inline

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

References sendConnected().

◆ sendProgress()

bool sendProgress ( )
inline

Send a PROCEEDING frame to remote peer This method is thread safe

Returns
False if the current transaction state is not Connected

References sendConnected().

◆ sendReject()

bool sendReject ( const char * cause = 0,
u_int8_t code = 0 )

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

◆ sendRinging()

bool sendRinging ( )
inline

Send a RINGING frame to remote peer This method is thread safe

Returns
False if the current transaction state is not Connected

References sendConnected().

◆ sendText()

bool sendText ( const char * text)

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

◆ sendUnsupport()

void sendUnsupport ( u_int32_t subclass)
protected

Send an Unsupport frame

Parameters
subclassUnsupported frame's subclass

◆ sendVNAK()

void sendVNAK ( )
protected

Send an VNAK frame

◆ setDestroy()

void setDestroy ( )
inline

Set the destroy flag

◆ setMaxFrameList()

static bool setMaxFrameList ( unsigned char value)
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

◆ setUserData()

void setUserData ( void * data)
inline

Store a pointer to arbitrary user data

Parameters
dataUser provided pointer

◆ start()

void start ( )

Start an outgoing transaction. This method is thread safe

◆ state()

State state ( ) const
inline

Get the state of this transaction

Returns
The state of the transaction as enumeration

Referenced by stateName(), and stateName().

◆ stateName() [1/2]

const char * stateName ( )
inline

Retrieve the transaction state name

Returns
Transaction state name

References state(), and stateName().

Referenced by stateName().

◆ stateName() [2/2]

static const char * stateName ( int state)
inlinestatic

Retrieve transaction state name

Parameters
stateTransaction state
Returns
Requested state name

References s_stateName, and state().

◆ terminate()

IAXEvent * terminate ( u_int8_t evType,
bool local,
IAXFullFrame * frame = 0,
bool createIEList = true )
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

◆ timeStamp()

u_int64_t timeStamp ( ) const
inline

Get the timestamp of this transaction

Returns
The timestamp of this transaction

References Time::msecNow().

◆ type()

Type type ( ) const
inline

Get the type of this transaction

Returns
The type of the transaction as enumeration

Referenced by factoryOut(), findInFrame(), findInFrameTimestamp(), format(), formatIn(), formatOut(), getData(), getFormat(), IAXTransaction(), postFrame(), postFrameIes(), processMedia(), processMediaFrame(), sendMedia(), typeName(), and typeName().

◆ typeName() [1/2]

const char * typeName ( )
inline

Retrieve transaction type name

Returns
Transaction type name

References type(), and typeName().

Referenced by typeName().

◆ typeName() [2/2]

static const char * typeName ( int type)
inlinestatic

Retrieve transaction type name from transaction type

Parameters
typeTransaction type
Returns
Requested type name

References s_typeName, and type().

◆ username()

const String & username ( )
inline

Retrieve the username

Returns
A reference to the username

◆ waitForTerminate()

IAXEvent * waitForTerminate ( u_int8_t evType = 0,
bool local = true,
IAXFullFrame * frame = 0 )
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 if evType if non 0, 0 otherwise

Member Data Documentation

◆ s_iax_modInvalidAuth

String s_iax_modInvalidAuth
static

Standard message sent if the received authentication data is incorrect

◆ s_iax_modNoAuthMethod

String s_iax_modNoAuthMethod
static

Standard message sent if unsupported/unknown/none authentication methosd was received

◆ s_iax_modNoMediaFormat

String s_iax_modNoMediaFormat
static

Standard message sent if unsupported/unknown/none media format was received

◆ s_iax_modNoUsername

String s_iax_modNoUsername
static

Standard message sent if a received frame doesn't have an username information element

◆ s_stateName

const TokenDict s_stateName[]
static

Transaction state name

Referenced by stateName().

◆ s_typeName

const TokenDict s_typeName[]
static

Transaction type name

Referenced by typeName().


The documentation for this class was generated from the following file: