YIAX design
IAXInfoElement
Holds a single text Information Element that is attached to a message.
IAXInfoElementNumeric
Holds a single 1, 2 or 4 byte length Information Element that is attached to a message.
IAXFormat
Holds the enumeration values for audio and video formats.
IAXFrame
Holds an IAX mini or meta frame. Received frame parser.
IAXFullFrame
Holds an IAX full frame.
IAXFrameOut
Holds enough information to manage an outgoing frame.
IAXEvent
Holds a message (event) for the client.
IAXTransaction
Holds enough information to manage a link between 2 peers. Keep incoming/outgoing frame lists. IAX protocol management. Data transfer between the two peers involved in the transaction.
IAXEngine
Transactions manager. Read/write data from/to socket. Creates transactions. Notify the client and the remote peer on transaction state change.
The following actions are asynchronously done by IAXEngine:
- Read data from socket.
- Write data to socket.
- Generate events.
When receiving a valid request from as remote peer to create a new transaction, creates it and notify the client, unless the new transaction is an internally processed one (such as a POKE request, which will not generate any event): - Parse received data. - Generate a local number identifier. - Create an IAXTransaction (giving it an IAXFullFrame). - Put it in the transactions list. - Notify the client (IAXEvent).
When the client requests a new transaction: - Generate a local number identifier. - Create an IAXTransaction (giving it the transaction type). - Put it in the transactions list. - Notify the client (IAXEvent) when the remote peer will respond.
Any received frame from the remote peer or command from the client is passed to the transaction
After creation, when the link has been established, IAXTransaction manages the IAX protocol for the link. On IAXEngine demand will change his state, generating an event, if necessary. Audio data is transferred asynchronously until a request to stop is received from the client or from the remote peer.
Internally, IAXTransaction keeps an IAXFullFrame list containing the incoming frames and an IAXFrameOut list containing the outgoing frames list. When requested, the transaction check his state, take some action (depending on it). If the state changes notify the appropriate peer(s).