Review Board 1.7.16

IAX2 retransmit with encryption enabled fix

Review Request #192 - Created March 10, 2009 and submitted

David Vossel
If an iax channel is encrypted, and a retransmit frame is sent, that packet's iseqno is updated while it is encrypted.  This causes the entire frame to be corrupted.  When the corrupted frame is sent, the other side decrypts it and sends a VNAK back because the decrypted frame doesn't make any sense.  When we get the VNAK, we look through the sent queue and send the same corrupted frame causing a loop.  

To fix this, encrypted frames requiring retransmission are decrypted, updated, then re-encrypted.  Since key-rotation may change the key held by the pvt struct, the keys used for encryption/decryption are held within the iax_frame to guarantee they remain correct.
tested it with and without encryption on, during packet loss of 25%.  Kept call going for several minutes.  
Review request changed
Updated (March 11, 2009, 6:26 a.m.)
fixed up Russell's comments. 
Ship it!
Posted (March 11, 2009, 6:28 a.m.)
Nice work, David! runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to