class IAXEngine

IAX engine class. More...

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

Public Methods

Public Static Methods

Protected Methods

Protected Members


Detailed Description

This class holds all information needded to manipulate all IAX transactions and events

 IAXEngine (const char* iface, int port, u_int32_t format, u_int32_t capab, const NamedList* params = 0, const char* name = "iaxengine")

IAXEngine

Constructor

Parameters:
ifaceAddress of the interface to use, default all (0.0.0.0)
portUDP port to run the protocol on
formatDefault media format
capabMedia capabilities of this engine
paramsOptional extra parameter list
nameEngine name

 ~IAXEngine ()

~IAXEngine

[virtual]

Destructor Closes all transactions belonging to this engine and flush all queues

inline const String&  name ()

name

[const]

Retrieve the engine name

Returns: Engine name

inline u_int8_t  callerNumType ()

callerNumType

[const]

Retrieve the default caller number type

Returns: Default caller number type

inline u_int8_t  callingPres ()

callingPres

[const]

Retrieve the default caller number presentation and screening concatenated value

Returns: Default caller number presentation and screening

IAXTransaction*  addFrame (const SocketAddr& addr, IAXFrame* frame)

addFrame

Add a parsed frame to the transaction list

Parameters:
addrAddress from which the frame was received
frameA parsed IAX frame

Returns: Pointer to the transaction or 0 to deref the frame

IAXTransaction*  addFrame (const SocketAddr& addr, const unsigned char* buf, unsigned int len)

addFrame

Add a raw frame to the transaction list

Parameters:
addrAddress from which the message was received
bufPointer to the start of the buffer holding the IAX frame
lenLength of the message buffer

Returns: Pointer to the transaction or 0

IAXTransaction*  findTransaction (const SocketAddr& addr, u_int16_t rCallNo)

findTransaction

Find a complete transaction. This method is thread safe

Parameters:
addrRemote address
rCallNoRemote transaction call number

Returns: Referrenced pointer to the transaction or 0

void  processMedia (IAXTransaction* transaction, DataBlock& data, u_int32_t tStamp, int type, bool mark)

processMedia

[virtual]

Process media from remote peer. Descendents must override this method

Parameters:
transactionIAXTransaction that owns the call leg
dataMedia data
tStampMedia timestamp
typeMedia type
markMark flag

bool  process ()

process

Event processor method. Keeps calling getEvent() and passing any events to processEvent() until there are no more events

Returns: True if at least one event was processed

inline unsigned int  challengeTout ()

challengeTout

[const]

Get the timeout interval sent challenge

Returns: Sent challenge timeout interval

inline u_int16_t  maxFullFrameDataLen ()

maxFullFrameDataLen

[const]

Get the maximum allowed frame length

Returns: The maximum allowed frame length

inline u_int32_t  format (bool audio = true)

format

[const]

Get the default media format

Parameters:
audioTrue to retrieve default audio format, false for video format

Returns: The default media format

inline u_int32_t  capability ()

capability

[const]

Get the media capability of this engine

Returns: The media capability of this engine

inline void  getOutDataAdjust (unsigned int& thres, unsigned int& over, unsigned int& under)

getOutDataAdjust

[const]

Retrieve outgoing data timestamp adjust values

Parameters:
thresAdjust outgoing data timestamp threshold
overValue used to adjust outgoing data timestamp on data overrun
underValue used to adjust outgoing data timestamp on data underrun

void  initOutDataAdjust (const NamedList& params, IAXTransaction* tr = 0)

initOutDataAdjust

Initialize outgoing data timestamp adjust values. This method is thread safe

Parameters:
paramsParameters list
trOptional transaction to init, initialize the engine's data if 0

void  initialize (const NamedList& params)

initialize

(Re)Initialize the engine

Parameters:
paramsParameter list

void  readSocket (SocketAddr& addr)

readSocket

Read data from socket

Parameters:
addrSocket to read from

bool  writeSocket (const void* buf, int len, const SocketAddr& addr, IAXFullFrame* frame = 0, unsigned int* sent = 0)

writeSocket

Write data to socket.

Parameters:
bufData to write
lenData length
addrSocket to write to
frameOptional frame to be printed
sentPointer to variable to be filled with the number of bytes sent

Returns: True on success

inline bool  writeSocket (const SocketAddr& addr, IAXFullFrame* frame)

writeSocket

Write a full frame to socket

Parameters:
addrSocket to write to
frameFrame to write

Returns: True on success

void  runGetEvents ()

runGetEvents

Read events

void  removeTransaction (IAXTransaction* transaction)

removeTransaction

Removes a transaction from queue. Free the allocated local call number Does not delete it

Parameters:
transactionTransaction to remove

bool  haveTransactions ()

haveTransactions

Check if there are any transactions in the engine This method is thread safe

Returns: True if the engine holds at least 1 transaction

u_int32_t  transactionCount ()

transactionCount

Return the transactions count This method is thread safe

Returns: Transactions count

void  keepAlive (const SocketAddr& addr)

keepAlive

Send an INVAL with call numbers set to 0 to a remote peer to keep it alive

Parameters:
addrAddress to send to

bool  mediaFormatChanged (IAXTransaction* trans, int type, u_int32_t format)

mediaFormatChanged

[virtual]

Process a new format received with a full frame

Parameters:
transTransaction that received the new format
typeMedia type
formatThe received format

Returns: True if accepted

bool  checkCallToken (const SocketAddr& addr, IAXFullFrame& frame)

checkCallToken

[virtual]

Check call token on incoming call requests. This method is called by the engine when processing an incoming call request

Parameters:
addrThe address from where the call request was received
frameReceived frame

Returns: True if accepted, false to ignore the call

bool  acceptFormatAndCapability (IAXTransaction* trans, unsigned int* caps = 0, int type = IAXFormat::Audio)

acceptFormatAndCapability

Process the initial received format and capability. If accepted on exit will set the transaction format and capability

Parameters:
transTransaction that received the new format
capsOptional codecs to set in transaction before processing
typeMedia type

Returns: True if accepted

void  defaultEventHandler (IAXEvent* event)

defaultEventHandler

[virtual]

Default event handler. event MUST NOT be deleted

Parameters:
eventThe event to handle

inline bool  exiting ()

exiting

[const]

Check if the engine is exiting

Returns: True if the engine is exiting

void  setExiting ()

setExiting

[virtual]

Set the exiting flag

void  enableTrunking (IAXTransaction* trans, const NamedList* params, const String& prefix = String::empty())

enableTrunking

Enable trunking for the given transaction. Allocate a trunk meta frame if needed. Trunk data is ignored if a trunk object for transaction remote address already exists

Parameters:
transTransaction to enable trunking for
paramsTrunk parameters list, may be 0
prefixTrunk parameters name prefix

void  enableTrunking (IAXTransaction* trans, IAXTrunkInfo& data)

enableTrunking

Enable trunking for the given transaction. Allocate a trunk meta frame if needed. Trunk data is ignored if a trunk object for transaction remote address already exists

Parameters:
transTransaction to enable trunking for
dataTrunk info to use

void  initTrunkIn (IAXTransaction* trans, const NamedList* params, const String& prefix = String::empty())

initTrunkIn

Init incoming trunking data for a given transaction

Parameters:
transTransaction to init
paramsTrunk parameters list, may be 0
prefixTrunk parameters name prefix

void  initTrunkIn (IAXTransaction* trans, IAXTrunkInfo& data)

initTrunkIn

Init incoming trunking data for a given transaction

Parameters:
transTransaction to init
dataTrunk info to use

inline bool  trunkInfo (RefPointer& info)

trunkInfo

Retrieve the default trunk info data

Parameters:
infoDestination to be set with trunk info pointer

Returns: True if destination pointr is valid

void  sendInval (IAXFullFrame* frame, const SocketAddr& addr)

sendInval

Send an INVAL frame

Parameters:
frameFrame for which to send an INVAL frame
addrThe address from where the call request was received

void  runProcessTrunkFrames ()

runProcessTrunkFrames

Keep calling processTrunkFrames to send trunked media data

inline Socket&  socket ()

socket

Get the socket used for engine operation

Returns: Reference to the UDP socket

inline const SocketAddr&  addr ()

addr

[const]

Retrieve the socket address on wgich we are bound

Returns: Local address we are bound on

inline void  setFormats (u_int32_t caps, u_int32_t fmtAudio, u_int32_t fmtVideo)

setFormats

Send engine formats

Parameters:
capsCapabilities
fmtAudioDefault audio format
fmtVideoDefault video format

inline int  getPort (const NamedList& params, const String& param = "port")

getPort

[static]

Retrieve a port parameter

Parameters:
paramsParameters list
paramParameter to retrieve

Returns: The port (default, 4569, if the parameter is missing or invalid)

void  getMD5FromChallenge (String& md5data, const String& challenge, const String& password)

getMD5FromChallenge

[static]

Get the MD5 data from a challenge and a password

Parameters:
md5dataDestination String
challengeChallenge source
passwordPassword source

bool  isMD5ChallengeCorrect (const String& md5data, const String& challenge, const String& password)

isMD5ChallengeCorrect

[static]

Test if a received response to an authentication request is correct

Parameters:
md5dataData to compare with
challengeReceived challenge
passwordPassword source

void  buildAddrSecret (String& buf, const String& secret, const SocketAddr& addr)

buildAddrSecret

[static]

Build a time signed secret used to authenticate an IP address

Parameters:
bufDestination buffer
secretExtra secret to add to MD5 sum
addrSocket address

int  addrSecretAge (const String& buf, const String& secret, const SocketAddr& addr)

addrSecretAge

[static]

Decode a secret built using buildAddrSecret()

Parameters:
bufInput buffer
secretExtra secret to check
addrSocket address

Returns: Secret age, negative if invalid

inline void  addKeyword (NamedList& list, const char* param, const TokenDict* tokens, unsigned int val)

addKeyword

[static]

Add string (keyword) if found in a dictionary or integer parameter to a named list

Parameters:
listDestination list
paramParameter to add to the list
tokensThe dictionary used to find the given value
valThe value to find/add to the list

void  decodeDateTime (u_int32_t dt, unsigned int& year, unsigned int& month, unsigned int& day, unsigned int& hour, unsigned int& minute, unsigned int& sec)

decodeDateTime

[static]

Decode a DATETIME value

Parameters:
dtValue to decode
yearThe year component of the date
monthThe month component of the date
dayThe day component of the date
hourThe hour component of the time
minuteThe minute component of the time
secThe seconds component of the time

unsigned int  overallTout (unsigned int interval = IAX2_RETRANS_INTERVAL_DEF, unsigned int nRetrans = IAX2_RETRANS_COUNT_DEF)

overallTout

[static]

Calculate overall timeout from interval and retransmission counter

Parameters:
intervalThe first retransmisssion interval
nRetransThe number of retransmissions

Returns: The overall timeout

bool  processTrunkFrames (const Time& time = Time())

processTrunkFrames

[protected]

Process all trunk meta frames in the queue

Parameters:
timeTime of the call

Returns: True if at least one frame was sent

void  processEvent (IAXEvent* event)

processEvent

[protected virtual]

Default event for connection transactions handler. This method may be overriden to perform custom processing This method is thread safe

Parameters:
eventEvent to process

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

getEvent

[protected]

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

Parameters:
nowCurrent time

Returns: Pointer to an IAXEvent or 0 if none is available

u_int16_t  generateCallNo ()

generateCallNo

[protected]

Generate call number. Update used call numbers list

Returns: Call number or 0 if none available

void  releaseCallNo (u_int16_t lcallno)

releaseCallNo

[protected]

Release a call number

Parameters:
lcallnoCall number to release

IAXTransaction*  startLocalTransaction (IAXTransaction::Type type, const SocketAddr& addr, IAXIEList& ieList, bool refTrans = false, bool startTrans = true)

startLocalTransaction

[protected]

Start a transaction based on a local request

Parameters:
typeTransaction type
addrRemote address to send the request
ieListFirst frame IE list
refTransReturn a refferenced transaction pointer
startTransStart transaction

Returns: IAXTransaction pointer on success

bool  bind (const char* iface, int port, bool force)

bind

[protected]

Bind the socket. Terminate it before trying

Parameters:
ifaceAddress of the interface to use, default all (0.0.0.0)
portUDP port to run the protocol on
forceForce binding if failed on required port

Returns: True on success

int m_trunking

m_trunking

[protected]


Generated by: paulc on bussard on Mon Feb 10 13:15:47 2014, using kdoc 2.0a54.