diff options
| author | Alexander Færøy | 2014-05-31 13:10:46 +0200 | 
|---|---|---|
| committer | Alexander Færøy | 2014-05-31 13:10:46 +0200 | 
| commit | 2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1 (patch) | |
| tree | 1c5e6d817c88e67b46e216a50e0aef5428bf63df /scripts/isdn.pl | |
| parent | 2d080422d79d1fd49d6c5528593ccaaff9bfc583 (diff) | |
| download | scripts.irssi.org-2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1.tar.bz2 | |
Import scripts from scripts.irssi.org
Diffstat (limited to 'scripts/isdn.pl')
| -rw-r--r-- | scripts/isdn.pl | 55 | 
1 files changed, 55 insertions, 0 deletions
| diff --git a/scripts/isdn.pl b/scripts/isdn.pl new file mode 100644 index 0000000..b429ec7 --- /dev/null +++ b/scripts/isdn.pl @@ -0,0 +1,55 @@ +# DESCRIPTION +# Displays incoming ISDN calls to active window +# Looks even nicer with entries in  +# /etc/isdn/callerid.conf - see callerid.conf(5) +#  +# CHANGELOG +# 17.06.04 +# Script now runs for several days without any +# problems. Added documentation. + +use Irssi; +use vars qw($VERSION %IRSSI);  +$VERSION = "0.3"; +%IRSSI = ( +        authors         => "Uli Baumann", +	contact         => "f-zappa\@irc-muenster.de", +	name            => "isdn", +	description     => "Displays incoming ISDN calls", +	license         => "GPL", +	changed	        => "Thu Jun 17 12:49:55 CEST 2004", +); + +sub incoming_call()	# triggered by a timer; use of input_add +  {			# caused crash +  while ($message = <ISDNLOG>) +    { +    chomp($message); +    if ($message =~ / Call to tei .* RING/)	# just incoming calls +      { +      my $from = $message;			# extract caller +      $from =~ s/.*Call to tei.*from (.*) on.*RING.*/$1/; +      my $to = $message;			# extract callee +      $to =~ s/.*Call to tei.*from .* on (.*)  RING.*/$1/; +      my $window = Irssi::active_win();		# write message to active win +      $window->print("%YISDN:%n call from $from"); +      $window->print("      to $to"); +      }      +    } +  } + +sub isdn_unload()	# for a clean unload +  { +  close $ISDNLOG; +  Irssi::timeout_remove($timer); +  } + +# when starting, open the isdnlog file and set pointer to eof +open ISDNLOG, "< /var/log/isdn/isdnlog" or die "Can't open isdnlog"; +seek ISDNLOG,0,2; +# install timeout for the incoming_call subroutine +$timer=Irssi::timeout_add(1000, \&incoming_call, \&args); + +# disable timer and close file when script gets unloaded +Irssi::signal_add_first('command script unload','isdn_unload'); + | 
