FOOD FOR THOUGHT Call recording on Raspberry Pi

docgreen

Member
Joined
Oct 30, 2013
Messages
55
Reaction score
7
I've been thinking about moving my setup over to a Raspberry Pi, but I'm a little concerned about the limited storage space. As I'm running PIAF for my business, I've set it up to record all external calls... is a 64 GB MicroSD large enough for that? Granted, it's a home business and I don't usually have more than say 3-4 hours on the phone per week. I'd just hate to transfer everything over just to run into storage problems.
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
1,607
Reaction score
826
Unfortunately for you the Rasperry platform is intrinsically going to be a "storage problem", sooner or later the SD card WILL die without warning or recourse.
 
Joined
Nov 14, 2008
Messages
1,398
Reaction score
320
I really don't understand the whole Raspberry thing. Almost everyone has old PC's around or can get one from a family member. Why go with such a limited platform?
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
1,607
Reaction score
826
I love the Raspberry's I use them for all sorts of things, just not for PBI's, yes they are conceptually feasible, but NO you REALLY don't want to use one for stuff that changes a lot ( a PBX), look at the cost and ugliness of the rasperry plus backup plus big PSU etc. , get a cheap NUC, it is better value.
 

jerrm

Guru
Joined
Sep 23, 2015
Messages
838
Reaction score
405
You should get a pretty good idea of how much space will be needed from the existing install.

Code:
du -hd1 /var/spool/asterisk/monitor/

Divide the result by the number of months (days/weeks/years/whatever) it's been running to get an idea how long you can go. Note recording format makes a huge difference - asterisk's "wav" is 5-10x larger than "WAV" for instance.
 

docgreen

Member
Joined
Oct 30, 2013
Messages
55
Reaction score
7
Sorry guys, I tried updating my email address on the forum and got locked out. Anyways...

Unfortunately for you the Rasperry platform is intrinsically going to be a "storage problem", sooner or later the SD card WILL die without warning or recourse.

That's a pretty easy fix though. With the low cost of MicroSD cards, it wouldn't be a problem at all to have one or two backups lying around. Then it's just a matter of keeping the PBX backed up regularly.

I really don't understand the whole Raspberry thing. Almost everyone has old PC's around or can get one from a family member. Why go with such a limited platform?

I run a computer shop, so having old PC's lying around is definitely not a problem. I've had my system running on an old Dell for almost 5 years now. The problem is that running a full PC 24/7 for something like this is incredibly wasteful. Not only is it using an excessive amount of electricity, it also generates a great deal of noise and heat. Switching it over to a Pi would eliminate ALL of the noise and heat, and nearly all of the energy consumption.

I love the Raspberry's I use them for all sorts of things, just not for PBI's, yes they are conceptually feasible, but NO you REALLY don't want to use one for stuff that changes a lot ( a PBX), look at the cost and ugliness of the rasperry plus backup plus big PSU etc. , get a cheap NUC, it is better value.

A cheap NUC was my first thought... until I compared prices. Here's what I came up with:

NUC total cost: $193.33
$129.92 - ZOTAC ZBOX Mini PC - https://goo.gl/asLeQ1
$39.99 - 128 GB SSD - https://goo.gl/RUhC70
$14.73 - 4GB RAM - https://goo.gl/AohRWB
$8.69 - DisplayPort to VGA adapter - https://goo.gl/40mXuw
Pi total cost: $76.83
$41.99 - Pi 3, Heatsinks, Power Supply - https://goo.gl/TZsKnZ
$7.90 - Official Pi 3 Case - https://goo.gl/JxOyNv
$17.95 - 64GB MicroSD - https://goo.gl/4MIKRY
$8.99 - HDMI to VGA adapter - https://goo.gl/wgl3We
I'm not really sure what you mean about "the cost and ugliness of the raspberry plus backup plus big PSU"
The cost is lower than a NUC. It's smaller and not at all ugly. And the PSU isn't any bigger than what I'm already using to power the rest of my network equipment. As for "stuff that changes a lot" I disagree. That MicroSD isn't going to be any more volatile than an SSD. Also, in case you couldn't tell, my intent is to go with a system that is fanless and has zero moving parts.

You should get a pretty good idea of how much space will be needed from the existing install.

Code:
du -hd1 /var/spool/asterisk/monitor/

Divide the result by the number of months (days/weeks/years/whatever) it's been running to get an idea how long you can go. Note recording format makes a huge difference - asterisk's "wav" is 5-10x larger than "WAV" for instance.

Just out of curiosity I took a look at the Webmin, and unless I'm missing something, I'm only using about 24GB of space with my current setup. Of course, I did recently delete a ton of unneeded voicemails and whatnot.
 

jerrm

Guru
Joined
Sep 23, 2015
Messages
838
Reaction score
405
I run a computer shop, so having old PC's lying around is definitely not a problem. I've had my system running on an old Dell for almost 5 years now. The problem is that running a full PC 24/7 for something like this is incredibly wasteful. Not only is it using an excessive amount of electricity, it also generates a great deal of noise and heat. Switching it over to a Pi would eliminate ALL of the noise and heat, and nearly all of the energy consumption.
Energy usage is a big plus for the Pi. An old PC would run $50-$100+ annually. A Pi is about $5. A small UPS can keep a router and Pi up for hours vs minutes with a PC. A NUC brings things much closer to a Pi though (but with the expense).

As for "stuff that changes a lot" I disagree. That MicroSD isn't going to be any more volatile than an SSD.
Don't kid yourself, SD cards are more finicky than an SSD, but I am not nearly as pessimistic as @dicko. I'd argue disk usage for a small PBX does not "change a lot." It is largely a "write once" operation. Minimize logs and use fs2ram to keep log writes off the SD card. My experience is SD cards either die very young or very old.

Also, Pi3's can boot solely from USB too, eliminating SD needs entirely.

Just out of curiosity I took a look at the Webmin, and unless I'm missing something, I'm only using about 24GB of space with my current setup. Of course, I did recently delete a ton of unneeded voicemails and whatnot.
Voicemails are kept in a different folder, but I think you have your answer. 64GB should last for a long time.
 

chris_c_

Active Member
Joined
Aug 19, 2010
Messages
509
Reaction score
67
@docgreen I posted the solution for RPi3 in another thread here.
Basically because you have a technical abilities, you could get it to work reliably in your small business.
The key to the solution is to run the operating system and PBX on the SD card as a READ ONLY FILESYSTEM.
Because once the pbx is all installed and setup and running, there's no need for it to write to its SD card disk, except for once a week or so, to install system package updates etc.
The goal is to NOT let the PBX and Linux itself, wear out the SD card by constantly writing the logs, and "atime" file access times, to it.
So you run your logs in RAM in a circular buffer of 10-20 MB.
And, you have the PBX write your important voicemails onto a SEPARATE DISK DEVICE such as ANOTHER SD card attached via the USB port.
Then, you run backup script on a daily basis, to back up your voicemails and your pbx config to the cloud.
Should disaster hit and cause your pbx to fail to boot up, you just get a new 16GB SD card for your new "operating system and PBX app" disk, and restore it from cloud. Same thing for the voicemails, but with a 64GB card.
Again, the major weakness is the SD card wearing out by not putting the filesystem into read-only, not the RPi3 itself.
Also, check out benchmarks of other versions of the Pi, http://www.cnx-software.com/2016/04...berry-pi-vs-banana-pi-vs-orange-pi-vs-odroid/
 

docgreen

Member
Joined
Oct 30, 2013
Messages
55
Reaction score
7
@docgreen I posted the solution for RPi3 in another thread here.
Basically because you have a technical abilities, you could get it to work reliably in your small business.
The key to the solution is to run the operating system and PBX on the SD card as a READ ONLY FILESYSTEM.
Because once the pbx is all installed and setup and running, there's no need for it to write to its SD card disk, except for once a week or so, to install system package updates etc.
The goal is to NOT let the PBX and Linux itself, wear out the SD card by constantly writing the logs, and "atime" file access times, to it.
So you run your logs in RAM in a circular buffer of 10-20 MB.
And, you have the PBX write your important voicemails onto a SEPARATE DISK DEVICE such as ANOTHER SD card attached via the USB port.
Then, you run backup script on a daily basis, to back up your voicemails and your pbx config to the cloud.
Should disaster hit and cause your pbx to fail to boot up, you just get a new 16GB SD card for your new "operating system and PBX app" disk, and restore it from cloud. Same thing for the voicemails, but with a 64GB card.
Again, the major weakness is the SD card wearing out by not putting the filesystem into read-only, not the RPi3 itself.
Also, check out benchmarks of other versions of the Pi, http://www.cnx-software.com/2016/04...berry-pi-vs-banana-pi-vs-orange-pi-vs-odroid/

Can you link me to that thread?
 

chris_c_

Active Member
Joined
Aug 19, 2010
Messages
509
Reaction score
67

jerrm

Guru
Joined
Sep 23, 2015
Messages
838
Reaction score
405
Way too much trouble IMO. You'll be tripping over things and squashing bugs for a while. Various parts of /var/spool, /var/lib, /etc/asterisk and who knows what else need to be writable for a functioning PBX.

It could be done (setting custom paths, bind mounts, union fs, etc) but is too much headache for a one off install. If deploying a fleet of Pi's it might be worthwhile.

What we do is keep a second SD card installed in a USB reader, mount it on a daily schedule, rsync to it, then unmount. The backup SD is bootable, so if the primary fails, it's a simple swap and things are running again. A remote "burnable" image is also kept updated via rsync.

If I ever deploy another Pi3 PBX, I'd probably skip the SD card entirely and do USB boot, but with the same basic approach rsyncing to a second bootable USB drive.
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
1,607
Reaction score
826
Please understand that the technology behind USB sticks is much the same as that behind SD's they will equally fail if you over exercise them, so yes, mysql will do that, as will atime, as will logs . . . .

So possibly keep a standby stick handy and at an inappropriate 3:00am on sunday morning, drive out and replace your "broken" memory/OS, if you find that uncomfortable , spend another 50 bucks, demote your PI to an absolutely wonderful cat confuser (which it was basically designed to be) and all your angst goes away. JM2CWAE
 

jerrm

Guru
Joined
Sep 23, 2015
Messages
838
Reaction score
405
Please understand that the technology behind USB sticks is much the same as that behind SD's they will equally fail if you over exercise them, so yes, mysql will do that, as will atime, as will logs . . . .

USB will eventually hit the write limit (as will any kind of flash) but is much less prone to WTF failures than SD.

We have USB drives in routers with heavy logging, saving full tcpdumps of certain traffic that have been running for years - orders of magnitude more write activity than a PBX.

So far no angst with the Pi's and considering each has on site warm spare, 3AM trips will never be necessary. The first experiment will be a year old this month. We should replace the sd card, but I'm tempted to leave it just to see how long it can go.
 

WJCarpenter

New Member
Joined
Jun 26, 2014
Messages
4
Reaction score
2
One tiny tidbit of additional info. You can (approximately) boot an earlier RPi from a USB stick. I say approximately because the scheme is to boot from a small R/O partition on the SD card, then switch over to running from the USB stick. I don't have a link handy, but I recall I found several recipes when I was doing it several months back. It wasn't hard to track down. (It also saves wear and tear on my thumbnail when I want to remove it and mount it on a PC to fix some crucial file that I've messed up.)
 

WJCarpenter

New Member
Joined
Jun 26, 2014
Messages
4
Reaction score
2
If you aren't too fussy about having the latest Asterisk stuff, another option is to run Asterisk on a router running OpenWRT. Someone has ported a couple different Asterisk releases into the package system so that installing is pretty easy. I don't know if there are any Asterisk GUIs for that environment.

I run my home PBX on an OpenWRT router (just a couple of extensions). It's mainly for the purpose of preventing my family from understanding how to use the phones. :)
 

chris_c_

Active Member
Joined
Aug 19, 2010
Messages
509
Reaction score
67
More great experience about SD cards durability on Raspberry Pi 3.
https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=142626
Especially like the last post in the thread, how to auto-backup the Raspberry Pi's SD card to google drive, using:
https://github.com/odeke-em/drive
and
https://en.wikipedia.org/wiki/Yes_(Unix)

it seems like SSDs have much greater disclosure regarding type of wear leveling and also give more control in regards to overprovisioning. A lot of the sites I ran into claimed that SSDs are now as reliable as - if not more than - platter style HDs. I wouldn't be surprised, especially considering the result of the Boboila paper - unable to wear out a static leveling USB drive from 2010. I imagine the wear leveling algorithms and controller hardware have progressed since then, SSDs must be pretty reliable by now. Also, it seems like SSDs are held to a different standard of quality and design than USB drives - likely as USB drives are primarily sold for low throughput data storage/transport.

My personal solution towards the uncertainties of flash memory is that I routinely backup important files to an additional flash drive through scripts that run at start up. I also back up important files to Google Drive through the script - which I think is currently the most reliable way to ensure everything remains accessible. The cloud is here and a degree of disk space is free.

Burcu Dogan at Google actually wrote an interface to go between Google Drive and Linux. It's called "drive" and is maintained by Emmanuel Odeke.
https://github.com/odeke-em/drive

Using it with yes allows for automatic syncing of disk contents to Google Drive.
https://en.wikipedia.org/wiki/Yes_(Unix)
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
1,607
Reaction score
826
I just don't understand WHY, if there is an intrinsic problem with running a PBX on insufficient hardware ( as has been noted many times here) and you keep on trying to do that, and you say to your doctor " every time I do that it hurts" he says "well don't do that" . . . I'm out out of this thread , but good luck .
 

rambo

New Member
Joined
Sep 12, 2016
Messages
1
Reaction score
0
Please understand that the technology behind USB sticks is much the same as that behind SD's they will equally fail if you over exercise them, so yes, mysql will do that, as will atime, as will logs . . . .

So possibly keep a standby stick handy and at an inappropriate 3:00am on sunday morning, drive out and replace your "broken" memory/OS, if you find that uncomfortable , spend another 50 bucks, demote your PI to an absolutely wonderful cat confuser (which it was basically designed to be) and all your angst goes away. JM2CWAE
Hi Dicko,
My RASPBX just does a minimal boot from its SD card, then hands over to 160GB of spinning rust attached to the USB port.
/var/spool/asterisk/monitor contains over two years of call recordings. The drive also serves as a general purpose NAS, and the system also does some bits of home automation.
I used to use a desktop PC but I really don't want one going 24/7.
 
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top