Home » Technology » MP3 Devices (Page 5)

Category Archives: MP3 Devices

The Most Versatile VoIP Provider: FREE PORTING

Adding an iTunes Telephone Controller to Your Asterisk PBX

If you're as lazy as the rest of us, then getting up to change what's playing on iTunes or to adjust the volume is just too much like work especially if you've installed one of our PBX-in-a-Flash™ Asterisk® systems on either a dedicated Linux machine or your Windows Desktop. For long-time readers of Nerd Vittles, you may recall that we covered how to build a streaming audio server using iTunes last year. So today we add the missing piece which will let you change songs, adjust the volume, and pause and restart iTunes using any touchtone phone connected to your Asterisk or TrixBox system. Special thanks to jpe for figuring all of this out and to Acme Technologies and to David Schlosnagle for their work on the iTunes Command Line Interface.

Overview. To get things working, there are just a few, easy steps. First, you'll need a Mac running the Panther or Tiger versions of Mac OS X. Next, you'll need to download and install the iTunes Command Line Interface. Then you'll need a rock-solid Asterisk system. We recommend TrixBox 1.2.3 which you can install using our tutorial and installation scripts above. Finally, we'll add a voice prompt and tweak the dialplan a bit using freePBX to handle the telephony interface to iTunes. And, presto, you're done.

Installing the iTunes CLI. We're assuming you've already got a Mac up and running with the required version of Mac OS X. If not, start there. Then download the iTunes Command Line Interface onto your Mac Desktop. Unless you've secured Safari, it will decompress the downloaded file automatically leaving you an iTunes Remote Control folder on your Desktop. If it doesn't automatically decompress the .sit file, then just double-click on it. Now open a Terminal window and switch to root access using your Mac password: sudo su. Then execute the following commands:

cd Desktop
cd "iTunes Remote Control"
cp itunes /bin/itunes
chmod +x /bin/itunes
ifconfig
itunes play
itunes play

The ifconfig command lets you decipher the private IP address of your Mac. Write down the inet address for the network interface you're using to connect your Mac to your private network (usually found in the listing for en0 or en1). To complete the installation on the Asterisk box, you'll also need to know a username and password for your Mac. If you don't know, you can find all your Mac usernames by changing to the /Users folder and typing ls. The last two commands should crank up iTunes on your Mac Desktop and begin playing whatever the last song or podcast you listened to. If everything's working, you can close the Terminal window on your Mac. We're done with the Mac part of the drill.

Password-Free SSH Access. As with our Proximity Detection System and Backup tutorials, we want to use SSH to communicate between the Asterisk system and iTunes on your Mac. As you know, SSH typically prompts for a password when you connect to a remote resource. So here's the trick if you haven't read our previous articles. Log into your Asterisk system as root. Because the Asterisk system will actually be the actual user connecting with SSH, we need to switch from the root user to the asterisk user account to get things set up correctly: su asterisk. Then, from the command prompt, issue the following command: ssh-keygen -t rsa. Press the enter key three times. You should see something similar to the following. The file name and location in bold below is the information we need:

Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/asterisk/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/lib/asterisk/.ssh/id_rsa.
Your public key has been saved in /var/lib/asterisk/.ssh/id_rsa.pub.
The key fingerprint is:
1d:3c:14:23:d8:7b:57:d2:cd:18:70:80:0f:9b:b5:92 asterisk@asterisk1.local

Now we want to copy the public key file (in bold above) to your Mac from your Asterisk system using SCP. The command should look like the following (except use the private IP address of your Mac instead of 192.168.0.104 and use your Mac username instead of the two instances of username below). Provide the Mac password for the username you've chosen when prompted to do so.

scp /var/lib/asterisk/.ssh/id_rsa.pub username@192.168.0.104:/Users/username/.ssh/authorized_keys

Once the file has been copied, you now should be able to log into your Mac from your Asterisk system using SSH without being prompted for a password. Let's try it. Here's the command. Just substitute your username and the IP address of your Mac below:

ssh username@192.168.0.104

You should be admitted without entering a password. Type exit twice to log out of your Asterisk system and to log out as user asterisk. If it didn't work, repeat the drill or read the complete article and find where you made a mistake.

Modifying Your Dialplan to Support the iTunes CLI. Now we're ready to cut and paste some code. Connect to your Asterisk system using your web browser by pointing to the internal IP address of your server: http://192.168.0.104. Choose System Administration and log in with username maint and your password. Now choose Config Edit and click on extensions-trixbox.conf in the list of config files. When the editor opens, add the following lines in the [from-internal-trixbox] context of the file:

exten => 673,1,Answer ; Dial MP3 to manage iTunes
exten => 673,2,Wait(1)
exten => 673,3,DigitTimeout(5)
exten => 673,4,ResponseTimeout(7)
exten => 673,5,Goto(itunes,s,1)

This will let you dial MP3 or 6-7-3 from any extension on your Asterisk system to manage iTunes on your Mac. While you're still editing extensions-trixbox.conf, scroll to the bottom of the file and add the following chunk of code:

[itunes]
exten => s,1,setvar(user=username)
exten => s,2,setvar(ituneshost=192.168.0.104)
exten => s,3,background(custom/itunes)
exten => s,4,background(beep)
exten => 1,1,system(ssh ${user}@${ituneshost} /bin/itunes mute)
exten => 1,2,goto(99,1)
exten => 2,1,system(ssh ${user}@${ituneshost} /bin/itunes pause)
exten => 2,2,goto(99,1)
exten => 3,1,system(ssh ${user}@${ituneshost} /bin/itunes unmute)
exten => 3,2,goto(99,1)
exten => 4,1,system(ssh ${user}@${ituneshost} /bin/itunes prev)
exten => 4,2,goto(99,1)
exten => 5,1,system(ssh ${user}@${ituneshost} /bin/itunes play)
exten => 5,2,goto(99,1)
exten => 6,1,system(ssh ${user}@${ituneshost} /bin/itunes next)
exten => 6,2,goto(99,1)
exten => 7,1,system(ssh ${user}@${ituneshost} /bin/itunes vol 25)
exten => 7,2,goto(99,1)
exten => 8,1,system(ssh ${user}@${ituneshost} /bin/itunes vol 50)
exten => 8,2,goto(99,1)
exten => 9,1,system(ssh ${user}@${ituneshost} /bin/itunes vol 100)
exten => 9,2,goto(99,1)
exten => 0,1,system(ssh ${user}@${ituneshost} /bin/itunes mute)
exten => 0,2,goto(99,1)
exten => *,1,system(ssh ${user}@${ituneshost} /bin/itunes vol down)
exten => *,2,goto(99,1)
exten => #,1,system(ssh ${user}@${ituneshost} /bin/itunes vol up)
exten => #,2,goto(99,1)
exten => 99,1,NoOp(${SYSTEMSTATUS})
exten => 99,2,GotoIf($["${SYSTEMSTATUS}" = "APPERROR"]?99,6)
exten => 99,3,background(num-was-successfully)
exten => 99,4,background(activated)
exten => 99,5,goto(s,4)
exten => 99,6,background(im-sorry)
exten => 99,7,background(an-error-has-occured)
exten => 99,8,wait(1)
exten => 99,9,background(goodbye)
exten => 99,10,Hangup
exten => t,1,goto(s,1)
exten => h,1,Hangup

Now move up to the first line of code (s,1) and change username to reflect the account name on your Mac that will be used to manage iTunes. It's got to be the same one that was used in the SSH keygen step above! Now move to the second line of code (s,2) and plug in the IP address of the Mac running iTunes. Save your changes by clicking the Update button. Close your browser, and don't worry about restarting Asterisk just yet because we have one final step to go.

Installing the iTunes CLI Voice Prompt. Just to give our new system a professional touch, let's add a custom voice prompt from Allison Smith to greet callers dialing MP3 on your system. Log into your Asterisk server as root and issue the following commands. The final one will restart Asterisk to load our dialplan updates from above.

cd /var/lib/asterisk/sounds/custom
wget http://nerdvittles.com/trixbox123/itunes.gsm
chown asterisk:asterisk itunes.gsm
amportal restart

Taking the iTunes Controller for a Spin. Now that the installation is complete, let's try it out. Make sure your Mac is turned on. Then pick up a telephone on your system and dial MP3. You'll be welcomed by Allison and prompted to enter a command. Using the commands shown on the adjacent keypad diagram, you can control virtually all aspects of iTunes. When you've finished entering commands, just hang up. It's that simple. If you happen to be streaming iTunes music to other desktops or your cellphone, then you'll really appreciate this addition to your Asterisk application software collection. Enjoy!


Nerd Vittles Demo Hot Line. You now can take a number of Nerd Vittles projects for a test drive... by phone! The current demos include NewsClips for Asterisk (latest news headlines in dozens of categories), MailCall for Asterisk with password 1111 (retrieve your email by phone), and Nerd Vittles Weather Forecasts by U.S. Airport Code. Just call our number (shown in the left margin) and take any or all of them for a spin. The sound quality may not be perfect due to performance limitations of our ancient Intel 386 demo machine. But the price is right.

Nerd Vittles Fan Club Map. Thanks for visiting! We hope you'll take a second and add yourself to our Frappr World Map compliments of Google. In making your entry, you can choose an icon: guy, gal, nerd, or geek. For those that don't know the difference in the last two, here's the best definition we've found: "a nerd is very similar to a geek, but with more RAM and a faster modem." We're always looking for the best BBQ joints on the planet. So, if you know of one, add it to the map while you're visiting as well.

Hosting Provider Special. Just an FYI that the Nerd Vittles hosting provider, BlueHost, has raised the bar again on hosting services. For $6.95 a month, you can host up to 6 domains with 50GB of disk storage and 999GB of monthly bandwidth. Free domain registration is included for as long as you have an account. That almost doubles last month's deal, and it really doesn't get any better than that. Their hosting services are flawless! We oughta know. We've tried the best of them. If you haven't tried a web hosting provider, there's never been a better time. Just use our link. You get a terrific hosting service, and we get a little lunch money.

Want More Projects? For a complete catalog of all our previous Asterisk projects, click here. For the most recent articles, click here and just scroll down the page.

Headline News for the Busy Executive and the Lazy Loafer. Get your Headline News the easy way: Planet Asterisk, Planet Gadget, Planet Mac, and Planet Daily. Quick read, no fluff.

Got a PDA or Web-Enabled Smartphone? Check out our new PDAweather.org site and get the latest weather updates and forecasts from the National Weather Service perfectly formatted for quick download and display on your favorite web-enabled PDA, cellphone, or Internet Tablet. And, of course, it's all FREE!

The Whole House iPod

While the dust settles a bit in the TrixBox world, we thought we’d digress today and tell you about an incredible whole house audio system. Yes, there’s the iPod for private listening and there are some streaming audio solutions for those that want music in one or two rooms of a home or office. But what if you want music (different music) available in every room of your home. Well, until now, you could look at spending $20,000 to $50,000 for a very proprietary solution such as Elan’s Home Systems. It’s no accident that you won’t find any pricing on their web site.

As luck would have it, we just moved into a new home that was prewired for audio and video in eight rooms including recessed ceiling speakers in all the rooms. While this is an expensive proposition when retrofitting an older home, it’s fairly reasonable during new construction, and many builders now include it as part of the cost of a new house. The gotcha, however, is adding the multi-room amplifier, the audio devices to produce the music, and the touchpanel control units in each room. Can you spell outrageously expensive! In round numbers, you’re looking at $5,000 for installation of a suitable amplifier, $1,500 to $2,500 for each ultra-proprietary touchpanel display, and another $10,000 or more for the audio sources. These include CD jukeboxes, iPods with infrared remote access, a multi-channel XM radio receiver to the tune of $1,500 plus XM radio fees of nearly $30 a month (for three channels) forever, and loads of consulting fees at $100+ an hour. Each of the touchpanels or keypads is manually configured to match the audio components you purchase so that you can switch audio sources, adjust volume, and skip songs in each room. The double-gotcha is that despite having spent tens of thousands of dollars on this system, you have no ability to adjust anything down the road without another $100 an hour service call from the installer. So just pray they’re still around, or you’re basically stuck with your initial setup forever. A $500 magic box is used to configure the touchpanels and keypads, and, NO, you can’t buy one. It’s not sold to consumers, just dealers. Ouch!

You should be getting the picture of why we went shopping for an alternative with a bit more flexibility. That’s when we stumbled upon an incredible product called the Sonos Digital Music System. In a nutshell, you have a self-contained system unit in each room where you want music. It includes an optional amp for connection to a pair of speakers, wired and wireless networking, and a user and streaming audio interface that is as good or better than the iPod. Then you add as many touchpanel control units to select music and music sources as your budget can afford. There are also PC and Mac versions of the touchpanel which won’t cost you a dime. Each touchpanel can control every zone (aka room) in your home. What you don’t need with this system is a house prewired for audio because each unit lets you connect directly to a set of speakers or an external amplifier if desired. You also don’t need a wired network throughout your home. Only one of the Sonos units needs to be connected to a wired network. The rest of the devices automatically configure themselves to communicate wirelessly with the other system units and controllers scattered throughout your home. If you buy the starter pack with two system units including amps and one controller unit, you’re looking at $1,200 which works out to roughly $500 per system unit and about $200 for the controller. That’s roughly one tenth the cost of a functionally similar controller unit from Elan except you can configure the Sonos controller while a dealer has to configure the Elan unit … at $100 an hour.

I feel a little like the guy selling the Ginsu knives on television: "but there’s more." Boy, is there! Not only is the sound of the systems downright incredible (depending upon your speakers, of course), but the variety of available music sources is going to make you want some of these in the morning. Each system unit can stream audio from almost any music source imaginable. This includes MP3’s stored on your PC, Mac, or our latest discovery, a $150 network-attached storage (NAS) device. You also can play Shoutcast streams, either your own or those available for free over the Internet. Another option is to map a file share from a Sonos unit to a Mac or PC. It takes about 10 seconds. Sonos units also can play music from Rhapsody. And, if you’re lucky enough to be a Comcast broadband subscriber like us, a Rhapsody streaming audio subscription with about 50 music channels is yours for free! Just login to your Comcast account and download the Comcast Rhapsody software to any Windows PC. Rhapsody Stations are every bit as good as XM or Sirius channels with one important difference. There’s no additional monthly charge to Comcast customers for as many simultaneous streams as you care to play. That’s quite a contrast from Elan’s three XM streams solution which means three rooms with XM radio and no more … for $30 a month … once you buy your $1,500 Elan XM receiver. With Rhapsody, you won’t need a receiver at all, just an old clunker PC sitting in the corner with the Rhapsody application running. It can be used for other tasks as well. At the moment, we have my daughter’s game PC running Rhapsody with four simultaneous streams playing in seven zones of the house. You can double up zones with the click of a button using any Sonos controller. In addition to all these music sources, you also can connect an old-fashioned analog audio device (like a CD jukebox or an iPod) to each system unit. Music from these sources can be streamed to any combination of rooms you choose, just like traditional Shoutcast streams or Rhapsody stations. The only thing missing with analog device streams is the album art, but it still sounds great.


There are some other reviews of the Sonos system which are worth a look. Check out David Pogue’s article in the New York Times, the Home Theater View, Audioholics, Playlist Magazine, and PC Magazine. Then you’ll want to run, don’t walk, to buy at least one for yourself! You can purchase units from Sonos and most of their dealers with a 30-day money-back guarantee. We installed eight systems with four remotes in just over two hours. We haven’t quit listening since. Now you know why we’re running a little behind on the Asterisk® and TrixBox articles. Enjoy!


Hosting Provider Special. Just an FYI that the Nerd Vittles hosting provider, BlueHost, has continued their limited time special on hosting services. For $6.95 a month, you can host up to 6 domains with 15GB of disk storage and 400GB of monthly bandwidth. Free domain registration is included for as long as you have an account. It doesn’t get any better than that, and their hosting services are flawless! We oughta know. We’ve tried the best of them. If you’ve never tried a web hosting provider, there’s never been a better time. Just use this link, and we’ll all be happy.


Nerd Vittles Fan Club Map. Thanks for visiting! We hope you’ll take a second and add yourself to our Frappr World Map compliments of Google. In making your entry, you can choose an icon: guy, gal, nerd, or geek. For those that don’t know the difference in the last two, here’s the best definition we’ve found: "a nerd is very similar to a geek, but with more RAM and a faster modem." We’re always looking for the best BBQ joints on the planet. So, if you know of one, add it to the map while you’re visiting as well.

Want More Projects? For a complete catalog of all our previous Asterisk projects, click here. For the most recent articles, click here and just scroll down the page.

Headline News for the Busy Executive and the Lazy Loafer. Get your Headline News the easy way: Planet Asterisk, Planet Gadget, Planet Mac, and Planet Daily. Quick read, no fluff.

Got a PDA or Web-Enabled Smartphone? Check out our new PDAweather.org site and get the latest weather updates and forecasts from the National Weather Service perfectly formatted for quick download and display on your favorite web-enabled PDA, cellphone, or Internet Tablet. And, of course, it’s all FREE!


Some Recent Nerd Vittles Articles of Interest…

The Best of Santa: Introducing the Nokia 770 Internet Tablet.everything

Ever wished someone would come up with a portable Wi-Fi and Bluetooth-enabled device with a web browser, email client, news reader, PDF viewer, streaming audio and video players, and a SIP phone all rolled into a Linux-based, Internet Tablet? Well, it’s here with the exception of the SIP phone which is scheduled for early 2006. It’s about the size of your hand. And, if games are your thing, there’s Chess, Mahjong, Marbles, and virtually any other game that has been ported to the ARM version of Slackware including clones of Tetris, IceBreaker, Minesweeper, Doom, and on and on.

The good folks at Nokia (yep, the cellphone people) finally have shipped the Nokia 770. And what a toy it is: the perfect addition to every commuter train ride or Starbucks visit. You may never travel with a notebook PC again. By loading an X terminal emulator, you have a Linux command prompt that will let you load and install virtually any Debian application on the planet: ssh, rsync, Office-compatible apps, VNC, NFS, GAIM IM, SQLite, and yes, someone has even ported the Asterisk® PBX to the 770. For those with a compatible Bluetooth cellphone, you can use your phone as your 770’s Internet link when there’s no Wi-Fi access point in your vicinity. It’s a bit quirky, but it does work with both CDMA and GSM Treo 650’s. And the best news of all: the Nokia 770 sports a high-res color screen that will have you believing you’re still sitting at your desktop PC. Best price: $349 at CompUSA this week.

If you want to learn more, start at Nokia’s site for Flash-based demonstrations (which play equally well on the Nokia 770 incidentally). Then visit the Nokia-supported development site, maemo.org, and have a look at the long list of apps which already are available and are free to download. And then head over to Vidar Madsen’s and Russell Beattie’s sites to see what’s new in the Nokia 770 universe. And by all means pay a visit to Ari Jaaksi, whose Open Source team at Nokia made it all possible. For a more detailed review, visit this ArsTechnica link. Still have questions? Check out the Internet Tablet Talk Forums.

The Music Frontier: Taming Streaming Audio for Music on Hold with Asterisk

Using streaming audio with the Asterisk® music on hold facility is another one of those little gotcha's that gives a lot of folks problems so we decided to wrap up 2005 by outlining a working setup of streaming audio for both Asterisk@Home 1.5 and Asterisk@Home 2.2. And, yes, it'll work with either recent version of pure Asterisk with a little extra elbow grease.

UPDATE: For releases of Asterisk after 1.4, this tutorial will not work. See our updated article for Asterisk 11.

Prerequisites: Before streaming audio can be used for Music on Hold (MOH) with Asterisk, there are three essential pieces. First, you must have a source of streaming audio that works. Second, you need a streaming audio player on your Asterisk/Linux server that can "talk" to your Asterisk system. And, finally, Asterisk has to be properly configured to support streaming audio as the source for your music on hold.

Choosing a Streaming Audio Source. An almost infinite variety of streaming audio exists on the net. If you're just getting into streaming audio, head over to Shoutcast.com for over 12,000 FREE sources to get you started. If you'd prefer to set up your own Shoutcast server, Nerd Vittles has previously covered solutions for both the Windows (WinAMP) and Mac (NiceCast) platforms. Unless computer viruses and Trojans (not that kind!) are your thing, buy a $500 Mac mini and call it a day. NiceCast works flawlessly. Insofar as Asterisk is concerned, here's the bottom line. If the streaming audio source you've chosen sounds like crap when you play it on your PC or Mac, it will sound the same way (or worse) as your MOH source. So start this project by picking a source that sounds good and be sure it plays reliably on your desktop PC or Mac before proceeding further. Keep in mind that anything above a 24K mono stream is wasted on a telephone call so there's no need to choose a 128K stereo audio stream unless you just want to eat up your bandwidth. And, finally, keep in mind that, unless you're using your own stream on your private LAN, the streaming audio will be using the same bandwidth that you need to support incoming and outgoing phone calls over your broadband connection. So less is more!

Configuring an Asterisk MP3 Player. For those using Asterisk@Home 1.5 or a more recent version of Asterisk@Home 2.x, then you have a version of mpg123 that is suitable for playing streaming audio as your MOH source. If you're not sure, log in to your server and type mpg123 -v to see what version of mpg123 is installed on your system. You'll need at least 0.59r to "talk" to Asterisk properly. If you need an update, here's a tutorial that will get you up to speed.


Building a Stream Directory. Next we need a directory to actually hold the contents of the stream while it's playing on your Music on Hold system. Log into your Asterisk server as root. Then switch users to asterisk: su asterisk. Now move to the default MOH directory: cd /var/lib/asterisk/mohmp3. Create a new directory to hold the streaming audio: mkdir stream. Switch to the new directory: cd stream. Now make an empty file to be used for the stream contents: touch stream.mp3. Close your asterisk user session by typing exit. That will leave you logged in as root.


Configuring Asterisk for MOH Streaming Audio. Now we need to set up a music on hold channel for your streaming audio: nano -w /etc/asterisk/musiconhold.conf. If you're using your own streaming audio server, then the line you want to add at the bottom of the file will look something like this except with the actual internal IP address of your Shoutcast server and the correct port number of your audio stream. Hint: NiceCast tells you everything you need to know by clicking the Share button.

stream => quietmp3:/var/lib/asterisk/mohmp3/stream,http://192.168.0.107:8000/

If you're using an external source, then the line will look something like the following. Just right click on the streaming audio link you've found and save the address to your clipboard for pasting:

stream => quietmp3:/var/lib/asterisk/mohmp3/stream,http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=3281&file=filename.pls

Once you've specified your audio stream, save the updated musiconhold config file: Ctrl-X,Y,then press enter.


Testing Your MOH Stream with Asterisk. With everything now properly configured, let's set up an extension just to be sure it's working correctly. Edit your extensions_custom.conf file:

nano -w /etc/asterisk/extensions_custom.conf

Then add the following somewhere within the [from-internal-custom] context:

exten => 466,1,Answer
exten => 466,2,Playback(pls-hold-while-try)
exten => 466,3,SetMusicOnHold,stream
exten => 466,4,WaitMusicOnHold,300
exten => 466,5,Hangup

Once you've added this extension code, save the updated file: Ctrl-X,Y,then press enter. Now restart Asterisk: amportal stop then amportal start. Pick up one of the phones on your Asterisk system and dial 466. After you're connected, it may take up to 15 seconds for the streaming audio to begin, but this delay only occurs on the first connection. Once you've heard your audio stream playing, hang up and call back just to make sure.


Configuring Streaming Audio as Default Music on Hold. Now that we have everything working, you may decide you'd prefer to replace your default MOH tunes with your new streaming audio source. It's easy. Edit the musiconhold config file again. Comment out the line beginning with "default" by inserting a semicolon at the beginning of the line. Then change the line we added which begins with the word "stream" so that it looks like this:

default => quietmp3:/var/lib/asterisk/mohmp3/stream,http://192.168.0.107:8000/

Save the updated file, and then restart Asterisk: amportal stop then amportal start.


1-800-411-METROFree Directory Assistance Service Launched. For those not using BroadVoice (which now has the same 411 service), write this number down or add it to your Asterisk dialplan for free directory assistance calls in the United States: 1-800-411-6387. It's also a free VoIP call with the providers listed below once you set up an account with one of them. You can read our reviews of these providers here. Assuming you have an account, just add ONE of the following sets (that match the provider with whom you have set up an account) to the [from-internal-custom] context in extensions_custom.conf:


exten => 411,1,Dial(IAX2/goiax/18004116387)   ; GoIAX Free Call
exten => _1NXX5551212,1,Dial(IAX2/goiax/18004116387)
exten => _NXX5551212,1,Dial(IAX2/goiax/18004116387)

exten => 411,1,Dial(IAX2/fwd/*18004116387)    ; FWD Free Call
exten => _1NXX5551212,1,Dial(IAX2/fwd/*18004116387)
exten => _NXX5551212,1,Dial(IAX2/fwd/*18004116387)

exten => 411,1,Dial(IAX2/teliax/18004116387)  ; Teliax Free Call
exten => _1NXX5551212,1,Dial(IAX2/teliax/18004116387)
exten => _NXX5551212,1,Dial(IAX2/teliax/18004116387)


Farewell to WordPress Cut-And-Paste Nightmare. For long-time readers of this column, you know what a royal pain cutting-and-pasting has been at Nerd Vittles thanks to the WordPress blog's proclivity for changing quotation marks (used in many Asterisk commands) to 'smart quotes' and replacing double-hyphens (used in many Linux commands) to 'long hyphens.' The end result has been that, while the code worked great on our development systems, it blew up when you used cut-and-paste to move it to your Asterisk server. This all came to a head this past week when our article on faxing blew up on every reader's system because of the double-hyphens ... which we actually didn't know was a problem until several days after the article hit the street. Merry Christmas to us!

Just like everything else that's great about the Open Source community, there is always someone smart enough not only to recognize a problem but also to fix it. So our hat is forever tipped to Alex King, one of WordPress's most ardent supporters. He wrote about the problem and then he single-handedly fixed it with his WP Unformatted Plugin. It just took us a while to discover it. There's nothing like a double helping of egg on your face to make you scratch a little harder for a solution. Now that we have the plugin, we'll be using it regularly and, as quickly as we can, we'll go back and rework all of our previous articles as well. So, hopefully the problem will go away for you and for us permanently. Should you see any code that still looks like it has quotation marks pointing in two different directions, please let us know. And ... thanks for your patience.

Free Calls from Nerd Vittles. Celebrate the New Year with a free call on us and our friends at TelaSIP. You can read all about it here.

Want More Projects? For a complete catalog of all of our Asterisk projects during 2005, click here. Have a Happy New Year, and we look forward to serving up loads of new Tips and Tricks for Asterisk in 2006!

iTunes Bait and Switch: Say It Ain’t So, Steve

After selling over 400 million songs through the iTunes Music Store, Apple reportedly has pulled a fast one. The Bait: Remember the original iTunes promise? Songs purchased on iTunes could be copied to an unlimited number of iPods that you own and could be played on up to five Macs or PCs. And you could burn playlists to music CDs up to seven times. And you could burn individual songs to music CDs an unlimited number of times. Well, that was then and this is now according to a little blurb on VersionTracker this week. In announcing the latest release of Roxio’s award-winning CD and DVD burning software, Toast Titanium 6.1, which was supposed to fix some compatibility issues with Tiger, a not-so-subtle gotcha has been added. The Switch: "Following discussions with Apple, this version will no longer allow customers to create audio CDs, audio DVDs, or export audio to their hard drive using purchased iTunes music store content."

If true, Apple’s welching on the terms of their music license with end-users by strong-arming software developers into crippling their CD burning software may just earn them one of the biggest class-action lawsuits of the century … to the tune of 400 million already-purchased songs. Does Apple have the right to change the terms of their music license for future sales from iTunes? I suppose so. Do they have the right to change the rules for songs people have already purchased? Any first-year law student could answer that as could most folks with about an ounce of common sense. But you can still burn a CD using iTunes, you might be saying. And I would respond, "Yeah. This week." How many times in the past year has Apple made changes to iTunes that further restrict your use of music you lawfully purchased? Making iTunes the exclusive software for burning music CDs of music purchased from the iTunes Music Store will work just about as well as letting the Arab nations unilaterally set the price of oil. What’s coming next: music CDs that will only play on Apple CD players. Give us a break! Maybe it’s time for folks to take a look at allofmp3.com after all. It’s only 95¢ a song cheaper than iTunes. But we were all trying to be good citizens, except Apple apparently. If Apple can continually change the ground rules after the fact, then it’s hard to fault those who resort to tools such as PyMusique to protect their music investment.

The fundamental difference in what Roxio apparently was doing to reverse engineer the Apple encryption scheme and what Real appears to be doing is quite simple. People have always had a contractual right to copy their encrypted songs to music CDs. So, just as printer manufacturers have no right to assert the Digital Millenium Copyright Act (DMCA) to bar competitors from making compatible print cartridges, Apple has no legitimate DMCA claim to bar other companies from providing tools to perform the lawful act of making music CDs from iTunes downloaded songs. If Apple was only worried about their encryption scheme with no ulterior motives, then it would have been a simple matter to license a decryption library to Roxio for the limited purpose of making music CDs from iTunes downloaded music. That obviously didn’t happen.

It’s too bad that Apple, which has been embraced by the public as the model technology company in this country, just can’t seem to resist the temptation to jump into the legal thicket and shoot itself in the proverbial foot. Worse yet, it always seems to happen when Apple is on a roll. Makes you wonder what would happen if Apple really were in the desktop computing driver’s seat, doesn’t it? Once word spreads that Apple is beginning a process of further crippling music downloads by changing the original terms of their deal with the public, then, read my lips, the iTunes lock on music downloads is going to be history. So, Steve. Say it ain’t so. You’ve inspired a new generation of kids to actually buy their music. Don’t make them all sorry they trusted you.

About the Author. Ward Mundy is a retired attorney who spent more than 30 years providing legal and technology assistance to the federal courts in the United States. Nothing in this article should be construed as legal advice, and obviously the views expressed herein are solely those of the author.

Road Warrior’s iPod Solution … and an Alternative

Like the rest of the universe, we’re pretty much sold on iPods to handle all of our music needs, but there’s an exception to every rule. The exception in this case is for those of us that carry around a USB flash drive on our keychain to meet other needs. Strolling down the Costco aisle the other day, I ran across a slick little device for about $25 that turns any iPod or even a garden-variety USB flash drive into an MP3 music source for your vehicle. Checker Auto has it for $10 more. And Wal-Mart carries them as well. It’s called a VFM7 FM Modulator from a company called Roadmaster. In addition to functioning as your own private FM radio station, it also can play MP3 files (only) from almost any USB flash drive. And it includes a 3.5mm line input jack for attaching virtually any music device including any iPod. Wouldn’t you think the automobile manufacturers could spring for a line input jack on automobiles that now cost as much as a house? Kinda reminds me of the oil companies. They had no problem washing your windshield and checking your oil when gas was 40¢ a gallon. Now that a gallon of gasoline costs over five times that much, you get to do it yourself. Go figure. Just play your music louder. It’ll help you forget!

The VFM7 can broadcast on any of seven FM frequencies which provides the necessary flexibility to avoid interference in all but the largest metropolitan areas. Having tried many FM modulators over the years, I can tell you that this one ranks right up there with the best. The trick to most FM modulators is to plug them in, leave the music off, and try each frequency matching your FM radio to your choice on the modulator until you find one that is quiet, i.e. no noise, no faint radio signal, and no hiss. The round button (see inset) changes frequencies, and the other three buttons are for skip to previous song, play/pause, and skip to next song. Once you’ve found the correct frequency for your area, plug in your audio device or USB flash drive and press play. There are tons of FM modulators you might be saying. And right you are. But most of them aren’t the size of a slightly enlarged car cigarette lighter, and none of them have a USB MP3 player and line in jacks built in to the unit. Usually you’ve got a bunch of dangling cords to contend with in addition to the modulator. And most of the non-battery modulators lack the flexibility to support both USB flash drives and line in using the same unit. If you’re a boating enthusiast, you’ll also find using a $25 flash drive with a $25 FM modulator makes a lot more sense than risking an unintended swim for your mega-hundred dollar iPod.

And speaking of USB flash drives, here’s a great little secret if you don’t already have your fill of flash drives. What we’ve started doing is building different music collections on different flash drives for travelling. Then all you have to do is swap out flash drives when you want to switch from country music to punk rock. The SanDisk Cruzer Micro series of drives has the added flexibility of being able to plug in to the Cruzer Micro Companion MP3 player to provide a portable MP3 player using a single AAA battery and a set of headphones. You get about 7-9 hours of play time out of an alkaline battery. The 256MB flash drive costs about $25 and the 512MB drive is about $40. Larger drives are available as well. The MP3 player device is about $45. Or you can purchase a combination 512MB flash drive with the player. Buy.com was the cheapest source earlier this week, but you might want to run the items through PriceGrabber and check the latest pricing. As a rule of thumb, a 256MB flash drive holds about four hours of music, and we’ve found that bigger isn’t always better. Each time you power off the VFM7, you go back to the first song on your flash drive so smaller, multiple drives tend to make more sense. Another approach on the Windows platform is to use Renamer to shuffle your songs from time to time. Enjoy!

Tiger Vittles. In celebration of Apple’s release today of Mac OS X Tiger, Tiger Vittles presents a round-up of what works and what won’t with Tiger and unveils a new database app to let everyone report on their favorite programs: Tiger-Ready Applications: The Good, The Bad, and The Ugly.

ISP-In-A-Box: The $500 Mac mini (Building a Streaming Audio Server, Part II)

Todd Daniele's Apple VictrolaToday, we want to finish building our streaming audio server by picking up where we left off in Part I. We’ll assume that you already have chosen your favorite player or smartphone and that you’ve opted out of buying Apple’s just-announced Victrola (click inset) or Sony’s latest marvel, the NetJuke. Did we forget to say it … April Fool’s. So we’ll be putting in place your own server using a Mac mini to send your tunes to your streaming audio player, whatever it may be. As we mentioned last week, streaming music is a processor and bandwidth intensive operation because your Mac not only has to decode a compressed music file stored on your local disk and broadcast it to the streaming server, but the streaming server also has to recompress it and manage the audio streams for each player that connects to your streaming server. Put another way, you probably don’t want to be transmitting a 192K audio stream in stereo if you only have a broadband Internet connection with limited upload bandwidth.

So the best place to begin the design of your streaming audio server is with a pencil and some math fundamentals. The bottom line is that a streaming audio server can only stream as much data as your Internet upload connection will support. How do you figure this out? Well, first you need to know how much upload bandwidth your Internet connection supports. Don’t take your ISP’s word for it. Instead, visit a site such as DSL Reports and run a Speed Test. The MegaPath Networks site usually works well. We don’t care so much about download performance for this project. What we’re interested in is the upload number. Let’s assume your upload number is 256 kbps. To determine the maximum bitrate that your server can support, divide the number of simultaneous streams you wish to support by the upload bandwidth of your connection. For example, the maximum bitrate your 256 kbps connection could support with two streams is 128 kbps. For 8 simultaneous streams, the supported bitrate would be 32 kbps. What happens if you do the math wrong or cheat? Your server crashes and burns. It’s that simple. Actually, the burning part is hyperbole, but you can almost count on a crash.

Another factor to consider in planning the bitrate for your streaming server is the player hardware and download bandwidth of your target audience. We’re going to assume that you are the target audience for your stream to keep things on the up and up. You did read our first installment, didn’t you? So, if you only will be supporting one stream (to you) and you plan to listen to your music on your cellphone, then a bit rate of 24 kbps in mono is probably about right unless you want the audio stream at the receiving end to die and restart regularly. If, on the other hand, you plan to play the stream from your home server at your beach house 500 miles away using an AudioTron with a three megabit cable modem connection to the Internet, then a 128 kbps stream in stereo may be more appropriate to improve the quality of the music at the receiving end. Just keep in mind that the higher the stream rate, the more processing power is required to pump out the stream. And, to broadcast in stereo, means multiplying everything by two.

Choosing A Streaming Server. Assuming you’ve solved the bandwidth requirements, step two is actually choosing a Streaming Audio Server. As we mentioned in the first part of this article, this is complicated a bit by the fact that you also need a Broadcast Server in the Shoutcast environment. If you only want a system which can send a single song on demand or a system which will play a predefined playlist, then Nullsoft’s Shoutcast DNAS server for the Mac is a perfect fit, and you can download it here. Be sure to carefully read the installation and configuration instructions which are included on Nullsoft’s web site. For the broadcaster component on Mac OS X, you can download the Shoutcast DSP Plugin for Mac OS X here. Be sure to review the configuration settings before you install the software and keep in mind that the Mac broadcast module cannot stream input from a sound card, only a playlist.




Other Broadcast Options. Let’s assume that your only reason for doing any of this is to impress your friends by playing some unique content on your cellphone "live." Nothing quite beats the iMan’s talk-radio broadcast if this is your goal. And there are a couple of approaches on the Mac platform. The first is to install the Shoutcast DNAS server on your Mac as outlined above and use the Windows platform for the broadcasting module. In this scenario, you download WinAmp 2 for Windows XP from here and then download the Shoutcast DSP Plugin for WinAmp 2.0 from here. You obviously have to have a Mac and a spare Windows XP machine and a radio with a line out jack to make this work. The only trick to successfully connecting all the pieces is making sure the passwords for the streaming server on the Mac and the WinAmp broadcaster module match. And, of course, make sure that the Shoutcast port isn’t blocked by a firewall on either your Mac or the Windows XP machine. If this sounds like a configuration nightmare, trust me. It is!

NicecastThe Smarter Alternative. Unless you just spent your last nickel for lunch today, there is a far simpler way to bring up a streaming audio server on the Mac platform, but it’ll cost you $40. The product is Rogue Amoeba’s Nicecast. You can try it for free, and it’s fully functional for the first 20 minutes of every broadcast. Then the quality of the audio stream starts to deteriorate. If we’re still talking about listening to the iMan, 20 minutes is probably more than enough in one sitting anyway. In short, you can make absolutely certain that Nicecast meets your needs before you spend a dime. Complete installation and setup takes about two minutes, and Nicecast provides both the streaming server component which is Shoutcast-compatible and the broadcaster component. And any content you can play or hear on your Mac can be streamed with Nicecast. This includes iTunes as well as input from a microphone, a mixer, any radio with a line out jack, or even EyeTV. On the Mac mini, you’ll need a USB input device for most of these options. Griffin’s iMic is the best value. Finally Nicecast includes 40 professional plug-in’s including a terrific equalizer to improve the quality of your stream.

To get started, download and install the software. Run the application by double-clicking the Nicecast icon in your Applications folder. Click on the Source button and pick your input source. Click on the Input button and name your streaming station. You can include a genre and web site address if desired. Click on the Quality button and choose the quality of your audio stream. Nicecast will make an educated guess based upon the speed of your Internet connection, but you can change it in one click by selecting one of the predefined stream types. Click the Share button, and Nicecast will provide you the web link to use in your player. Make certain that Port 8000 is open on your Mac firewall and that Port 8000 on your hardware-based firewall is mapped to the internal IP address of your Mac streaming server. Now click the Start Broadcast button, and you’re in business. It really doesn’t get much easier than that which explains why Nicecast has won just about every software award worth winning including MacWorld’s Editor’s Choice in December, 2004. And, if you do ever need help, Nicecast’s first-rate documentation is as close as the Help button in the application. Finally, if you’re thinking this whole project sounds pretty silly, then take a few minutes and read this article which explains better than I why, a year from now, this project and the Mac mini may not look so silly after all. See you next week for FTP servers.

ISP-In-A-Box: The $500 Mac mini (Building a Streaming Audio Server, Part I)

Most of our Mac mini projects, which also work fine on any other Mac running Mac OS X v10.3, have focused on open source solutions at no cost. The reason was not so much because the technology was free (although that’s obviously a big plus for many of us) but because the open source software was the best in its class. The landscape is a little different in the streaming audio world. You can build a streaming audio server on a Mac with free tools, but they are not open source. While the quality is certainly still there, the system’s usability leaves a lot to be desired. Here’s why. There are usually three components in a streaming audio system: a player, a broadcaster, and a streaming server. The broadcaster sends MP3 files to the streaming server which handles compression for streaming and distribution of the stream to the players. Players and a streaming server are readily available on the Mac platform; however, the broadcaster component (which is open source) is limited in its functionality so we’ll propose another approach for the Mac platform.

We’re going to break down the process into its parts to simplify things for those just getting started. Today we’ll be addressing streaming audio players. Then, in Part II of our series, we’ll talk about a broadcaster and streaming audio server for your Mac mini. We’re also going to focus primarily on products which are Shoutcast-compatible since it is the free standard for streaming audio. For your own requirements, other solutions may work as well or better, and we’ll mention a couple. The bottom line is you can’t go wrong with a Shoutcast-compatible streaming audio solution, and you won’t have to worry about someone pulling the rug out from under your music project down the road (we hope).

Shoutcast is the invention of the good folks at Nullsoft that brought the world WinAmp. Nullsoft is now a subsidiary of AOL which now is part of the Time Warner empire. After joining AOL, the Nullsoft team created gnutella. AOL management shut down the gnutella project, and virtually all of the Nullsoft developers resigned. That history lesson is intended to explain the "we hope" reference in the previous paragraph. Thus far, Nullsoft’s Shoutcast streaming server remains free for the taking, and there are many open source broadcaster products which have evolved that all rely upon the Shoutcast server for streaming content distribution. Just keep in mind that both AOL and Time Warner are content aggregators, and you can rest assured that Big Brother will never let Little Brother interfere with their primary goal: making money. For another perspective on the incestuous relationship between Nullsoft and AOL, read this. Before you shed too many tears for the Nullsoft developers, keep in mind that they walked away from the table with a cool $100 million for a company whose major income producer is the WinAmp music player, the deluxe version of which sells for $14.95. And then there’s the WinAmp competition: Microsoft’s free (bundled) Windows Media Player and MusicMatch (almost free and bundled with virtually every new PC on the planet). And folks wonder why the Internet bubble burst. Do the math! So much for the politics, let’s get back to the technology.

Streaming Audio Defined. As the name implies, streaming audio means you can play a digital audio stream almost instantaneously on some type of player without waiting for an entire song to first download into the player. If you want to learn more about streaming technology, here’s a link that will tell you everything you ever wanted to know. So the first two prerequisites to make all of this work are some type of player that can handle streaming audio and a local network or Internet connection with acceptable bandwidth to the streaming audio source. In terms of quality and versatility for home use, there is no finer hardware-based player than Turtle Beach’s AudioTron. The AudioTron’s distinguishing characteristic from most other players is that it can play a collection of songs directly from a network hard disk without reliance upon any streaming audio server. It can also play Shoutcast streaming audio. And, as luck would have it, Turtle Beach has inexplicably killed the product just when streaming audio has finally hit its stride. The good news is that Turtle Beach and a throng of dedicated users still support the product with a broad range of add-on’s. And there are usually some units available on eBay if you want one.

Streaming Audio Players. There are many of other streaming audio players that can double as a server as well. Not the least of these is your trusty Mac running iTunes or a PC running WinAmp or Windows Media Player. One advantage of WinAmp is that it can also serve as a broadcaster in addition to being a great streaming audio player. In fact, if you are fortunate enough to have both a Mac and a Windows XP machine and you also have an XM Radio or a Sirius Radio with a line out jack, you can actually use WinAmp to broadcast your satellite radio content to your Shoutcast server by adding the free Shoutcast broadcasting plug-in to WinAmp. And, until last week, you could add the Output Stacker plug-in to capture Napster To Go streams to disk. Big Brother deleted out_disk.dll from the Shoutcast site but, with a bit of Googling on the file name, you can probably still find it if you are so inclined. See what we mean about the content aggregator mentality. This is basically the same technology and quality as a tape recorder from forty years ago, and now the content providers want to outlaw it. So much for fair use. Another worthy contender in the all-in-one category is the Blackbird Digital Music Player. Also in the home audio component player category are the Squeezebox which uses its own server software for your Mac and Netgear’s MP101.

Streaming Audio to Cellphones. One of the really cool uses of streaming audio is to play tunes on your cellphone from your home music collection. The Treo 650 running PocketTunes with an Internet connection such as Sprint’s PCS Vision is the perfect fit. For this to work, you obviously will have to open port 8000 on your home firewall and map the port to the IP address of your Mac. You’ll also have to enable port 8000 in your Mac’s firewall. We’ve covered all of this before if you need a refresher course. Just substitute 8000 for 80 in the discussion and follow the steps.

But, is it legal? Well, as a lawyer, I’m obliged to first tell you that this article is not a legal opinion, but a technology discussion. You’ll need to consult with your favorite lawyer to get a legal opinion. As a layman, I’d predict that your guess is about as good as mine. Building a shoutcast server certainly appears to be legal since there is a process in place to pay astronomical license fees. But. if you are shoutcasting only to listen to your own music collection yourself, it’s difficult to fathom how this differs from playing your purchased music directly on your CD player or iPod or Mac or PC. If you can legally carry your CD music collection from your home to your car to play it, then it seems reasonable to assume you could beam an album you’ve paid for from your home to your car or your cellphone. That is essentially what Apple does with its Airport Express. Of course, once you start sharing your music collection, all bets are off. A law professor would probably ask what happens when someone walks in your house and listens to your music. Are you now a music pirate? And what if they bring a tape recorder? Isn’t law school fun? Here’s an article and another one that cover a lot of the issues if you’re interested.

Having grown up in an era when kids were afraid to touch someone else’s mailbox out of fear of committing a felony, it’s more than a little disconcerting to look at today’s music landscape in the United States where the RIAA in collusion with the United States Congress has managed to turn almost half the country into felons for their music collections. My own view is that the Digital Millenium Copyright Act was enacted out of spite to prove Mark Twain was wrong when he said, "There’s no distinctively native American criminal class, except [perhaps for] Congress." And then there’s Microsoft’s illustrious CEO, Steve Ballmer, who put it so eloquently: "The most common format of music on an iPod is stolen." For a company that made its fortune on a product with more than a few "similarities" to the Mac (to which Microsoft had something akin to a source code license at the time), one might reasonably conclude that Mr. Ballmer certainly knows his subject matter. Finally, it’s worth recalling that no music was subject to federal copyright until 1971, long after the Beatles and Rolling Stones and Elton John had made their millions. Ask yourself this question: "Was there more music piracy in 1970 or today?" So we’re not quite sure all the legislating has really accomplished a lot … other than criminalizing the American public and lining the pockets of congressmen and recording industry moguls. Wink, Wink: They call them campaign contributions.

If Congress and the RIAA are serious about ending piracy, then a fresh, common sense approach seems long overdue. The new Napster To Go leasing model suggests that the RIAA is perfectly comfortable with a fee of $15 a month for an unlimited music collection. If we can all agree (1) that iPods and other music players only last for three or four years, (2) that you have to have a music player to play music, and (3) that less than one in a thousand listeners actually uses today’s Napster system, then it shouldn’t take a mathematics genius to figure out that some "Artists’ Fee" in the neighborhood of $100 could be added to the cost of every music player and, once such a player was purchased, the end user would be licensed to play any music the end user could get his or her hands on at no additional cost for as long as the music player would play. Why $100 and not $700 (the four-year cost of a Napster subscription)? If $700 is profitable for the RIAA and Napster with virtually no market share, then the basic laws of supply and demand suggest that increasing market share 1,000-fold should result in a cost reduction of at least 80% particularly where there are zero production and distribution costs in the pricing and sales model. And finally, limit payments from the Artists’ Fee fund to only those artists who distribute their music in unencrypted formats. Just my 2¢ worth.

That’s it for today. If you want to try out the product we’re going to be raving about in Part II, then download Rogue Amoeba’s Nicecast and have a blast until next week.