User Tools

Site Tools


user:dgirard3:portfolio:project1

Project: Asterisk Audio

A project for Data Communications by Derek Girardi during the fall 2012.

This project was begun on September 15th and is anticipated to take 2 days or more.

Objectives

The purpose of this project is to use asterisk phone line in a closed network, a LAN. Well thats the bigger picture, what i am attempting to do is make a config file or edit a config file so that we can play audio on the phone line. Now we are able to use the default tones but those are boring, so i am going to take music from youtube or off of my playlist and convert them so we can play them to people who call a certain number.

Prerequisites

In order to successfully accomplish/perform this project, the listed resources/experiences need to be consulted/achieved:

  • Must be able to use asterisk pretty well
  • Programming knowledge
  • Command line knowledge
  • google

Background

The reason i am doing is because i want to be able to call a number and be able to listen my favorite song. This is class is messing around with a free phone software using VOIP. We all had different tasks and we took up messing with asterisk without any knowledge of it. Once we were able to make our own numbers in the system i then decided if we were able to actually go and put our own music in. And well in this project i will show the process i had to go through to do this.

Scope

I will be using this in linux and ssh'ing into asterisk itself to show what i am doing.

Procedure

Step 1: First we need to pick out what audio you want! so choose some random mp3 you want to put onto asterisk.

Step 2: Now this is where we get to the good stuff. The format the file will be in is mp3 and if you want audio to play through a phone, it needs to be converted into .gsm format. Its lower in resolution and is able to go through much easier then the normal mp3 file (see figure 1). So you see the 2 commands mp3123 and sox. mp3123 will, as seen, easily convert your mp3 into a wav format. Now that it is a easily more manageable format, you can use the sox command to fully convert it over to gsm so it can be run through the phone. Open the man page (man sox) and check to see what the commands are and see what you want to do with your file.

Step 3: Now we have the file on your home directory, we are going to want to put it onto the asterisk server. Now in order to do this you need to remotely send it over to the server using the command scp. scp is a secure file transfer that can send files over to servers and such. See figure 2 for how this command is executed.

Step 4: Now unless you have the system in front of you, so this is an optional step, you will have to ssh right into the server which is an easy task. All you need to do is execute the command of ssh into root@10.80.2.171. And then you should be right into your system!

Step 5: Now that you are onto asterisk you need to search for the config file that holds the content of audio. You will need to get out of the home directory so cd .., then you will ls -la. You will see multiple config files and executable files, you will want the config file “extensions.conf”. This is where we set a phone number to an audio. So a person can call and listen to audio!

Step 6: Now go into the .conf file and open it with a text editor of your choice, i prefer vm, and you need to configure a number to it and make sure the audio is there. So just as the others you see, set the number to it, have it call the audio and wait for hang up. Its really simple, just number, audio, then END.

Step 7: Now it needs to find that audio and it wont look in the home directory. So you need to move that file from the home directory right into the audio files for all the files and once it is in there, it should be all set to go! You have or should have, successfully put music/audio onto asterisk.

Code

Figure 1:

mpg123 -w Whatislove.wav Haddaway\ -\ What\ is\ Love\ -with\ lyrics-.mp3 
sox Whatislove.wav -r 8000 -c 1 Whatislove.gsm -q

Figure 2:

scp Trolo.gsm root@10.80.2.171:

As seen here, you have the file you want to transfer then where you want to be sent. In this case root@10.80.2.171 is our asterisk. It could be different for you.

Reflection

It was a lot of fun putting on my own audio and listening to my favorite songs :p

References

In performing this project, the following resources were referenced:

user/dgirard3/portfolio/project1.txt · Last modified: 2012/12/12 19:41 by dgirard3