Thursday, January 28, 2010

vicidial campaign set caller id

To set vicidial campaign set caller id just edit vicidial_extensions.conf
find your outbound dialing pattern and route

for example
##################### USA Calling ###########################
exten => _1XXXXXXXXXX,1,AGI(AGI(agi://127.0.0.1:4577/call_log)
exten => _1XXXXXXXXXX,2,Set(CALLERID(all)=122222222XX <122222222XX>)
exten => _1XXXXXXXXXX,4,Dial(sip/${EXTEN}@sip-provider,30,WtTo)
exten => _1XXXXXXXXXX,5,Hangup
####################################

Wednesday, January 27, 2010

Monitoring MySql replication

This is a sample script to monitor mysql replication
This script should have both master and slave server authentication details

#!/usr/bin/perl -w

use Mysql;
$ENV{MYSQL_UNIX_PORT} = "/tmp/mysql.sock";
# MYSQL CONFIG VARIABLES
$host = "localhost";
$database = "DB-NAME";
$user = "DB-USER";
$pw = "DB-PASS";
$host_master = "192.168.75.70";
$database_master = "DB-NAME";
$user_master = "Monitor";
$pw_master = "DB-PASS";

# PERL MYSQL CONNECT()
$connect = Mysql->connect($host, $database, $user, $pw);

# DEFINE A MySQL QUERY
$myquery = "show slave status";

# EXECUTE THE QUERY FUNCTION
$execute = $connect->query($myquery);
## Tag : Monitoring MySql replication
# FETCHROW ARRAY

@results = $execute->fetchrow();
if ( $results[11] eq "No" || $results[10] eq "No" )
{
open(SENDMAIL, "|/usr/lib/sendmail -oi -t -odq")
or die "Can't fork for sendmail: $!\n";
print SENDMAIL <<"EOF";
From: Monitor
To: Administrator
Cc: Administrator
Subject: DB-NAME DB Replication failed on slave
DB-NAME DB Replication failed
Error No -- $results[18]
Error Details --
Error -- $results[19]
EOF
close(SENDMAIL) or warn "sendmail didn't close nicely";
}
else
{
print "Db replication is good";
}
$connect2 = Mysql->connect($host_master, $database_master, $user_master, $pw_master);
$myquery2 = "show master status";
## Tag : Monitoring MySql replication
# EXECUTE THE QUERY FUNCTION
$execute2 = $connect2->query($myquery2);

# FETCHROW ARRAY

@results2 = $execute2->fetchrow();
if ( $results2[0] eq $results[5] )
{
print "DB in sync";
## Tag : Monitoring MySql replication
}
else
{
open(SENDMAIL, "|/usr/lib/sendmail -oi -t -odq")
or die "Can't fork for sendmail: $!\n";
print SENDMAIL <<"EOF";
From: Monitor
To: Administrator
Cc: Administrator
Subject: DB-NAME DB Replication not in Sync
DB-NAME DB Replication is not in Sync
Master Log File is $results2[0]
where in slave log file is $results[5]
EOF
close(SENDMAIL) or warn "sendmail didn't close nicely";
}


## Tag : Monitoring MySql replication