Revert some changes to call abs() on the result of ast_random().
authorRussell Bryant <russell@russellbryant.com>
Thu, 26 Jul 2007 13:26:44 +0000 (13:26 +0000)
committerRussell Bryant <russell@russellbryant.com>
Thu, 26 Jul 2007 13:26:44 +0000 (13:26 +0000)
 * random() is defined to return a positive result, and now ast_random()
   will always do so as well

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77269 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 0a4d3ea..d375657 100644 (file)
@@ -6755,7 +6755,7 @@ static int add_t38_sdp(struct sip_request *resp, struct sip_pvt *p)
        }
        
        if (!p->sessionid) {
-               p->sessionid = (int)abs(ast_random());
+               p->sessionid = (int)ast_random();
                p->sessionversion = p->sessionid;
        } else
                p->sessionversion++;
@@ -6926,7 +6926,7 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p)
 
        /* Set RTP Session ID and version */
        if (!p->sessionid) {
-               p->sessionid = (int)abs(ast_random());
+               p->sessionid = (int)ast_random();
                p->sessionversion = p->sessionid;
        } else
                p->sessionversion++;
@@ -8471,7 +8471,7 @@ static void reg_source_db(struct sip_peer *peer)
                /* 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, abs(ast_random()) % 5000 + 1, sip_poke_peer_s, peer);
+               peer->pokeexpire = ast_sched_add(sched, ast_random() % 5000 + 1, sip_poke_peer_s, peer);
        } else
                sip_poke_peer(peer);
        if (peer->expire > -1)