19 Temmuz 2010 Pazartesi

Automated Test Calls

The most effective way of monitoring a Telecommunication system is placing regular test calls.

I have got tired of placing manuel test calls. Thus I have automated the test call process for SIP devices.

1. Create static gateway accounts for the poller IP address on the softswitch side.

2. Create a route for the test number and return a spesific reject reason code for checking success. In my case I used Busy (486). Do this in your outmost softswitch to check everything is ok on your system.

3. Download and compile sipsak utility for handling sip session.

wget http://download.berlios.de/sipsak/sipsak-0.9.6-1.tar.gz
gunzip sipsak-0.9.6-1.tar.gz
tar xvf sipsak-0.9.6-1.tar
cd sipsak-0.9.6
make install

4. Create a perl script for building INVITE for sipsak. gencall.pl in my example. You may need to change this invite message according to your softswitch if you have problems.


print "INVITE sip:".$ARGV[0]."@".$ARGV[1]." SIP/2.0\n";
print "From: test <sip:test@".$ARGV[1].">;tag=2764495678\n";
print "To: <sip:".$ARGV[0]."@".$ARGV[0].">\n";
print "Contact: <sip:test@local_ip_address_here:5060>\n";
print "Call-ID: B528090B-8FB8-4C26-A64E-155".int(rand(10000))."@local_ip_address_here\n";
print "CSeq: ".int(rand(10000))." INVITE\n";
print "Max-Forwards: 70\n";
print "Content-Type: application/sdp\n";
print "User-Agent: TestAPP\n";
print "Content-Length: 208\n";
print "\n";
print "v=0\n";
print "o=test 369949494 369949510 IN IP4 local_ip_address_here\n";
print "s=TestAPP\n";
print "c=IN IP4 local_ip_address_here\n";
print "t=0 0\n";
print "m=audio 8000 RTP/AVP 18 101\n";
print "a=rtpmap:18 G729/8000\n";
print "a=rtpmap:101 telephone-event/8000\n";
print "a=fmtp:101 0-15\n";
print "a=sendrecv\n";

5. Create a testcall script that will execute in every 10 minutes and send you an email if less than %50 asr. testcall.pl in my example.

#!/usr/bin/perl -w

# Insert your constants here

my $MAILSENDER='testcall@nazir.biz'; # Insert your mail Sender here
my $SENDTO='huseyin@nazir.biz'; # Insert mails to send the report here

my $dialed_number='901111234567';
my $servers_to_check;


my $CLLres='';

sub send_call
#print "./gencall.pl ".$_[0]." ".$_[1]." | sipsak -vvv -f - -s sip:".$_[0]."@".$_[1]." >callres\n";
open (CLL, "|/testcall/gencall.pl ".$_[0]." ".$_[1]." | /usr/local/bin/sipsak -vvv -f - -s sip:".$_[0]."@".$_[1]." >callres\n");
close (CLL);
open ($CLLres, 'callres');

my $success=0;
while (<$CLLres>)
#print $_;

if (rindex($_,'486') ne -1)
#print "\n\n\n****SUCCESS****\n\n\n";

close $CLLres;
system ("rm callres\n");

return $success;

for($j = 1; $j <= $max_servers; $j++)
my $check=0;

for($i = 1; $i < 5; $i++) {
$check=$check+send_call($dialed_number, $servers_to_check[$j]);

my $checkfile="/tmp/check_".$servers_to_check[$j];

if ($check>1)
#remove file
print "\n\n\n****SUCCESS****\n\n\n";


if ($check<2 && !(-e $checkfile))

#create file
open FILE, ">", $checkfile;
print FILE ".";
close FILE;

print "Sending Mail\n";

open (MAIL, "| /usr/sbin/sendmail -t");

print MAIL "To: $SENDTO\n";
print MAIL "From: $MAILSENDER\n";
print MAIL "Subject: SIP Server Failure : ".$servers_to_check[$j]."\n\n";

print MAIL "Please Check the server to avoid problems\n\n";
print MAIL "Host Information : ".$servers_to_check[$j]."\n\n";

close (MAIL);


6. create a cron job to execute a test call regularly. Every 10 minutes in my example.

crontab -e
*/10 * * * * /testcall/testall.pl

BIP39 design experiments

I've been using some software and hardware wallets for years. Like most of you I am familiar with mnemonic seed phrases used in wallet c...