In order to to understand IAX protocol we are going to explain a real example of communication using the main IAX messages:
A call in IAX or IAX2 has three common steps or situations:
A) Call setup
A terminal starts the connection and sends a "new" message. The called terminal replies with an "accept" message and the caller replies also with an "Ack" message. Next, the called terminal gives the "ringing" signal and the caller sends an "ack" to confirm the reception of the message. Finally, the called accepts the call with an "answer" message and the caller acknoledges that message. The, call setup is stablished.
B) Media or Audio Flow
M and F frames are sent in either direction with the audio data. Each flow is comprised mostly of IAX Mini Frames (M frames) which
contain a simple 4-byte header that targets bandwidth efficiency. The flow is supplemented by periodic Full Frames (F frames) that include
synchronization information. It is important to notice that these audio messages are using the same UDP protocol that are using the signaling messages (call setup and teardown) avoiding NAT problems.
C) Call Teardown
The connection teardown is just send a "hangup" message and acknoledge that message.