|
SageTV Customizations This forums is for discussing and sharing user-created modifications for the SageTV application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss customizations for SageTV version 6 and earlier, or for the SageTV3 UI. |
|
Thread Tools | Search this Thread | Display Modes |
#81
|
||||
|
||||
Close, but no cigar. It is properly stripping the first digit, but it is not being seen by a YAC Listener. I have verified the port as 10629.
|
#82
|
|||
|
|||
Quote:
That's because you need to install winpcap. My issues went away when I could download successfully, so it is the corrupt zip causing the perl58.dll issue. I'll try to grab the new one tonight and see if anything changes. I did change from Vista x64 to x32 though so I can use firestb, so I can't debug any x64 issues(if there are any) until I get the dual boot set up. |
#83
|
|||
|
|||
Quote:
Ok I got it working on my Server. But I never really watch TV on my Server I need it working on my Sage Extenders. Quote:
Some conflicting information is that KJake wrote: Quote:
If there's a new version of Info Popup can someone link to it? I thought I was using the latest. Last edited by grauchy; 02-24-2009 at 06:44 PM. |
#84
|
||||
|
||||
I just got back to looking at this. For me it breaks down as:
version 1.07 - sends the message to the client if ran from a command window. - does not work as a service. version 1.08 - does not send the message to the client, though it does report sending the message in the command window. - service mode does not work. |
#85
|
||||
|
||||
And that is exactly the problem I'm having as well.
|
#86
|
|||
|
|||
So does anyone have a working version of the file? I just downloaded from the last link and am getting the CRC error. I wanted to give this a go with VonageTalk.
|
#87
|
|||
|
|||
my server keeps having issues. please try this, i put it on an upload service site. i may have fixed the message sending issue, but i don't have a way to test it.
http://www.wikiupload.com/download_page.php?id=120340 |
#88
|
||||
|
||||
I'm still not seeing the message sent to my listener. It definitely is getting the detection (I tried running it from a command line and can see it pick up the information.)
|
#89
|
|||
|
|||
i'll spend some actual time on it tonight or tomorrow night. i still don't have a real way to test it, but i realized that i can probably code a way to test this.
|
#90
|
|||
|
|||
I really, really think that I fixed the listener sending problem now, but, as I said before, I don't have a great way to test it completely.
Please post your results, and test in both normal and service mode if you can. Thanks! ps. I also included a changelog and basic readme in the zip now Last edited by KJake; 08-29-2009 at 11:34 AM. |
#91
|
||||
|
||||
Now that fixed the problem. Thank you so much for this.
|
#92
|
|||
|
|||
Yay! So sorry that it took me so long to get to it.
Is there anything else that isn't working, or needs to be added? |
#93
|
|||
|
|||
Well, looks like this might be stable? So, I should publish the code:
Code:
#!/usr/bin/perl -w # 1.01 Changed Caller ID Name parsing to allow for no name. # by Larry Silverman # 1.02 Reformat phone number to be in format xxx-xxx-xxxx. # Enable display of date/time in OSD. # Adjust default filter to check port 10000. # Reformat perl code. # by Kevin Venkiteswaran # 1.03 First Windows implementation as a YAC Server instead # Added option to ignore a phone number since Vonage is sending an invite packet for Outgoing calls as well # Commented out all Unix things for now # Use WinPcap to enable sniffing # 1.04 Implemented use of Windows Syslog (Event Viewer) # Since Windows has no POSIX interface, it is not possible to fork() (correctly), removed Daemon option # Cleaned up print outs # by Kevin Jacobson (for v1.03+) # 1.05 Defined dependant Windows Services hooks # Started building exe with Windows Service support # Cleaned up Help output # Further cleanup of Logging # 1.06 Changed default sniff port to 5060 to be compliant with more SIP services # Changed to only write to the Windows Event log when running as a service # Further cleanup of the Help text # Set Pcap to only compile the filter if a filter has been set, else just loop through all traffic # Changed Help text to use double-quotes to set the Pcap filter, else we set a unterminated string value that causes the script to throw-up # 1.07 Setup a "fake" fork() to allow the service to start as a parent, spawn child, and poll child and no longer be in a loop so as to catch the STOP from Windows Service control # 1.08 Should see an 11 digit phone number incoming from the SIP provider and reformat to a 10 digit formatted number # Set listener timeout to 5 seconds so the program doesn't wait forever if a listener is off # Strip any single or double quotes from the filter string to keep the argument reader from getting confused # 1.09 Added additional error checking # Fixed YAC listener message sending and added sucess/fail debug messages use IO::Socket; use IO::Socket::INET; use Net::Pcap; use NetPacket::Ethernet qw(:strip); use NetPacket::IP qw(:strip); use NetPacket::TCP; use NetPacket::UDP; use Unicode::String qw(utf8 latin1 utf16); use Sys::Syslog; use Win32; use Win32::Process qw(STILL_ACTIVE); autoflush STDOUT 1; ###################################################################### ######### User Defined Variables ######### ###################################################################### my ($pid, $child, $all_devs,$notifylist, $ignore, $debugmsg, @hosts_to_notify); my $debug=0; my $debug2=0; my $quiet=0; my $dev="*"; my $filter_str="udp and port 5060"; my $user="root"; my $promisc=1; my $to_ms=1000; my $useEvtlog=0; my $ident="vonageSniff"; my $facility="local1"; my $options="pid,perror"; my $priority="info"; $PerlSvc::Config{ServiceName} = "vonageSniff"; $PerlSvc::Config{DisplayName} = "vonageSniff"; $PerlSvc::Config{StartType} = "auto"; $PerlSvc::Config{StartNow} = 1; $PerlSvc::Config{Description} = "Sends incoming SIP callerID info to YAC listeners"; ###################################################################### ######### End User Defined Variables--Modify nothing below ######### ###################################################################### ###################################################################### # Child global variables ###################################################################### my $pcap_t; my $err; my $count = -1; ### These shouldn't be changed (yet) my $optimize=0; my $netmask=0; my $snaplen=50000; ###################################################################### # End child global variables ###################################################################### my $ver = "1.09"; print "VonageSniff $ver (Windows implementation by Kevin Jacobson)\n"; sub PerlSvc::Startup() { &getOptions(@ARGV) || die "Could not get options\n"; $useEvtlog=1; &open_evtlog(); log_msg("Running as service...\nSettings for child:\n"); log_msg("Device: $dev") if (defined($dev) && !($quiet)); log_msg("WinPcap Filter: $filter_str") if (defined($filter_str) && !($quiet)); log_msg("Number to ignore: $ignore") if (defined($ignore) && !($quiet)); log_msg("YAC listeners: $notifylist") if (defined($notifylist) && !($quiet)); while (PerlSvc::ContinueRun(10)) { &launch_proc; } &ParentLeaveNow(); } sub PerlSvc::Interactive() { &getOptions(@ARGV) || die "Could not get options\n"; &open_evtlog(); &start_AS; exit; } sub PerlSvc::Install() { if(scalar(@ARGV) > 0 && $ARGV[0]=~/-C=(.*)/){ $PerlSvc::Config{Parameters} = $ARGV[0]; } } sub ErrorReport { log_msg(Win32::GetLastError()); } sub kill_child() { if (defined($child)) { $child->Kill(0); while (!$child->Wait( 1000 )) { sleep(1); # wait for child to exit } } } sub ParentLeaveNow() { kill_child(); log_msg("Parent exiting..."); exit; } sub launch_proc() { if (!defined($child)) { Win32::Process::Create($child, PerlSvc::exe(), PerlSvc::exe() . " " . $PerlSvc::Config{Parameters}, 0, NORMAL_PRIORITY_CLASS, ".")|| die ErrorReport(); $pid = $child->GetProcessID(); log_msg("Started child process, PID: $pid"); } } sub open_evtlog() { if ($useEvtlog == 1) { Sys::Syslog::openlog $ident, $options, $facility || die "Couldn't open Event Log"; } } sub log_msg($) { my ($msg) = @_; if ($useEvtlog == 1){ Sys::Syslog::syslog($priority, $msg); } else{ print $msg . "\n"; } } sub start_AS { log_msg("Starting up..."); log_msg("Device: $dev") if (defined($dev) && !($quiet)); log_msg("WinPcap Filter: $filter_str") if (defined($filter_str) && !($quiet)); log_msg("Number to ignore: $ignore") if (defined($ignore) && !($quiet)); log_msg("YAC listeners: $notifylist") if (defined($notifylist) && !($quiet)); my $pcap_test = Net::Pcap::lookupdev(\$err); if (defined $err) { die "\n\nUnable to find any network device. Make sure WinPcap is installed.\n\n"; } dev: foreach $_ (Net::Pcap::findalldevs(\$err)) { next dev if $_ =~ /Generic/; my $net = ''; my $mask = ''; my $try_this = ''; Net::Pcap::lookupnet($_, \$net, \$mask, \$err); if ( (167772160 <= $net && $net <= 184549375) || (2886729728 <= $net && $net <= 2887778303) || (3232235520 <= $net && $net <= 3232301055) ) { $try_this = "*" }; $all_devs .= "\n".$_.$try_this; } $pcap_t=Net::Pcap::open_live($dev, $snaplen, $promisc, $to_ms, \$err) || die "Error opening pcap: $err\n\nPlease use one of the following interfaces (try the one with a * first):\n".$all_devs."\n"; #start sniffing if ($filter_str ne "") { my $filter_t; my $result=Net::Pcap::compile($pcap_t, \$filter_t, $filter_str, $optimize, $netmask); #compile filter_str Net::Pcap::setfilter($pcap_t, $filter_t); #apply filter } Net::Pcap::loop($pcap_t, $count, \&process_pkt,"xyz"); #start to process the packets that are received return; } #Process the packet sub process_pkt { autoflush STDOUT 1; my($pktuser, $hdr, $pkt) = @_; if (!defined($hdr) or !defined($pkt)) { log_msg("Bad args passed to callback"); log_msg("Bad user data"), if ($user ne "xyz"); log_msg("Bad pkthdr"), if (!defined($hdr)); log_msg("Bad pkt data"), if (!defined($pkt)); log_msg("not ok"); exit; } #get datetimestamp of packet my ($sec, $min, $hour, $mday, $mon, $year)=localtime($hdr->{tv_sec}); $year+=1900; $mon+=1; my $datestamp="$mon/$mday $hour:$min"; #Strip Ethernet portion of packet off my $ip_obj=NetPacket::IP->decode(eth_strip($pkt)); my $proto=$ip_obj->{proto}; my ($tcp_obj, $udp_obj, $flags, $dataset) = ""; if($proto==17){ $udp_obj=NetPacket::UDP->decode(ip_strip(eth_strip($pkt))); $dataset=$udp_obj->{data}; } print("$dataset\n") if ($debug); if (defined($dataset)) { if ($dataset=~/INVITE sip\:/){ if ($dataset=~/From\:\s*"?(.*)"?\s*<sip\:(.*)@/ && $2 !~ /$ignore/) { my $callername = $1; my $callernumber = $2; chomp($callername); chomp($callernumber); $callername=~s/^\s+//g; $callername=~s/\s+$//g; $callername=~s/\"//g; $callernumber=~s/^\s+//g; $callernumber=~s/\s+$//g; $callernumber=~s/^1//g; $callernumber=~s/^(\d{3})(\d{3})(\d{4})$/$1-$2-$3/; log_msg("Detected incoming call: $callername $callernumber\n"); my $msg = "\@CALL$callername~$callernumber"; log_msg("YAC message to send: $msg"); @hosts_to_notify = $notifylist; if ($notifylist =~ /\,/) { @hosts_to_notify = split(/\,/, $notifylist); } foreach my $host (@hosts_to_notify) { my ($notifyaddr,$notifyport) = split(/\:/,$host); if (defined($notifyaddr) && defined($notifyport)) { log_msg("Connecting to YAC listener at: $notifyaddr:$notifyport\n"); my $yac_fh = IO::Socket::INET->new(PeerAddr=>$notifyaddr,Proto=>'tcp',PeerPort=>$notifyport,Timeout=>5); if ($yac_fh) { log_msg("Connected to YAC listener\n"); print $yac_fh $msg; $yac_fh->close; } else { log_msg("Unable to connect to YAC listener\n"); } } } } } } return; } sub getOptions{ my(@ARGV)=@_; my $arg; if(scalar(@ARGV) > 0 && $ARGV[0]=~/-C=(.*)/){ my $configfile=$1; log_msg("Config file defined, trying to open: $configfile") if (defined($configfile) && !($quiet)); open(CONFIG,"$configfile") || log_msg("Error opening config file, using defaults instead."); while(<CONFIG>){ $arg=$_; if($arg!~/^\#/){ $dev=$1 if($arg=~/dev=(.*)/); $filter_str=$1 if($arg=~/filter='(.*)'/); $promisc=1 if ($arg=~/promisc=1/); $notifylist=$1 if ($arg=~/y=(.*)/); $to_ms=$1 if ($arg=~/timeout=(.*)/); $quiet=1 if ($arg=~/quiet=1/); $debug=$1 if ($arg=~/debug=(.*)/); $ignore=$1 if ($arg=~/ignore=(.*)/); $useEvtlog=$1 if ($arg=~/useEvtlog=(.*)/); } } close(CONFIG); } else{ foreach $arg (@ARGV){ $dev=$1 if($arg=~/-d=(.*)/); $filter_str=$1 if($arg=~/-f=(.*)/); $ignore=$1 if($arg=~/-i=(.*)/); $promisc=1 if ($arg=~/-p/); $notifylist=$1 if ($arg=~/-y=(.*)/); $to_ms=$1 if ($arg=~/-to=(.*)/); $quiet=1 if ($arg=~/--quiet/); if($arg=~/--h/ or $arg=~/-h/){ print "\nTo use:\n"; print " --install Install as a Service\n"; print " --remove Remove the Service\n"; print " -C=<file> Config file to store settings\n"; print " -d=<dev> Specify the device from which packets are captured\n"; print " -i=<num> Specify a phone number to ignore (yours)\n"; print " -f=\"filter\" String to filter on enclosed in single quotes\n"; print " (DEFAULT: \"udp and port 5060\")\n"; print " -y=ip:port IP address(es) and port to send YAC messages to (comma separated)\n"; print " -p Place the device into promiscuous mode\n"; print " -to=integer Read timeout in ms\n"; print " --quiet Do not print anything but errors to STDOUT\n"; print "\nDefaults:\n"; print " -f=\"udp and port 5060\"\n"; print " -p\n"; print " -to=1000\n"; exit; } } } $filter_str =~ s/\'|\"//g; return 1; } |
#94
|
|||
|
|||
I neglected to detail how this is built if someone wants to modify it themselves.
I used ActiveState Perl 5.8 and the ActiveState PDK 7.x to build the exe/service. Also, I uploaded the final file to the SageTV Downloads area so that we have a more permanent place for this. http://forums.sagetv.com/forums/down...do=file&id=334 Last edited by KJake; 08-29-2009 at 11:39 AM. |
#95
|
|||
|
|||
Thanks for responding so fast with the upload and the info on building the exe file. It was driving me crazy trying to build the exe with the free tools that claimed to do it but they didn't work for me.
I will be testing and using the latest version. Are you still accepting comments, suggestions or bugs reports? Again, Thanks for your work on this project and the upload/info! Ron |
#96
|
|||
|
|||
I'll look into anything that you report, but I don't have a great way to debug this anymore, so it will be difficult to track down some problems.
|
#97
|
|||
|
|||
Not recognizing settings
Need some help, have not been able to get VonageSniff to recognize settings via commandline or via the config file. I have installed WinPcap, Windump, Phonepower sipphone, and VonageSniff. Windump shows the device to use but when I use it VonageSniff gives errors stating cannot find device. It also does not appear to be picking up any settings.
Here is the listing of config file of my last attempt: dev=7EB83AA5-9DF4-496F-8AC4-C38BFAA98B5E filter='udp and tcp 5060' y=192.168.2.8:1069 quiet=0 ignore=2125550000 Tried the device entry with dev=\Device\NPF_{ } sounding numbers 1st, 2nd try without the dev=\Device\NPF_; none of these would show a device in the output. Here is the output no matter how I run the program using the config file or command line entries: C:\Users\Durrell\Downloads\vonageSniff>vonagesniff -c VonageSniff 1.09 (Windows implementation by Kevin Jacobson) Starting up... Device: * WinPcap Filter: udp and port 5060 Error opening pcap: Error opening adapter: The system cannot find the device specified. (20) Please use one of the following interfaces (try the one with a * first): \Device\NPF_{7EB83AA5-9DF4-496F-8AC4-C38BFAA98B5E}* \Device\NPF_{4450B025-4E84-459F-A57B-9B85769427CE}* Any suggestions on what needs to be changed? |
#98
|
|||
|
|||
Looks like I coded it case-sensitive, try an upper-case -C
|
#99
|
|||
|
|||
Tried it, still did not work to load the file.
It appears to be using default settings. In the output you see that the filter is coded as 'udp and port 5060' passed to WinPcap. I coded in the configuration file to use 'udp and tcp 5060' would that be correct?
__________________
Server: Intel Core 2 Duo E6600 2.4 GHz Processor 6 GB PC2 6400 Memory 1 - 500 GB hard drive, 1 Pinnacle USB HDStick VISTA 64 bit Home Premium all updates applied, SageTV V6.6.2.218 : SageMC 6.3.9a Just beginning to build SageTV Network got to get WAF to > 90% |
#100
|
|||
|
|||
Quote:
For filter, see here for detailed filters, but if you wanted to look at tcp and udp port 5060, just make the filter 'port 5060' Now I'm going to sound rude, but the readme says, "Run 'vonageSniff -h' on a command line to see configuration options"...when I do that, it prints: -C=<file> Config file to store settings so, to correctly use the config file, your command needs to look like: vonageSniff.exe -C=vonageSniff.config if your working directory contains vonageSniff.config, otherwise put the whole path to vonageSniff.config (and quote it if it contains spaces). when I test this out on my system, it does indeed need the -C=<file> to load the configuration. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Caller ID modem for voip | tawd1992 | Hardware Support | 11 | 10-22-2009 06:17 PM |
Anyone have a script tp restart client ? | brewston | SageTV Software | 3 | 09-16-2008 08:02 AM |
Need a script to reboot MVP | deanm | SageTV Media Extender | 13 | 07-25-2008 01:32 AM |
comclean script with .edl files | joe123 | SageTV Customizations | 0 | 07-10-2007 10:08 AM |
Perl script to automatically grab movie thumbs | sundansx | SageTV Customizations | 0 | 01-10-2007 11:41 PM |