diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 8346dc5655692fc700a07ae108784046372a791a..bec162f22263d8481231370a25f5457f7fc7904f 100755
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -2868,9 +2868,12 @@ static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, str
 				* next multiple of frame size (so our
 				* silent periods are multiples of
 				* frame size too) */
-				int diff = ms % (f->samples / 8);
-				if(diff)
-				    ms += f->samples/8 - diff;
+				if (f->samples / 8) /* check to make sure we dont core dump */
+				{
+					int diff = ms % (f->samples / 8);
+					if (diff)
+					    ms += f->samples/8 - diff;
+				}
 
 				p->nextpred = ms;
 				p->notsilenttx = 1;