[asterisk-commits] tilghman: trunk r77267 - /trunk/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 26 08:19:08 CDT 2007


Author: tilghman
Date: Thu Jul 26 08:19:07 2007
New Revision: 77267

URL: http://svn.digium.com/view/asterisk?view=rev&rev=77267
Log:
Things expecting a positive result from ast_random() should not be surprised (closes #10308)

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=77267&r1=77266&r2=77267
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Jul 26 08:19:07 2007
@@ -6755,7 +6755,7 @@
 	}
 	
 	if (!p->sessionid) {
-		p->sessionid = (int)ast_random();
+		p->sessionid = (int)abs(ast_random());
 		p->sessionversion = p->sessionid;
 	} else
 		p->sessionversion++;
@@ -6926,7 +6926,7 @@
 
 	/* Set RTP Session ID and version */
 	if (!p->sessionid) {
-		p->sessionid = (int)ast_random();
+		p->sessionid = (int)abs(ast_random());
 		p->sessionversion = p->sessionid;
 	} else
 		p->sessionversion++;
@@ -8471,7 +8471,7 @@
 		/* SIP isn't up yet, so schedule a poke only, pretty soon */
 		if (peer->pokeexpire > -1)
 			ast_sched_del(sched, peer->pokeexpire);
-		peer->pokeexpire = ast_sched_add(sched, ast_random() % 5000 + 1, sip_poke_peer_s, peer);
+		peer->pokeexpire = ast_sched_add(sched, abs(ast_random()) % 5000 + 1, sip_poke_peer_s, peer);
 	} else
 		sip_poke_peer(peer);
 	if (peer->expire > -1)




More information about the asterisk-commits mailing list