Summary:ASTERISK-05393: [patch] "don't go backwards" timestamp mangling in calc_fakestamp prevents receiver from correctly restoring wrapped timestamps
Reporter:Steve Davies . (stevedavies)Labels:
Date Opened:2005-10-29 07:09:28Date Closed:2008-01-15 15:53:12.000-0600
Versions:Frequency of
Environment:Attachments:( 0) asterisk-iax2fixes-dontmangletimestamps.patch
calc_fakestamp is used by forward_delivery when chan_iax2 is doing native bridging from one iax2 channel to another.  its job is to "rebase" the incoming timestamps to match the "core" of the outgoing channel.

In the code there is a little "belt-and-braces check to make sure that the recalculated timestamp doesn't go backwards.  For a long time there's been a comment in there from me that its not a good idea.

This patch disables this code.

Here's why its not a good idea:

iax frames are sent mainly as mini-frames, there only have the bottom 16 bits of the timestamp.
Every time the top 16 bits change, a "full frame" is sent - which contains all 32 bits of the timestamp.

The problem is that, when frames are passed through forward_delivery, mini-frames stay mini-frames, even if it happens that the recalculation of the timestamp results in one with a different top 16 bits.

There is code in the receiving system which can correctly spot this jump back and use a heuristic to repair the damage.  it works well as long as the relative spacing of the frames is intact.

But this code in calc_rxstamp destroys the spacing, so the original stamps can't be restored.

The +1 +1 +1 +1 spacing causes the jitter buffer major indigestion.



disclaimer on file.

also, Mars is only 43 million miles from Earth at the moment - as close as it ever gets...

Comments:By: Mark Spencer (markster) 2005-10-29 13:52:56

That code should actually have never been there and is an ancient copy/paste error .  It's gone entirely.

By: Russell Bryant (russell) 2005-10-31 20:40:59.000-0600

fixed in 1.0 as well

By: Digium Subversion (svnbot) 2008-01-15 15:52:44.000-0600

Repository: asterisk
Revision: 6890

U   trunk/channels/chan_iax2.c

r6890 | markster | 2008-01-15 15:52:43 -0600 (Tue, 15 Jan 2008) | 2 lines

Remove ancient copy/paste error (bug ASTERISK-5393)



By: Digium Subversion (svnbot) 2008-01-15 15:53:12.000-0600

Repository: asterisk
Revision: 6921

U   branches/v1-0/channels/chan_iax2.c

r6921 | russell | 2008-01-15 15:53:12 -0600 (Tue, 15 Jan 2008) | 2 lines

Remove ancient copy/paste error (issue ASTERISK-5393)