[asterisk-ha-clustering] Hi All

Matt Riddell matt at venturevoip.com
Mon Jan 7 19:39:34 CST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

JR Richardson wrote:
>> Just thought I'd post little bits of what we do so far:
>>
>> It kinda wouldn't work unless you have the same routing and billing, but
>> here goes:
>>
>> #!/usr/bin/php -q
>> <?php
>>
>> function is_alive($server, $type){
>>  if($server == NULL || $type == NULL)
>>    return false;
>>  $ping = "/usr/sbin/asterisk -rx '".$type." show peer ".$server."' |
>> grep -a Status";
>>  $output;
>>  $retval = 0;
>>  exec($ping,$output,$retval);
>>  return is_string(strstr($output[0], "OK"));
>> }
>>
>> $db_name="cdr";
>> $db_user="xxx";
>> $db_pass="xxx";
>> $connection = mysql_connect("data.venturevoip.com",$db_user, $db_pass);
>> mysql_select_db($db_name, $connection);
>>
>> $result = mysql_query("select * from providers where active<>0");
>>
>> while($row = mysql_fetch_row($result)){
>>  if($row[7] != NULL){
>>    $server = $row[5];
>>    if($row[8] != NULL)
>>      $server = $row[8];
>>    $alive = is_alive(str_replace(" ", '', strtolower($server)),$row[7]);
>>
>>    if($alive === TRUE && $row[2] === "2"){
>>      echo "Changing provider ".$row[1]." to avaliable\n";
>>      $query = "update providers set active = 1 where providerid like
>> ".$row[0];
>>      mysql_query($query) or die(mysql_error());
>>    }else if ($alive === FALSE && $row[2] === "1"){
>>      echo "Changing provider ".$row[1]." to unavaliable\n";
>>      $query = "update providers set active = 2 where providerid like
>> ".$row[0];
>>      mysql_query($query) or die(mysql_error());
>>    }else{
>>      echo "Nothing to change for ".$row[1]." ($row[0]) - ALIVE: $alive\n";
>>
>>    }
>>  }
>> }
>> ?>
>>
> 
> Very nice.  That is very intense script for each call.

Heh, thing is though, that script comes out of cron, so just updates the
routing tables once a minute.

We're now working on a new proggy to analyse RRDtool databases with
pings to and from all our points of presence.

Like:

Server A -> VoIPJet = 200ms
Server B -> VoIPJet = 120ms

Server A -> Server B = 20ms

So a call to VoIPJet originated at Server A should go through Server B.

Also, we're trying to build in some "expert system" stuff so that we can
assign weights to paths based on their quality (and ping times) and then
build up a slightly better shortest path type algorithm.

- --
Kind Regards,

Matt Riddell
Director
_______________________________________________

http://www.venturevoip.com (Great new VoIP end to end solution)
http://www.venturevoip.com/news.php (Daily Asterisk News - html)
http://www.venturevoip.com/newrssfeed.php (Daily Asterisk News - rss)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHgtRVDQNt8rg0Kp4RAr9nAJ0ftQ8GEiUEKH9NwWikJ4R+lr2e+wCZAQWL
oku/i6RxbhefkvjmJco0IWg=
=AeqB
-----END PGP SIGNATURE-----



More information about the asterisk-ha-clustering mailing list