|
|
This class holds all information needded to manipulate all IAX transactions and events
IAXEngine (const char* iface, int port, u_int16_t transListCount, u_int16_t retransCount, u_int16_t retransInterval,
u_int16_t authTimeout, u_int16_t transTimeout, u_int16_t maxFullFrameDataLen,
u_int32_t format, u_int32_t capab, u_int32_t trunkSendInterval, bool authRequired)
| IAXEngine |
Constructor
Parameters:
iface | Address of the interface to use, default all (0.0.0.0) |
port | UDP port to run the protocol on |
transListCount | Number of entries in the transaction hash table |
retransCount | Retransmission counter for each transaction belonging to this engine |
retransInterval | Retransmission interval default value in miliseconds |
authTimeout | Timeout (in seconds) of acknoledged auth frames sent |
transTimeout | Timeout (in seconds) on remote request of transactions belonging to this engine |
maxFullFrameDataLen | Max full frame IE list (buffer) length |
format | Default media format |
capab | Media capabilities of this engine |
trunkSendInterval | Send trunk meta frame interval |
authRequired | Automatically challenge all clients for authentication |
~IAXEngine ()
| ~IAXEngine |
[virtual]
Destructor Closes all transactions belonging to this engine and flush all queues
IAXTransaction* addFrame (const SocketAddr& addr, IAXFrame* frame)
| addFrame |
Add a parsed frame to the transaction list
Parameters:
addr | Address from which the frame was received |
frame | A 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:
addr | Address from which the message was received |
buf | Pointer to the start of the buffer holding the IAX frame |
len | Length of the message buffer |
Returns: Pointer to the transaction or 0
void processMedia (IAXTransaction* transaction, DataBlock& data, u_int32_t tStamp)
| processMedia |
[virtual]
Process media from remote peer. Descendents must override this method
Parameters:
transaction | IAXTransaction that owns the call leg |
data | Media data |
tStamp | Media timestamp |
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 u_int16_t retransCount ()
| retransCount |
[const]
Get default frame retransmission counter
Returns: Frame retransmission counter
inline u_int16_t retransInterval ()
| retransInterval |
[const]
Get default frame retransmission starting interval
Returns: Frame retransmission starting interval
inline bool authRequired ()
| authRequired |
[const]
Check if a transaction should automatically request authentication
Returns: True to automatically request authentication
inline u_int16_t authTimeout ()
| authTimeout |
[const]
Get the timeout (in seconds) of acknoledged auth frames sent
Returns: Auth timeout in seconds
inline u_int32_t transactionTimeout ()
| transactionTimeout |
[const]
Get the timeout (in seconds) of transactions belonging to this engine
Returns: Timeout (in seconds) of transactions belonging to this engine
inline u_int16_t maxFullFrameDataLen ()
| maxFullFrameDataLen |
[const]
Get the maximum allowed frame length
Returns: The maximum allowed frame length
inline u_int32_t format ()
| format |
[const]
Get the default media 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
void readSocket (SocketAddr& addr)
| readSocket |
Read data from socket
Parameters:
addr | Socket to read from |
bool writeSocket (const void* buf, int len, const SocketAddr& addr, IAXFullFrame* frame = 0)
| writeSocket |
Write data to socket.
Parameters:
buf | Data to write |
len | Data length |
addr | Socket to write to |
frame | Optional frame to be printed if debug is DebugAll |
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:
transaction | Transaction to remove |
u_int32_t transactionCount ()
| transactionCount |
Return the transactions count This method is thread safe
Returns: Transactions count
void keepAlive (SocketAddr& addr)
| keepAlive |
Send an INVAL with call numbers set to 0 to a remote peer to keep it alive
Parameters:
addr | Address to send to |
bool voiceFormatChanged (IAXTransaction* trans, u_int32_t format)
| voiceFormatChanged |
[virtual]
Process a new format received with a Voice frame
Parameters:
trans | Transaction that received the new format |
format | The received format |
Returns: True if accepted
bool acceptFormatAndCapability (IAXTransaction* trans)
| acceptFormatAndCapability |
Process the initial received format and capability. If accepted on exit will set the transaction format and capability
Parameters:
trans | Transaction that received the new format |
Returns: True if accepted
void defaultEventHandler (IAXEvent* event)
| defaultEventHandler |
[virtual]
Default event handler. event MUST NOT be deleted
Parameters:
event | The event to handle |
void enableTrunking (IAXTransaction* trans)
| enableTrunking |
Enable trunking for the given transaction. Allocate a trunk meta frame if needded
Parameters:
trans | Transaction to enable trunking for |
void removeTrunkFrame (IAXMetaTrunkFrame* metaFrame)
| removeTrunkFrame |
Remove a trunk meta frame from the queue and deref it
Parameters:
metaFrame | The trunk meta frame to remove |
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
void getMD5FromChallenge (String& md5data, const String& challenge, const String& password)
| getMD5FromChallenge |
[static]
Get the MD5 data from a challenge and a password
Parameters:
md5data | Destination String |
challenge | Challenge source |
password | Password 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:
md5data | Data to compare with |
challenge | Received challenge |
password | Password source |
bool processTrunkFrames (u_int32_t time = Time::msecNow())
| processTrunkFrames |
[protected]
Process all trunk meta frames in the queue
Parameters:
time | Time 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:
event | Event to process |
IAXEvent* getEvent (u_int64_t time)
| getEvent |
[protected]
Get an IAX event from the queue. This method is thread safe.
Parameters:
time | Time of the call |
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:
lcallno | Call number to release |
IAXTransaction* startLocalTransaction (IAXTransaction::Type type, const SocketAddr& addr, IAXIEList& ieList, bool trunking = false)
| startLocalTransaction |
[protected]
Start a transaction based on a local request
Parameters:
type | Transaction type |
addr | Remote address to send the request |
ieList | First frame IE list |
trunking | Enable/disable trunking for this transaction |
Returns: IAXTransaction pointer on success.
Generated by: paulc on bussard on Tue Mar 8 18:42:27 2011, using kdoc 2.0a54. |