Index: chan_iax2.c =================================================================== --- chan_iax2.c (revision 7663) +++ chan_iax2.c (working copy) @@ -2241,7 +2241,7 @@ /* while we transition from the old JB to the new one, we can either make two schedule_delivery functions, or * make preprocessor swiss-cheese out of this one. I'm not sure which is less revolting.. */ -static int schedule_delivery(struct iax_frame *fr, int updatehistory, int fromtrunk) +static int schedule_delivery(struct iax_frame *fr, int updatehistory, int fromtrunk, unsigned int *unwrapped_ts) { #ifdef NEWJB int type, len; @@ -2268,6 +2268,9 @@ /* Attempt to recover wrapped timestamps */ unwrap_timestamp(fr); + /* Pass back unwrapped timestamp */ + if (unwrapped_ts) + *unwrapped_ts = fr->ts; if (updatehistory) { #ifndef NEWJB @@ -6393,17 +6396,13 @@ forward_delivery(&fr); } else { duped_fr = iaxfrdup2(&fr); - if (duped_fr) { - schedule_delivery(duped_fr, updatehistory, 1); - fr.ts = duped_fr->ts; - } + if (duped_fr) + schedule_delivery(duped_fr, updatehistory, 1, &fr.ts); } #else duped_fr = iaxfrdup2(&fr); - if (duped_fr) { - schedule_delivery(duped_fr, updatehistory, 1); - fr.ts = duped_fr->ts; - } + if (duped_fr) + schedule_delivery(duped_fr, updatehistory, 1, &fr.ts); #endif if (iaxs[fr.callno]->last < fr.ts) { iaxs[fr.callno]->last = fr.ts; @@ -7588,17 +7587,13 @@ forward_delivery(&fr); } else { duped_fr = iaxfrdup2(&fr); - if (duped_fr) { - schedule_delivery(duped_fr, updatehistory, 0); - fr.ts = duped_fr->ts; - } + if (duped_fr) + schedule_delivery(duped_fr, updatehistory, 0, &fr.ts); } #else duped_fr = iaxfrdup2(&fr); - if (duped_fr) { - schedule_delivery(duped_fr, updatehistory, 0); - fr.ts = duped_fr->ts; - } + if (duped_fr) + schedule_delivery(duped_fr, updatehistory, 0, &fr.ts); #endif if (iaxs[fr.callno]->last < fr.ts) {