Setting up paging with a sound card

VoIP Hardware Solutions
Provider Solution Details
VoIP Hardware Zycoo UC Solutions
  • Modular Design IP PBX for SMB
  • Remote office Centralized Management solution
  • 3rd party app integration, Enterprise Billing, Android & iOS client
Details
Yeastar Communications Solutions
  • Cost-effective IP-PBX Solution for SMB
  • FXS, FXO, GSM, BRI and PRI VoIP Gateways
  • Rich features and reliable performance
Details

The definitive guide to soundcard installation, configuration, and usage with Asterisk@Home 2.X


Note: In my experience, TrixBox 2.0 users beginning with a default installation from the ISO may skip ahead to Step 5. WAudette

Step 1: Edit the channels makefile to allow the compiling of chan_oss.so
Open/Edit /usr/src/asterisk/channels/makefile
On or about line 16 find:
CHANNEL_LIBS=chan_sip.so chan_agent.so chan_mgcp.so chan_iax2.so chan_local.so chan_skinny.so chan_features.so
Following chan_features.so add {space} chan_oss.so
Save and exit the file.

Step 2: Recompile Asterisk to build chan_oss.so
From the linux command line (via Putty or direct) change to the Asterisk source code directory:
cd /usr/src/asterisk
Execute the rebuild by typing the following:
make clean {enter}
make {enter}
make install {enter}

Step 3: After the recompile completes verify that a chan_oss.so file exists in the correct directory: /usr/lib/asterisk/modules

Step 4: Edit the Asterisk/AMP startup script to allow Asterisk access to the soundcard device.
Open/Edit /usr/sbin/amportal
On or about line 34 find:
chown -R asterisk:asterisk /dev/zap
chown asterisk /dev/tty9
Insert the following line between these two lines:
chown -R asterisk:asterisk /dev/dsp
After which the lines should exactly match this:
chown -R asterisk:asterisk /dev/zap
chown -R asterisk:asterisk /dev/dsp
chown asterisk /dev/tty9
Save and exit the file.

Step 5: Create the Asterisk configuration file for chan_oss.so: oss.conf
Copy and paste exactly the text below:

; 
; Open Sound System Console Driver Configuration File 
; 
[general] 
; 
; Automatically answer incoming calls on the console? Choose yes if 
; for example you want to use this as an intercom. 
; 
autoanswer=yes 
; 
; Default context (is overridden with @context syntax) 
; 
context=from-internal 
; 
; Set overridecontext to yes if you want the context specified above 
; to override what someone places on the command line. 
; 
overridecontext=yes 
; 
; Default extension to call 
; 
extension=s 
; 
; Default language 
; 
language=en 
; 
; Silence supression can be enabled when sound is over a certain threshold. 
; The value for the threshold should probably be between 500 and 2000 or so, 
; but your mileage may vary. Use the echo test to evaluate the best setting. 
;silencesuppression = yes 
;silencethreshold = 1000 
; 
; On half-duplex cards, the driver attempts to switch back and forth between 
; read and write modes. Unfortunately, this fails sometimes on older hardware. 
; To prevent the driver from switching (ie. only play files on your speakers), 
; then set the playbackonly option to yes. Default is no. Note this option has 
; no effect on full-duplex cards. 
playbackonly=yes 
; 

Save this file to the Asterisk configuration directory via WinSCP or a Samba file share as: oss.conf in /etc/asterisk
After saving the file change its permissions to allow Asterisk to access it. From the linux command line (via Putty or direct) type the following:
cd /etc/asterisk {enter}
chmod 0777 oss.conf {enter}
chown asterisk:asterisk oss.conf {enter}

Step 6: Enable Asterisk to automatically load chan_oss.so upon startup.
From a web browser enter the following URL to directly access the "Config Edit"? web editing utility:
http://xxx.xxx.xxx.xxx/maint/phpconfig/phpconfig.php (Substituting your Asterisk server's IP Address for xxx.xxx.xxx.xxx.)
Login as maint as you would normally.
Find the file modules.conf and click to open it.

On or about line 30 find:

; Load either OSS or ALSA, not both 
; By default, load OSS only (automatically) and do not load ALSA 
; 
noload => chan_alsa.so 
noload => chan_oss.so 
;

Change the line containing the reference to chan_oss.so from noload to load.
load => chan_oss.so
Verifiy that the line containing the reference to chan_alsa.so is set to noload as shown below:
; Load either OSS or ALSA, not both
; By default, load OSS only (automatically) and do not load ALSA
;
noload => chan_alsa.so
load => chan_oss.so
;
Click the "Update"? button but DO NOT click on the "Re-Read Configs"? link yet.

Step 7: Add a custom dial plan script to access the soundcard as a paging port .
While still in the "Config Edit"? web interface find and click to open: extensions_custom.conf
On or about line 16 find:
exten => *60,1,Answer
exten => *60,2,Playback(at-tone-time-exactly)
exten => *60,3,SayUnixTime(,,IMp)
exten => *60,4,Playback(beep)
exten => *60,5,Hangup

Insert the following lines directly ABOVE this block:
exten => *51,1,Dial(console/dsp,20,A(beep))
exten => *51,2,Hangup()
Allow one blank line between each bock.
In place of the "beep", you can put any gsm/ulaw audio file that you want to precede the announcement.

Click on the "Update"? button and then click on the "Re-Read Configs"? link.

Step 8: Hookup and Test the paging function.
If not already connected, connect the soundcard's primary speaker output (if it has more than one) to the inputs of the paging amplifier or for testing use common computer speakers or headphones.
IMPORTANT NOTE: The soundcard may not produce sound output unless some sort of resistance (load) is put on the output jack. For this reason always attach speaker or an amplifier to the sound card and reboot before testing.
Reboot the Asterisk server.
After the reboot test the paging by dialing the "Paging Code"? *51 from any handy telephone. If after adjusting volume levels on the speakers/headphones/amplifier you still have no sound at all skip to Step 10. Otherwise continue on to Step 9.

Step 9: Finish the installation.
If not already connected to the final device do so now and adjust volume levels to suit.
YOU ARE DONE! Congratulations!!!

Step 10: Correcting Centos' volume level issues.
Centos 4.x appears to set the soundcard's outputs to muted and also a zero volume level requiring a mixing/tuning utility to correct these issues.
From the linux command line (via Putty or direct) excute the following command:
yum list | grep alsa {enter}
NOTE: This REQUIRES access to the internet.
Do to the fluid nature of linux the list returned may not match exactly the list below:
alsa-lib.i386
alsa-lib-devel.i386
alsa-utils.i386
Execute the following command:
yum -y install {item 1} {item 2} {item 3} {item x} {enter}
For example:
yum -y install alsa-lib.i386 alsa-lib-devel.i386 alsa-utils.i386 {enter}
After the download and installation completes reboot the Asterisk server.

Step 11: Un-mute and tune the soundcard.
It is suggested that a pair of headphone be used for this step for best results.
After the reboot enter the following command from the linux command line (via Putty or direct) - For this step a keyboard and color monitor connected directly to the Asterisk server is highly recommended:
alsamixer {enter}

This SHOULD launch the alsamixer utility application. Alsamixer is a text based soundcard mixer/tuner. It is functionally identical and visually similar to the MS Windows sound card mixer/tuner. Each "channel"? and/or "feature"? is listed with it own control. Because of the large number of soundcard makes and models the exact number, labeling, and order of these channels will vary. However, there are only TWO channels that need to be adjusted and they are a constant: The MASTER channel and the PCM channel.

NOTE: It is recommended that prior to adjusting the levels that the paging code be dialed and an active paging session be underway. This will allow for "on-the-fly"? realtime volume level setting to be done.
Each channel consists of a "Label Box"? at the base of each "Slider Bar"? and a "Mute Status"? indicator at the top. The channel that is actively being edited will have its name in the label box be red as opposed to white.
For switching or scrolling through channels use the left and right arrow keys.
To adjust the level of a channel use the up and down arrows.
To mute or un-mute a channel us the mute toggle key the "M"? key.
To exit and save you level adjustments press the "ESC"? key.
The levels of both the MASTER channel and the PCM channel must be adjusted for satisfactory volume levels and both channels MUST be UN-MUTED for correct functioning.
Starting with the far left or first channel, this should be the MASTER channel. Use the "M"? key to un-mute the channel if it is muted (It most likely is muted.). Adjust the level to 55.
Using the left and right arrow keys scroll through the channels until you find the PCM channel. Un-mute the channel if necessary and adjust its level to 55 as well.

If headphones are being used test this level as being of "average"? loudness and not too loud and/or distorted. If the level is too high adjust each channel down slightly until a "comfortable"? level is reached. If the sound level is too quiet then adjust up the level in the same fashion.
After the levels have been adjusted to a satisfactory level press the "ESC"? key to save the level settings and exit.
Return to Step 9.

Resources


The definitive guide to soundcard installation, configuration, and usage with Asterisk@Home 2.X


Note: In my experience, TrixBox 2.0 users beginning with a default installation from the ISO may skip ahead to Step 5. WAudette

Step 1: Edit the channels makefile to allow the compiling of chan_oss.so
Open/Edit /usr/src/asterisk/channels/makefile
On or about line 16 find:
CHANNEL_LIBS=chan_sip.so chan_agent.so chan_mgcp.so chan_iax2.so chan_local.so chan_skinny.so chan_features.so
Following chan_features.so add {space} chan_oss.so
Save and exit the file.

Step 2: Recompile Asterisk to build chan_oss.so
From the linux command line (via Putty or direct) change to the Asterisk source code directory:
cd /usr/src/asterisk
Execute the rebuild by typing the following:
make clean {enter}
make {enter}
make install {enter}

Step 3: After the recompile completes verify that a chan_oss.so file exists in the correct directory: /usr/lib/asterisk/modules

Step 4: Edit the Asterisk/AMP startup script to allow Asterisk access to the soundcard device.
Open/Edit /usr/sbin/amportal
On or about line 34 find:
chown -R asterisk:asterisk /dev/zap
chown asterisk /dev/tty9
Insert the following line between these two lines:
chown -R asterisk:asterisk /dev/dsp
After which the lines should exactly match this:
chown -R asterisk:asterisk /dev/zap
chown -R asterisk:asterisk /dev/dsp
chown asterisk /dev/tty9
Save and exit the file.

Step 5: Create the Asterisk configuration file for chan_oss.so: oss.conf
Copy and paste exactly the text below:

; 
; Open Sound System Console Driver Configuration File 
; 
[general] 
; 
; Automatically answer incoming calls on the console? Choose yes if 
; for example you want to use this as an intercom. 
; 
autoanswer=yes 
; 
; Default context (is overridden with @context syntax) 
; 
context=from-internal 
; 
; Set overridecontext to yes if you want the context specified above 
; to override what someone places on the command line. 
; 
overridecontext=yes 
; 
; Default extension to call 
; 
extension=s 
; 
; Default language 
; 
language=en 
; 
; Silence supression can be enabled when sound is over a certain threshold. 
; The value for the threshold should probably be between 500 and 2000 or so, 
; but your mileage may vary. Use the echo test to evaluate the best setting. 
;silencesuppression = yes 
;silencethreshold = 1000 
; 
; On half-duplex cards, the driver attempts to switch back and forth between 
; read and write modes. Unfortunately, this fails sometimes on older hardware. 
; To prevent the driver from switching (ie. only play files on your speakers), 
; then set the playbackonly option to yes. Default is no. Note this option has 
; no effect on full-duplex cards. 
playbackonly=yes 
; 

Save this file to the Asterisk configuration directory via WinSCP or a Samba file share as: oss.conf in /etc/asterisk
After saving the file change its permissions to allow Asterisk to access it. From the linux command line (via Putty or direct) type the following:
cd /etc/asterisk {enter}
chmod 0777 oss.conf {enter}
chown asterisk:asterisk oss.conf {enter}

Step 6: Enable Asterisk to automatically load chan_oss.so upon startup.
From a web browser enter the following URL to directly access the "Config Edit"? web editing utility:
http://xxx.xxx.xxx.xxx/maint/phpconfig/phpconfig.php (Substituting your Asterisk server's IP Address for xxx.xxx.xxx.xxx.)
Login as maint as you would normally.
Find the file modules.conf and click to open it.

On or about line 30 find:

; Load either OSS or ALSA, not both 
; By default, load OSS only (automatically) and do not load ALSA 
; 
noload => chan_alsa.so 
noload => chan_oss.so 
;

Change the line containing the reference to chan_oss.so from noload to load.
load => chan_oss.so
Verifiy that the line containing the reference to chan_alsa.so is set to noload as shown below:
; Load either OSS or ALSA, not both
; By default, load OSS only (automatically) and do not load ALSA
;
noload => chan_alsa.so
load => chan_oss.so
;
Click the "Update"? button but DO NOT click on the "Re-Read Configs"? link yet.

Step 7: Add a custom dial plan script to access the soundcard as a paging port .
While still in the "Config Edit"? web interface find and click to open: extensions_custom.conf
On or about line 16 find:
exten => *60,1,Answer
exten => *60,2,Playback(at-tone-time-exactly)
exten => *60,3,SayUnixTime(,,IMp)
exten => *60,4,Playback(beep)
exten => *60,5,Hangup

Insert the following lines directly ABOVE this block:
exten => *51,1,Dial(console/dsp,20,A(beep))
exten => *51,2,Hangup()
Allow one blank line between each bock.
In place of the "beep", you can put any gsm/ulaw audio file that you want to precede the announcement.

Click on the "Update"? button and then click on the "Re-Read Configs"? link.

Step 8: Hookup and Test the paging function.
If not already connected, connect the soundcard's primary speaker output (if it has more than one) to the inputs of the paging amplifier or for testing use common computer speakers or headphones.
IMPORTANT NOTE: The soundcard may not produce sound output unless some sort of resistance (load) is put on the output jack. For this reason always attach speaker or an amplifier to the sound card and reboot before testing.
Reboot the Asterisk server.
After the reboot test the paging by dialing the "Paging Code"? *51 from any handy telephone. If after adjusting volume levels on the speakers/headphones/amplifier you still have no sound at all skip to Step 10. Otherwise continue on to Step 9.

Step 9: Finish the installation.
If not already connected to the final device do so now and adjust volume levels to suit.
YOU ARE DONE! Congratulations!!!

Step 10: Correcting Centos' volume level issues.
Centos 4.x appears to set the soundcard's outputs to muted and also a zero volume level requiring a mixing/tuning utility to correct these issues.
From the linux command line (via Putty or direct) excute the following command:
yum list | grep alsa {enter}
NOTE: This REQUIRES access to the internet.
Do to the fluid nature of linux the list returned may not match exactly the list below:
alsa-lib.i386
alsa-lib-devel.i386
alsa-utils.i386
Execute the following command:
yum -y install {item 1} {item 2} {item 3} {item x} {enter}
For example:
yum -y install alsa-lib.i386 alsa-lib-devel.i386 alsa-utils.i386 {enter}
After the download and installation completes reboot the Asterisk server.

Step 11: Un-mute and tune the soundcard.
It is suggested that a pair of headphone be used for this step for best results.
After the reboot enter the following command from the linux command line (via Putty or direct) - For this step a keyboard and color monitor connected directly to the Asterisk server is highly recommended:
alsamixer {enter}

This SHOULD launch the alsamixer utility application. Alsamixer is a text based soundcard mixer/tuner. It is functionally identical and visually similar to the MS Windows sound card mixer/tuner. Each "channel"? and/or "feature"? is listed with it own control. Because of the large number of soundcard makes and models the exact number, labeling, and order of these channels will vary. However, there are only TWO channels that need to be adjusted and they are a constant: The MASTER channel and the PCM channel.

NOTE: It is recommended that prior to adjusting the levels that the paging code be dialed and an active paging session be underway. This will allow for "on-the-fly"? realtime volume level setting to be done.
Each channel consists of a "Label Box"? at the base of each "Slider Bar"? and a "Mute Status"? indicator at the top. The channel that is actively being edited will have its name in the label box be red as opposed to white.
For switching or scrolling through channels use the left and right arrow keys.
To adjust the level of a channel use the up and down arrows.
To mute or un-mute a channel us the mute toggle key the "M"? key.
To exit and save you level adjustments press the "ESC"? key.
The levels of both the MASTER channel and the PCM channel must be adjusted for satisfactory volume levels and both channels MUST be UN-MUTED for correct functioning.
Starting with the far left or first channel, this should be the MASTER channel. Use the "M"? key to un-mute the channel if it is muted (It most likely is muted.). Adjust the level to 55.
Using the left and right arrow keys scroll through the channels until you find the PCM channel. Un-mute the channel if necessary and adjust its level to 55 as well.

If headphones are being used test this level as being of "average"? loudness and not too loud and/or distorted. If the level is too high adjust each channel down slightly until a "comfortable"? level is reached. If the sound level is too quiet then adjust up the level in the same fashion.
After the levels have been adjusted to a satisfactory level press the "ESC"? key to save the level settings and exit.
Return to Step 9.

Resources


Created by: agillis, Last modification: Fri 05 of Nov, 2010 (08:25 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+