From: Andrew Ruthven Date: Wed, 24 Sep 2008 03:57:39 +0000 (+1200) Subject: Display Caller ID info for incoming calls. X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96f56aa0f4cb5622cbff0e8154c717754fe2d902;p=picture-display.git Display Caller ID info for incoming calls. --- diff --git a/lib/Display/Plugins/Asterisk.pm b/lib/Display/Plugins/Asterisk.pm index 8d077c4..04e920c 100644 --- a/lib/Display/Plugins/Asterisk.pm +++ b/lib/Display/Plugins/Asterisk.pm @@ -37,6 +37,9 @@ sub new { asterisk_hangup => { 'Event' => 'Hangup' }, + asterisk_dial => { + 'Event' => 'Dial' + }, asterisk_input => ':all', }, @@ -52,6 +55,7 @@ sub new { $kernel->state('asterisk_ring', $self, 'ring'); $kernel->state('asterisk_ringing', $self, 'ringing'); $kernel->state('asterisk_hangup', $self, 'hangup'); + $kernel->state('asterisk_dial', $self, 'dial'); }, }, ); @@ -83,11 +87,26 @@ sub input { my ($self, $kernel, $input) = @_[OBJECT, KERNEL, ARG0]; print STDERR "Other input - $input->{Event}\n"; - #print Dumper($input); + print Dumper($input); } sub hangup { my ($self, $kernel, $input) = @_[OBJECT, KERNEL, ARG0]; } +sub dial { + my ($self, $kernel, $input) = @_[OBJECT, KERNEL, ARG0]; + + my $dest = $input->{Destination}; + $dest =~ s/(.*)-.*/$1/; + + my $text = Clutter::Label->new('Sans 20', "Call from " . $input->{CallerIDName} . "\n " . $input->{CallerID} . "\nFor $dest"); + $text->set_color(Clutter::Color->parse('White')); + $text->set_ellipsize('end'); + + $kernel->post('display', 'notifications_add', $text); +} + + + 1;