[asterisk-dev] [IAX] ping time calculations

Yousf Ateya y.ateya at starkbits.com
Tue Mar 24 16:04:02 CDT 2015


One of the ways in which IAX calculates peer ping time is using
POKE/PONG/ACK sequence as follows:

- Peer1 sends POKE (frame timestamp is time of sending)
- Peer2 sends PONG with same time stamp received from POKE.
- Peer1 calculates ping time by doing: pong_reception_time - poke_send_time.

While using a shaky connection, sometimes ping time changes from normal
~100ms to long ping time (~2 seconds, sometimes get TOO LAGGED) for one
ping and returns to normal again.

This happens because of packet loss. Here is what happens:

- Peer1 sends POKE (it mark sending time stamp in channel member `offset`)
- POKE packet is dropped
- After sometime (qualify / 2), POKE is retried.
- Peer2 receives the POKE packet and sends PONG.
- Peer1 receives the PONG packet, and calculates ping time =
pong_receiption_time - first_poke_send_time

So ping time becomes high for short period because of a packet retry, not
because the network is slow.

Is it better to calculate ping time = pong_receiption_time -
last_poke_send_time? So we get **actual** network ping time instead of
network_ping_time + packet_retry_time.
-- 
Yousf Ateya,

-- 


This e-mail message is intended only for the use of the intended recipient(s).
The information contained therein may be confidential or privileged,
and its disclosure or reproduction is strictly prohibited.
If you are not the intended recipient, please return it immediately to its sender 
at the above address and destroy it. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150324/e6a69bc6/attachment.html>


More information about the asterisk-dev mailing list