[Home]

Summary:ASTERISK-14066: [patch] Sign problem calculating timestamp for iax frame leads to no audio on the receiving peer.
Reporter:Guillermo Winkler (guillecabeza)Labels:
Date Opened:2009-05-04 17:34:26Date Closed:2009-05-21 14:15:07
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_iax2
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) chan_iax2.c.patch_timestamp
( 1) chan_iax2.c.patchtimestamp
Description:There's a case when as seen from this log:

Tx-Frame Retry[000] -- OSeqno: 001 ISeqno: 003 Type: VOICE   Subclass: 136
  Timestamp: 4294967271ms  SCall: 00006  DCall: 14259 [192.168.20.199:4569]

The timestamp gets calculated wrong(due to a sign problem) resulting in all sorts of audio problems on the other side(when dealing with jitter buffer historic timestamps and you know the story).


****** ADDITIONAL INFORMATION ******

(gdb) print p->offset
$5 = {tv_sec = 1241124137, tv_usec = 640000}
(gdb) print *delivery
$6 = {tv_sec = 1241124136, tv_usec = 386000}

That is a case when the frame (coming from a SIP carrier) gets calculated wrong in calc_timestamp.

And this is the callstack for the debugging session

#0  calc_timestamp (p=0x8ac11f0, ts=0, f=0x8b1fd08)
#1  iax2_send (pvt=0x8ac11f0, f=0x8b1fd08, ts=0, seqno=-1, now=0, transfer=0, final=0)
#2  iax2_write (c=0x8b25760, f=0x8b1fd08)
#3  ast_write (chan=0x8b25760, fr=0x8b1fd08)
#4  ast_generic_bridge (c0=0x8b16680, c1=0x8b25760, config=0x5376338, fo=0x53762fc, rc=0x53762f8, bridge_end={tv_sec = 0, tv_usec = 0})
ASTERISK-1  ast_channel_bridge (c0=0x8b16680, c1=0x8b25760, config=0x5376338, fo=0x53762fc, rc=0x53762f8)
ASTERISK-2  ast_bridge_call (
Comments:By: Guillermo Winkler (guillecabeza) 2009-05-12 19:47:48

any bug marshall out there willing to check out the bug?

By: Leif Madsen (lmadsen) 2009-05-14 13:53:47

You have this issue marked as "Older 1.4" -- what version are you actually using? Is it reproducible on a current version of 1.4?

By: Leif Madsen (lmadsen) 2009-05-14 16:40:39

Set back to confirmed after talking to guillecabeza on IRC. He states that while they are using an older version of Asterisk, the same code is present in Asterisk through the 1.6.x series of Asterisk.

He has provided a patch which solves the problem on his end. Thanks!

By: Digium Subversion (svnbot) 2009-05-21 14:04:57

Repository: asterisk
Revision: 195991

U   branches/1.4/channels/chan_iax2.c

------------------------------------------------------------------------
r195991 | dvossel | 2009-05-21 14:04:57 -0500 (Thu, 21 May 2009) | 14 lines

Sign problem calculating timestamp for iax frame leads to no audio on the receiving peer.

There are rare cases in which a frame's delivery timestamp is slightly less than the iax2_pvt's offset.  This causes the pvt's timestamp to be a small negative number, but since the timestamp value is unsigned it looks like a huge positive number.  This patch checks for this negative case and sets the ms to zero.  A similar check is already done right below this one in the 'else' statement.

(closes issue ASTERISK-14066)
Reported by: guillecabeza
Patches:
     chan_iax2.c.patch_timestamp uploaded by guillecabeza (license 380)
Tested by: guillecabeza

(closes issue ASTERISK-13343)
Reported by: Andrey Sofronov


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=195991

By: Digium Subversion (svnbot) 2009-05-21 14:11:50

Repository: asterisk
Revision: 195995

_U  trunk/
U   trunk/channels/chan_iax2.c

------------------------------------------------------------------------
r195995 | dvossel | 2009-05-21 14:11:50 -0500 (Thu, 21 May 2009) | 20 lines

Merged revisions 195991 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r195991 | dvossel | 2009-05-21 14:04:56 -0500 (Thu, 21 May 2009) | 14 lines
 
 Sign problem calculating timestamp for iax frame leads to no audio on the receiving peer.
 
 There are rare cases in which a frame's delivery timestamp is slightly less than the iax2_pvt's offset.  This causes the pvt's timestamp to be a small negative number, but since the timestamp value is unsigned it looks like a huge positive number.  This patch checks for this negative case and sets the ms to zero.  A similar check is already done right below this one in the 'else' statement.
 
 (closes issue ASTERISK-14066)
 Reported by: guillecabeza
 Patches:
       chan_iax2.c.patch_timestamp uploaded by guillecabeza (license 380)
 Tested by: guillecabeza
 
 (closes issue ASTERISK-13343)
 Reported by: Andrey Sofronov
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=195995

By: Digium Subversion (svnbot) 2009-05-21 14:12:55

Repository: asterisk
Revision: 195997

_U  branches/1.6.0/
U   branches/1.6.0/channels/chan_iax2.c

------------------------------------------------------------------------
r195997 | dvossel | 2009-05-21 14:12:55 -0500 (Thu, 21 May 2009) | 27 lines

Merged revisions 195995 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r195995 | dvossel | 2009-05-21 14:11:49 -0500 (Thu, 21 May 2009) | 20 lines
 
 Merged revisions 195991 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r195991 | dvossel | 2009-05-21 14:04:56 -0500 (Thu, 21 May 2009) | 14 lines
   
   Sign problem calculating timestamp for iax frame leads to no audio on the receiving peer.
   
   There are rare cases in which a frame's delivery timestamp is slightly less than the iax2_pvt's offset.  This causes the pvt's timestamp to be a small negative number, but since the timestamp value is unsigned it looks like a huge positive number.  This patch checks for this negative case and sets the ms to zero.  A similar check is already done right below this one in the 'else' statement.
   
   (closes issue ASTERISK-14066)
   Reported by: guillecabeza
   Patches:
         chan_iax2.c.patch_timestamp uploaded by guillecabeza (license 380)
   Tested by: guillecabeza
   
   (closes issue ASTERISK-13343)
   Reported by: Andrey Sofronov
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=195997

By: Digium Subversion (svnbot) 2009-05-21 14:13:46

Repository: asterisk
Revision: 195998

_U  branches/1.6.1/
U   branches/1.6.1/channels/chan_iax2.c

------------------------------------------------------------------------
r195998 | dvossel | 2009-05-21 14:13:45 -0500 (Thu, 21 May 2009) | 27 lines

Merged revisions 195995 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r195995 | dvossel | 2009-05-21 14:11:49 -0500 (Thu, 21 May 2009) | 20 lines
 
 Merged revisions 195991 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r195991 | dvossel | 2009-05-21 14:04:56 -0500 (Thu, 21 May 2009) | 14 lines
   
   Sign problem calculating timestamp for iax frame leads to no audio on the receiving peer.
   
   There are rare cases in which a frame's delivery timestamp is slightly less than the iax2_pvt's offset.  This causes the pvt's timestamp to be a small negative number, but since the timestamp value is unsigned it looks like a huge positive number.  This patch checks for this negative case and sets the ms to zero.  A similar check is already done right below this one in the 'else' statement.
   
   (closes issue ASTERISK-14066)
   Reported by: guillecabeza
   Patches:
         chan_iax2.c.patch_timestamp uploaded by guillecabeza (license 380)
   Tested by: guillecabeza
   
   (closes issue ASTERISK-13343)
   Reported by: Andrey Sofronov
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=195998

By: Digium Subversion (svnbot) 2009-05-21 14:15:06

Repository: asterisk
Revision: 196000

_U  branches/1.6.2/
U   branches/1.6.2/channels/chan_iax2.c

------------------------------------------------------------------------
r196000 | dvossel | 2009-05-21 14:15:06 -0500 (Thu, 21 May 2009) | 27 lines

Merged revisions 195995 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r195995 | dvossel | 2009-05-21 14:11:49 -0500 (Thu, 21 May 2009) | 20 lines
 
 Merged revisions 195991 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r195991 | dvossel | 2009-05-21 14:04:56 -0500 (Thu, 21 May 2009) | 14 lines
   
   Sign problem calculating timestamp for iax frame leads to no audio on the receiving peer.
   
   There are rare cases in which a frame's delivery timestamp is slightly less than the iax2_pvt's offset.  This causes the pvt's timestamp to be a small negative number, but since the timestamp value is unsigned it looks like a huge positive number.  This patch checks for this negative case and sets the ms to zero.  A similar check is already done right below this one in the 'else' statement.
   
   (closes issue ASTERISK-14066)
   Reported by: guillecabeza
   Patches:
         chan_iax2.c.patch_timestamp uploaded by guillecabeza (license 380)
   Tested by: guillecabeza
   
   (closes issue ASTERISK-13343)
   Reported by: Andrey Sofronov
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=196000