FreePBX Send to Growl, Local CID Lookup and CRM
Post ReplyFreePBX Send to Growl, Local CID Lookup and CRMPosted: Tuesday, February 13, 2018 [21:27:47] - 1
RE: FreePBX Send to Growl, Local CID Lookup and CRMPosted: Tuesday, February 13, 2018 [22:00:49] - 2
Also wanted to say a few words on how to make things work. It appears that caching results for CIDLookup make CallerID Superfecta to lose the CID record for know callers, so CIDLookup is set Cache Results to "No". Here is a snip of Perl that does a CID lookup: .. # process input $ENV{'QUERY_STRING'} .. print "Content-type: text/plain\n\n"; my $reportname; ## See if a phone number in a Contacts database if(-f "/http/cdr/search.phones.txt") {eval {require "/http/cdr/search.phones.txt"}; if($dsrch{$in{'number'}}{'en'}) { # Print Contact name - that is all we will print as a Lookup result print "$dsrch{$in{'number'}}{'en'}"; $reportname=$dsrch{$in{'number'}}{'en'}; } ## End number in Contacts } ## End if DB file present ## Get info record unless present unless($dsrch{$in{'number'}}{'city'}) { my $ipres = `/opt/local/bin/curl "http://apilayer.net/api/validate?access_key=xxxxxxxxxxxxxxxxxxxxxx&number=+$in{'number'}"`; # and write it to a database } ## End unless city present my $kztme=time; my ($wd,$mo,$da,$ti,$ye) = split(/\s/,$kztme); my $when = "$wd, $mo $da, $ye [$ti]"; # Send it to Growl eval {use Net::Growl}; unless($@) { register(host => 'localhost', application=>"IncomingCalls", password=>'your_password', ) if ! $ALREADY_REGISTERED; notify( application=>"IncomingCalls", title=>'Incoming Call from', description=> "$reportname\n$in{'number'}\n$dsrch{$in{'number'}}{'city'}$dsrch{$in{'number'}}{'state'}\n$dsrch{$in{'number'}}{'carrier'}\n$when", priority=>2, sticky=>'False', password=>'your_password', ); } ## END GOOD EVAL All kind of information can be send to Growl and Growl can send this message to other Macs. And yes, in 2018 we're still using Show Leopard as our main Mac OS X on 5 Macs without any needs to upgrade. We love cats! ;) |
Forward lookup results to Growl on LANPosted: Wednesday, October 3, 2018 [20:57:20] - 3
For some reason I was unable to make Growl to communicate with other computers with Growl running on LAN. It did not hit me until now - I can curl the result to other Macs. Just added CURL request to my laptop that is always with me after the Growl message being processed to a cid.cgi Perl script. If I am not home - program will not forward. Just added to the cid.cgi the following: ## Make sure MacBook is present on LAN my $dcheck = `ping -q -c 1 -W 1 192.168.2.32`; if($dcheck =~ m/1 packets received/) {## Run only if response received my $data="$reportname\n\n$in{'number'}$carrier$location\n$when"; `curl http://192.168.2.32/cid.cgi?data=$data`; } ## END GOOD PING and on MacBook I have similar perl script, but shorter: #!/usr/bin/perl .. # process input $ENV{'QUERY_STRING'} .. if($in{'data'}) { BEGIN { push ( @INC,"/opt/local/lib/perl5/site_perl/5.24"); } eval {use Net::Growl}; unless($@) { register(host => 'localhost', application=>"IncomingCalls", password=>'Growl_Password', ) if ! $ALREADY_REGISTERED; notify( application=>"IncomingCalls", title=>'Incoming Call from', description=> $in{'data'}, priority=>2, sticky=>'False', password=>'Growl_Password', ); } ## END GOOD EVAL else { $err=$@; print "Content-type: text/plain\n\nGrowl Error: $err"; } ## END EVAL ERROR } ## END IF DATA PRESENT print "Content-type: text/plain\n\nthank you!"; and that is it. The same Growl message appears on my MacBook as well as on family big screen TV. |