Link: How to remove Zeitgeist in Ubuntu and why

Quoting from the article:

On my desktop I use Xubuntu 12.04, and today i noticed that this distribution shipped by default the Zeitgeist daemon, a thing that I’m not using at all, for what i know.

From Wikipedia:

Zeitgeist is a service which logs the users’s activities and events, anywhere from files opened to websites visited and conversations. It makes this information readily available for other applications to use in form of timelines and statistics. It is able to establish relationships between items based on similarity and usage patterns by applying data association algorithms such as “Winepi” and “A Priori”

Zeitgeist is the main engine and logic behind GNOME Activity Journal which is currently seen to become one of the main means of viewing and managing activities in GNOME version 3.0

Personally i don’t use any tool that use the Zeitgeist Framework and I’d prefer to open a terminal and use locate or find to search for files than having something that log all my activity and so slow down my system, so I’ve decided to remove this daemon totally from my system, please note that if you use Gnome 3 or Unity you could have some side effect, or perhaps the system will just become more faster, like the author of the article: Removing Zeitgeist Sped Up Unity .

Just remember that the information collected by Zeitgeist are stored for use in various forms in Unity: showing what were the last application you used, what are the applications you use most, which are the files that were used lately, the music you listen, among many other aspects. If you think you can live without these information probably your system will gain a good sped up.

The remainder of the article at Linuxaria gives provides the actual removal instructions.

Proof of concept: Automatically transfer Google Voice voicemail to Asterisk voicemail

 

Important
This article is a guest post. We may not be able to answer questions about this article.

The following should be considered proof-of-concept material. Feel free to use and/or modify it at your own risk.

The problem: You have Google Voice calls coming into an Asterisk server but even though you take care to answer calls when they arrive, every so often some hiccup causes voicemails to be left in Google Voice’s voicemail, and no one checks those. The solution: Transfer those voicemails to Asterisk’s voicemail box for that user.

The following assumes that there is already an active voicemail box established for the target user.

Prerequisites: php-xml (do yum install php-xml on a Centos-based system). Also, go to the Google-Voice-PHP-API page on GitHub and grab the file GoogleVoice.php – be sure to get the Raw version of the file. It is suggested that you place it your root directory, and make it executable. Note that if you have downloaded this file in the past, you should check to make sure you have the most recent version, since older versions available prior to June, 2013 did not include the ability to download voicemails.

Then in the same directory create a new file. Call it anything you want but give it a .php extension:

<?php

include('/root/GoogleVoice.php');

// NOTE: If you get errors from GoogleVoice.php, try installing the php-xml package
// You must change the name and password on the following line. NOTE: Full email address required.
$gv = new GoogleVoice('gv_user@gmail.com', 'gv_account_password');
// On the next line insert the extension number of the target voice mail box.  Must have voicemail enabled!
$vmbox = '1111';
// On the next line specify an email address for delivery of new voicemail notification.  Use $email=FALSE; if you don't want this.
// Note that this will not send the voicemail as an attachment so if you want that, do it from within the Google Voice account.
$email="username@gmail.com";

// Don't change anything below unless you know what you are doing!

// Set path to user's mailbox
$dir = '/var/spool/asterisk/voicemail/default/'.$vmbox.'/INBOX/msg';

// Set flag that determines if message waiting indications will be updated
$mwi = FALSE;

// Get data on all unread Google Voice voicemail messages into array.
$voice_mails = $gv->getUnreadVoicemail();
$msgIDs = array();
$keys = array_keys($voice_mails);

// process each available message
foreach($voice_mails as $v) {
	//	echo 'Message id: '.$v->id.' from '.$v->phoneNumber.' on '.$v->displayStartDateTime.': '.$v->messageText."<br><br>\n";

	// Downloads individual voicemail
	// Uses getVoiceMailMP3 function added to GoogleVoice.php - WILL FAIL with unmodified GoogleVoice.php 
	$mp3 = $gv->getVoicemailMP3($v->id);

	// construct temporary filenames used
	$mp3file = $v->id.".mp3";
	$wavfile = $v->id.".wav";

	// write temporary mp3 file to disk
	$fh = fopen($mp3file, 'w') or die("can't open file");
	fwrite($fh, $mp3);
	fclose($fh);

	// convert mp3 to temporary wav file
	system("mpg123 -q -w mp3towavtmp.wav ".$mp3file);

	// convert wav file to format required by Asterisk
	system("sox mp3towavtmp.wav -r 8000 -c 1 ".$wavfile." vol 3 dB");

	// If caller's number starts with +1 strip it
	$number=$v->phoneNumber;
	if (substr($number, 0, 2) == '+1') {
		$number=substr($number, 2);
	}

	// Calculate approximate duration of file from file size
	$duration=(int) (filesize($wavfile)/16000);

	// Construct Message Information file for Asterisk - following must be one long continuous line!
	$txt=";\n; Message Information file\n;\n[message]\norigmailbox=$vmbox\ncontext=macro-vm\nmacrocontext=ext-local\nexten=s-NOANSWER\nrdnis=unknown\npriority=2\ncallerchan=\ncallerid=<$number>\norigdate=$v->displayStartDateTime\norigtime=".substr($v->startTime,0,10)."\ncategory=\nflag=\nduration=$duration\n";

	// Find next unused voicemail file number in Asterisk voicemail directory
	$exists = TRUE;
	$i = 0;
	while ($exists) {
		$file=$dir.substr("000$i",-4).'.txt';    
		$exists = file_exists($file);
		$i++;
	}
	$i--;

	// $file will contain path and base filename of voicemail files, without extension
	$file = $dir.substr("000$i",-4);

	// Write Message Information file for this voicemail
	$fh = fopen($file.".txt", 'w') or die("can't open file");
	fwrite($fh, $txt);
	fclose($fh);

	// Change owner and group of file to asterisk
	chown($file.'.txt', "asterisk");
	chgrp($file.'.txt', "asterisk");

	// Move wav file to voicemail directory with proper filename
	rename($wavfile, $file.".wav");

	// Change owner	and group of file to asterisk
	chown($file.'.wav', "asterisk");
	chgrp($file.'.wav', "asterisk");

	// Mark message read in Google Voice so we don't read it again
	if(!in_array($v->id, $msgIDs)) {
		// Mark the message as read in your Google Voice Voicemail.
		$gv->markMessageRead($v->id);
		$msgIDs[] = $v->id;
	}

	// If email address specified construct and send email to user
	// Wanted option to attach voicemail but couldn't figure out how to do it correctly. uuencode does NOT work.
	if ($email) {
		// Construct email text
		$txt="There is a new voicemail in mailbox $vmbox that was imported from Google Voice's voicemail system:\n\n\tFrom:\t$number\n\tLength:\t$duration seconds\n\tDate:\t$v->displayStartDateTime\n";
		if ($v->messageText) {
			$txt=$txt."\tTranscription:\t$v->messageText\n";
		}
		$txt=$txt."\nDial *98 to access your voicemail by phone.\n";
		$i++;
		`echo "$txt" | mail -s "New message $i in mailbox $vmbox" "$email"`;
	}

	// Remove temporary files
	unlink($mp3file);
	unlink('mp3towavtmp.wav');

	// Set flag to indicate message waiting indication needs to be reset
	$mwi = TRUE;

}

// If messages were processed tell Asterisk to reset message waiting indications
// This may not be the best way to do this but only way I know
if ($mwi) {
	`/usr/sbin/asterisk -rx "voicemail reload"`;
}

?>

After you have changed the information at the top of the above code so it is correct for your installation, save it to a file with the extension .php and don’t forget to make it executable. Remember, this is proof-of-concept code, and we do not guarantee that it is ready for use in a production environment. It could probably benefit from additional error checking and possibly other enhancements.

You may want to call the above file on a schedule, perhaps every 15 minutes or every hour, depending on how urgently you want to receive Google Voice voicemails. I would not do it too often because you never know if Google would feel you are abusing their system with very frequent accesses. Note that when you call the script you’ll need to call it using php, for example:

php scriptname.php

and if that doesn’t work try adding the -f option after “php” but before the script name. Also, if you are running multiple copies of this script from a bash script (because you are collecting voicemail for more than one Google Voice user) then use a sleep statement between executions (such as sleep 30), otherwise you may see errors such as this:

PHP Fatal error: Uncaught exception ‘Exception’ with message ‘Could not log in to Google Voice with username: user@gmail.com’ in /root/GoogleVoice.php:67

Note that when this inserts voicemails into the Asterisk voicemail directory, it is not quite the same as when using a user leaves a voicemail. The known differences are:

  • When a user leaves a voicemail, the audio is saved in two files, a larger one with a .wav extension and a smaller one with a .WAV extension. The larger one is standard .wav format but the smaller seems to be some sort of GSM file, and I cannot figure out how to get SOX to create a compatible file, so I just don’t bother with it. It doesn’t seem to be needed anyway.
  • While this will let you send a notification e-mail to the message recipient, it does not let you attach the mp3 or wav file to the email. Again, don’t know how, but remember you can configure Google Voice to send a notification (with out without audio file attachment) when someone leaves a voicemail.

I hope someone will expand upon this to create something a bit more robust.

Cubieboard2 open single board computer ships, Cubietruck model revealed

This comes to us from LinuxGizmos:

The forthcoming Cubietruck will have additional I/O ports
The forthcoming Cubietruck will have additional I/O ports

The Cubieboard open SBC project began shipping a faster Cubieboard2 version of its open source Linux and Android SBC, and revealed prototypes of a new, larger, enhanced Cubietruck model. Like the $59 Cubiboard2, the Cubietruck uses an Allwinner A20 dual-core Cortex-A7 SoC instead of the original’s single-core Allwinner A10, and adds a 2GB RAM option, WiFi, Bluetooth, gigabit Ethernet, VGA, and SPDIF ports.

Read the full article here.

Note that the abbreviation “SBC” in the above-linked article stands for “single board computer”. In our opinion, if the Cubietruck works reliably it could relegate the BeagleBoard Black to also-ran status, and could even give the Raspberry Pi a run for its money among those who’d like just a bit more power and a wider selection of outputs. For Home Theater PC builders, the inclusion of a SPDIF Toslink optical port is no small thing. We’ll definitely be keeping an eye on this one!

How To Use The Raspberry Pi As A Wireless Access Point/Router, and other Raspberry Pi tricks

Just some quick links for the Raspberry Pi fans out there, from a multi-part series of articles on “How To : Use The Raspberry Pi As A Wireless Access Point/Router” via a blog called The Rantings and Ravings of a Madman:

Part 1 — How to create a Wireless Network On Your RPi
Part 2 — How to make your RPi into a Wireless Access Point
Part 3 — How to make your RPi into a Router
Part 3B – Issues with HostAPD ? Click here!

But the author of this blog didn’t stop there. Here are a few of his more recent articles, in a similar vein:

Script : WiFi Checker Script
Script : Starting hostapd when WiFi goes down
How To : Turn the Raspberry Pi Into a Shaping WiFi Router
Script : Web Configuration Page for Raspberry Pi
RaspAP WebGUI
How To : Use A RT5370 USB WiFi NIC In A Bridge

And in case you are thinking that the only things he knows how to do with a Raspberry Pi involve WiFi, guess again! Here is a link to all his Raspberry Pi related posts.

If you have an RSS newsreader, you might want to add his feed, or follow him on Twitter to get notifications of his latest blog posts.

If you know of any other great blogs for Raspberry Pi users that are of the same caliber as this one, please feel free to let us know in the comments!

FreePBX: Receive a daily e-mail of the Call Detail Report for the previous day

If you use FreePBX you might have wished that you could get a daily report of call activity e-mailed to you, if only to remind you to check for suspicious activity, so that you don’t get hacked and not know about it for weeks because you fell out of the habit of checking the log. It turns out that there is a fairly easy way to do it, as explained in a post by user Boolah in this thread in the PBX in a Flash forum:

EDIT (December, 2017): The method shown at that link and below doesn’t work at all in newer versions of FreePBX. It seems like every new version requires some tweaking. This is the line that works in FreePBX 14:

/usr/bin/mysql -u freepbxuser -ppassword -e "select calldate AS Timestamp, clid AS CallerID, did AS DID, dst AS Destination, disposition AS Disposition, duration AS Duration, userfield AS Userfield from cdr where calldate > date_sub(now(), interval 24 HOUR)" -H asteriskcdrdb | mail -a "From: PBX <asterisk@youraddress.com>" -a "Content-Type: text/html" -s "Custom Call Report" you@youremail.com

The above is all one long line. You must replace the above values:

-u freepbxuser -ppassword (that’s not a typo – there really is NO SPACE after the -p) – replace freepbxuser and password with the correct values for YOUR system. You will usually find these in one of two places. You can look in /etc/amportal.conf and look for the variables AMPDBUSER and AMPDBPASS — these will usually be near the bottom of the file in newer installs, in a “— CATEGORY: Bootstrapped or Legacy Settings —” section, but they can be anywhere in the file.

Another place they may be found is in the file /etc/freepbx.conf — in that file, look for lines similar to:

$amp_conf[‘AMPDBUSER’] = ‘freepbxuser’;
$amp_conf[‘AMPDBPASS’] = ‘password’;

Those will give you the values to use to replace freepbxuser and password

-a “From: PBX <asterisk@youraddress.com>” – replace asterisk@youraddress.com with a valid outgoing email address for your system. If you have a Dynamic DNS address, you may be able to use that after the @ in the email address. It mostly depends on how you send outgoing email from your system. Note that using “root” before the @ sign may not work, particularly if you are routing mail through an ISP’s mail servers – one major ISP now appears to silently drop any email that appears to originate from root@anything, so use “asterisk” or “pbx” or something else other than “root”.

-s “Custom Call Report” you@youremail.com – replace you@youremail.com with the address you want the reports emailed to.

What follows is the rest of the original article. The mysql line shown there probably will not work, unless perhaps you are running a very old version of FreePBX (end of edit).

This is very basic, but should get you the info you need. Add it as a cron to run once a day and it will email the date/time of the call along with the CNAM and CID for all incoming calls for the previous day:

mysql -u root -ppassw0rd asteriskcdrdb -e 'SELECT calldate, clid FROM cdr WHERE DATE(calldate) = SUBDATE(CURDATE(), 1) AND did <> ""' | mail -s "Yesterday's Calls" you@youremail.com

Replace the you@youremail.com with your actual email address.

When copying the above, note that it’s all one single line, even though it wraps in this blog post, and also beware that WordPress likes to change single and double quotation marks into the “prettified” versions, so make sure you change those characters back to the plain old ASCII versions or it won’t work correctly. Or, you could just visit the thread mentioned above and copy the line from there.

Link: How to watch Netflix (Watch Instantly) in Linux

EDIT: After publishing this article we learned of another article that gives additional information on what is probably the easiest method so far:

Yesterday, developer and programmer extraordinaire Erich Hoover and I spent several hours working out all of the Netflix Desktop kinks. Most users will have no problems with installation now.

Here is how to install the Netflix Desktop App on Ubuntu. …

Full details here:
PPA for Netflix Desktop App (iheartubuntu)

Should you have problems getting it to work, see:
Report Netflix App Bugs on Launchpad (iheartubuntu)

What follows is the original text of this post, which also mentions this method as one of the two choices:

Running Netflix is entirely possible in Ubuntu Linux 12.04 (and most likely any other modern distribution). See the section below “Running with Wine”.

Until recently there was no simple solution to watching streaming movies via Netflix (Watch Instantly) in Linux for any Linux distros besides Android based computers. Netflix has not released a player that will install natively in any of the others.

Read the full article here:
How to watch Netflix (Watch Instantly) in Linux (How To Wiki)

Link: Build Your Own Raspberry Pi Case from Cardboard or Cardstock

From a company that sells Raspberry Pi’s in North America comes this:

One of our top selling accessories for the Raspberry Pi is the case. Cases for the Pi come in a multitude of styles, sizes and colors, but if you’re like us, you’re the type of person who loves to build it yourself. Today we’re going to build a bare-bones case out of cardboard with supplies you may already have laying around the house.

Read the rest of the article here:
Build Your Own Raspberry Pi Case from Cardboard or Cardstock (MCM Electronics)

In case you are wondering, the finished enclosure looks something like like this (depending on what you make it out of). Just be sure to use a non-conductive material:

An alternative way to power a Raspberry Pi

Did you know that you can use a $20 USB hub (but not just any old USB hub) to power a Raspberry Pi AND use the SAME hub to add additional USB ports to the Pi? Well, you can, as demonstrated in this video:

 

Direct YouTube Link

Apparently not all USB hubs will work, because many only put out something close to the 500 mA that is the specification for USB 2.0, whereas the Raspberry Pi Model B requires 700 mA. So, the hub has to put out a bit of extra current or it won’t power the Raspberry Pi properly.

There is a list of USB hubs that will work with the Raspberry Pi, but pay special attention to the comments in the rightmost column. Only a few of the USB hubs shown are known to be able to power the Raspberry Pi reliably. The one shown in the video is the Plugable 7 Port High Speed USB Hub, model USB2-HUB-AG7 (Amazon affiliate link – we make a small commission if you click on it and purchase a unit).

EDIT: A few weeks after we originally posted this article, the device described in the following article was released:

PiHub from Cyntech and Pimoroni – a new powered USB Hub for the Raspberry Pi

Unless you really don’t need that many USB ports, and you absolutely fall in love with the Raspberry-shaped case of the PiHub, we suggest you stick with the Plugable 7 Port hub mentioned above. Not only are you getting more USB ports, and a hefty 3 Amp power supply, but if you’re in the U.S.A. or Canada it’s actually available here and has mostly 4 and 5 star reviews on Amazon. And if you go with the PiHub, by the time you do the currency conversion (and let your credit card company take a small bite on the exchange rate), and pay for the shipping, you’ll be paying more and getting less (only four ports rather than the seven offered in the Plugable unit). But, you will be getting that lovely Raspberry-shaped case, so there’s that.

Video: Turning the Raspberry Pi into an FM transmitter with PiFM

Direct link to YouTube video

Link to page that describes how it’s done: Turning the Raspberry Pi Into an FM Transmitter

The interesting thing about this: Other than the Raspberry Pi and its power supply, the only external hardware required is a piece of wire to act as an antenna, and a way to connect it to the correct pin on the device!

Notes on setting up Raspbmc on a Raspberry Pi

A couple of days ago we published Notes on setting up OpenELEC on a Raspberry Pi. One thing we found a bit frustrating about OpenELEC was touched upon in that article:

OpenELEC is very fast but much of the file system is read only, and even if you SSH in as root you cannot edit many of the configuration files as you could on a normal Linux system. Sometimes there are ways around that.

Now if you are setting up a system for your grandparents, maybe not having a writable file system, nor access to tools like apt-get for installing additional software won’t bother you. But we found it did bother us. For example, we missed having access to Midnight Commander. While there is an unofficial way to install it on on OpenELEC, the developers apparently would prefer you don’t do that. Well, sorry, but that kind of thinking is not acceptable to us. It’s our system, and we want to be able to control it. In fact, it kind of goes against the whole spirit in which the Raspberry Pi was created to make an “untinkerable” distribution, although we can certainly understand why some people like it. Different strokes for different folks*, and all that.

So we decided to again try Raspbmc. We had tried it once before, but found the interface a bit slow and clunky. However, just a few days ago a new version was released, and reports were that it was faster. So, we decided to give it another try. This time, we installed it using the instructions found here, which are for users that will be writing to the SD card using an OS X or Linux system. If you were using Windows for this task, you’d use these instructions instead. This only writes an installer to the card, and when you place the card into the Raspberry Pi and boot it up it will complete the installation. You must have an active Internet connection for the installation to complete.

The interface in the new version of Raspbmc does seem faster than in the previous version we’d tried. Some things may still be a bit slower than in OpenELEC – we particularly noticed that it took a bit longer for fanart to appear after we’d made a selection.

One thing that had bothered us about OpenELEC was that you could not change the Samba password. In Raspbmc it is easy, you simply SSH into the device (as user pi, default password raspberry) and enter:

sudo smbpasswd -a pi

Also if you want to change the SSH password, which we highly recommend, you simply do:

sudo passwd pi

In either case you will be prompted for the new password.

You can install Midnight Commander in the normal way, using apt-get install mc and it seems to work fine. Another thing we had an issue with in OpenELEC was changing the Samba share name. It’s easier to do this in Raspbmc, but still perhaps a bit non-obvious. The easiest way to do it is simply edit /etc/hostname and change name in that file – this is also picked up by Samba, though you may need to reboot and wait some time before the new share name appears and the old one disappears – it took about 20 minutes on our systems.

One thing we noticed about Raspbmc is that XBMC’s RSS feed is turned off by default. This was a major contributor to high CPU usage in OpenELEC. Not that higher CPU usage is really all that bad, but some people like to see a lower figure. Note that you cannot get an accurate reading from the XBMC GUI – to see an accurate representation of CPU usage you must SSH into the system and use the top command.

Speaking of SSH, one weird thing about RaspBMC is that the first time you SSH into the device, you’ll be asked to select a language and timezone. Always select at least the UTF-8 version of your preferred language – that is probably the only one you need. That’s the first time we’ve ever seen this information requested on an initial SSH login to a system.

* A line from “Everyday People” by Sly and the Family Stone (1968)