Using syslog to get caller id name and number from the OBi110
etc6849:
infin8loop, I don't think you're doing anything wrong. This is what I'm getting with the latest firmware. Unfortunately, I don't have an older firmware to try.
QBZappy and MRTT: I'm not sure why Google Voice caller id numbers do not show. I'm using GV integrated with Sprint cellular service, so maybe that's why the number is working for me? I do know I'm running the latest firmware. I also know they show up when I use Kiwi Syslog.
I've enhance my perl script to take the syslog packet and look for ''. Now if it sees '', it will look up the name using http://freecnam.org/dip?q=8037320011
I figured out the problem with freecnam.org was that their site was not working the day I was trying it. Briefly this morning it wasn't working. I'm not complaining though, it's a very handy site.
I'll post the script after I finish things and test them more. The idea is to first try freecnam if no caller name is present in the packet; if it doesn't return anything, look up the caller's city and state using http://www.telcodata.us/query/queryexchangexml.html?npa=316&nxx=265.
I appreciate all of the help you guys have given me. I've leanred a lot already!
QBZappy:
Quote from: oleg on March 27, 2011, 08:46:17 am
I am curious why nobody mentioned SysLog facility. It's already implemented in OBi110 and for SIP calls can send more than enough information to the destination computer (although for GV calls it lacks call details - I hope OBi developers will catch up here ;)). Quite simple processing script may extract necessary details and pop-up message. Just my $0.02 :)
Emphasis added
Back in the day the syslog seems to have been less verbose. It looks like they quitely improved the syslog output.
PeterFales:
I'm puzzled by missing syslog information too. A few months ago (November 2011) I wrote a perl script to watch for the "[SLIC] CID to deliver" messages and it was working fine. Today when I went to test it again, I'm not getting those messages. I get other syslog <7> messages from the OBi, so I think I have everything configured correctly. Did something change in my OBi configuration? a firwmare update? the google-voice protocol? or ???
etc6849:
See this post: http://www.obitalk.com/forum/index.php?topic=2368.0
The firmware has changed and they removed some data from the syslog output. No more outgoing call log :(
w84no1:
I have setup a syslog server in perl to monitior the Obi and send caller id info to each of my Windows Media Center PCs. I use GV so I have no caller id info except the phone number. Here is the code I used, which includes the number lookup from freecnam.org. Enjoy.
Code:
use IO::Socket::INET;
use LWP::Simple;
use subs::parallel;
use XML::Simple;
use Data::Dumper;
use feature "switch";
#start writing syslog data to client
my $syslog = IO::Socket::INET->new(Proto => 'udp', LocalPort => '514');
die "Could not create syslog socket: $!\n" unless $syslog;
print "Syslog server is online.\n";
sub formatPhoneNumber {
my $number = shift;
die "$number is not a valid 10-digit phone number" unless $number =~ /^\(?([1-9]\d{2})\)?[-., ]*?([1-9]\d{2})[-., ]*?(\d{4})$/;
my $formatted = "($1) $2-$3";
return $formatted;
}
sub connectMCE : Parallel {
my $PeerHost = shift;
my $PeerPort = shift;
my $CID = shift;
#start writing data to client
my $mce = IO::Socket::INET->new(Proto => 'tcp', PeerHost => $PeerHost, PeerPort => $PeerPort);
if($mce) {
print "Connected to MCE $PeerHost on port $PeerPort.\n";
$data = <$mce>;
# write on the socket to server.
$data = 'msgboxrich "Phone Call" "' . $CID . '" 20 "OK" "nonmodal" "c:\phone.png"';
print $mce "$data\n";
print "$data\n;"
}
else
{
print "Could Not Connect to $PeerHost on port $PeerPort.\n";
}
close($mce);
}
#if $syslog is defined, then continuously monitor the socket for incoming data
while (defined($syslog))
{
recv($syslog,my $msg,1500,0);
# clean up msg some
# if msg = "<7> [SLIC] CID to deliver:" then send caller id to mediacenter
if ($msg =~ /CID/) {
$msg = substr($msg, -12);
$msg = substr($msg, 0, -2);
print $msg . "\n";
my $content;
#todo - lookup number is address book
given($msg) {
when (/9999999999/) { #removed real phone number
$content = "DAVID'S CELL";
}
when (/8888888888/) { #removed real phone number
$content = "DAVID'S OFFICE";
}
default {
my $url = "http://freecnam.org/dip?q=" . $msg;
$content = get $url;
print "$url\n"
}
}
my $fullCallerIDInfo = formatPhoneNumber($msg) . " - " . $content;
print "$fullCallerIDInfo\n";
# create object
$xml = new XML::Simple (KeyAttr=>[]);
# read XML file
$data = $xml->XMLin("data.xml");
# dereference hash ref
# access <client> array
foreach $e (@{$data->{client}})
{
connectMCE($e->{peerName}, $e->{peerPort}, $fullCallerIDInfo);
}
}
}
close($syslog);
Navigation
[0] Message Index
[#] Next page
[*] Previous page