Setting Up Outbound Settings
Registering lets the remote server know where we are. Thus, it will start sending telephone calls to us. By default, Asterisk will use the settings specified in the [general] section of sip.conf.
Example: using a DeFuniac Telephone we can create a section that will route incoming telephone calls from them to their own special context in your dial plan and allow the Dial() command to omit the username and password.
[defuniactelephone]
type=peer
secret=mondal
username=aurobindo
host=voip.worldtelephone.com
fromuser=mgaribaldi
fromdomain=voip.defuniactelephone.com
context=incoming_world
After you add this, issue a reload command. What this specifically does is create an account on the system for the connection.This account will match any phone calls coming into the server voip.worldtelephone.com with the username aurobindo and the password mondal, and route those phone calls into the context incoming_world in your dial plan.
Step 17: Setting Up an SIP Server
[sipclient]
type=friend
context=internal
username=sipclient
secret=password
mailbox=201
host=dynamic
callerid="SIP Client" <3115552368>
dtmf=inband
It will set up an account for a channel called “sipclient” that is identified via the username “sipclient” and the ultra-secure password “password”.We
specify it is a dynamic host, which means the client can connect from anywhere so it will be registering with us.The client will sit in the internal context where the appropriate dial strings should be. Also, we assign the voice-mail box 201 to the client so they can be notified about waiting messages.We also specify that outbound calls from the client will have the caller ID string SIP CLIENT <3115552368>.
After a reload, the system is now ready to accept an SIP client connection. Point an SIP phone to the server with the correct username and password and you will be ready to dial away.
Step 18: Configuring Voice Mail
Voice-mail settings are listed within voicemail.conf in the Asterisk configuration directory. There are a lot of bits to configure in voice mail, such as time zone settings, voice mail to e-mail settings, and options on how to pronounce time, among others. Unless you want to get fancy, most of the defaults should work fine.A common option that may need to be adjusted is the maxmsg option which limits the number of messages a user can have in their mailbox. Another option that may need to be adjusted is the tz option that controls what time zone the messages will be based in.This is commonly used if the server’s time zone is different than the time zone the company is based in. The tz option, by default, can only be set to options specified in the [zonemessages] section, which by default is set to the following:
[zonemessages]
eastern=America/New_York|'vm-received' Q 'digits/at' IMp
central=America/Chicago|'vm-received' Q 'digits/at' IMp
central24=America/Chicago|'vm-received' q 'digits/at' H N 'hours'
military=Zulu|'vm-received' q 'digits/at' H N 'hours' 'phonetic/z_p'
european=Europe/Copenhagen|'vm-received' a d b 'digits/at' HM
The syntax for this is
ZONENAME=TIMEZONE|DATESTRING
where ZONENAME is the name you want to give the setting, TIMEZONE is the Linux time-zone name you want the system to use for the setting, and DATESTRING is a string of Unix date variables and sound files. Not the most elegant solution, but it is very customizable. Let’s say we wanted to add a Pacific time zone, we would just add the following line:
pacific=America/Los_Angeles|'vm-received' Q 'digits/at' IMp
which would make a pacific zone based on the America/Los_Angeles time zone and would play the standard voice-mail envelope string.
Step 19: Configuring Mailboxes
Mailboxes are in the [default] section. A typical run-of-the-mill mailbox for Auro would look like this:
867 => 5309,Aurobindo Mondal,auro@company.com
This sets up mailbox 867 for Aurobindo Mondal, with a password of 5309. Any messages left in the mailbox would be attached to an e-mail sent to auro@socal.com, allowing him to listen to the message without calling the server.This setup is suitable for most users; however, there are other options as well. Asterisk has the ability to send a second message without the attachment that is more suitable for text messages or mobile phone e-mail as well:
867 => 5309,Aurobindo Mondal,aurobindo@company.com,3115552368@worldtelephone.com
This is handy since it allows the user to receive a notification on their mobile device about a voicemail message without having to download a possibly large audio file over a slow mobile data link. If we want to attach the voice-mail messages to the e-mail messages, but still wants to receive a notification.This is done with the attach option:
867 => 5309,Aurobindo Mondal,auro@company.com,,|attach=no
If he is in a separate time zone from the company and wants to have his mailbox say the time in the Central time zone. We would then adjust the mailbox like this:
867 => 5309,Aurobindo Mondal,steve@example.net,,|attach=no|tz=central
Step 20: Leaving and Retrieving Message
All of the voice-mail functions are contained in two applications: Voicemail(), which handles the portions of a user leaving a message on the system; and VoicemailMain(), which handles the users of the PBX to access their voice mail.We briefly touched upon VoiceMail()
[default]
exten => s,1,Answer()
exten => s,2,Background(thank-you-for-calling-conglomocorp)
exten => s,3,Background(conglomocorp-mainmenu)
exten => 100,1,Voicemail(u100)
exten => 200,1,Voicemail(b200)
exten => 300,1,VoicemailMain()
exten => 400,1,VoicemailMain(${CALLERID(num)})
Extension 100 sends you to voice mail to leave a message for mailbox 100. The u preceding the mailbox number tells Asterisk to use that mailbox’s “unavailable” greeting. Extension 200 does the same thing, except this time the b preceding the mailbox number tells Asterisk to use that mailbox’s “busy” greeting. Besides the greetings, both of these do the same thing: they take a message for the mailbox they are given. Extension 300 sends you to the voicemail system as if you are a user of the system. In this case, the system will prompt you for a mailbox number and password and if you give it valid credentials, it will let you listen to messages for that mailbox. Extension 400 does the same thing, except it attempts to find a mailbox corresponding to the caller’s caller ID number. If it does, it will prompt just for the password. If it does not, it will behave as if there was no number given to it.
The default keys are “1” to play messages, “6” to skip to the next message, “4” to go to the previous message, and “7” to delete the current message.
Step 20: Configure Music On Hold
The musiconhold.conf comes with a music on hold class ready for files, so often all you need to do is put some ulaw encoded files of your favorite songs in the moh/ subdirectory of your Asterisk sounds directory, usually /var/lib/
musiconhold.conf generally looks like
[default]
mode=files
directory=/var/lib/asterisk/moh
If you want to add another class for the support department.
Just add:
[support]
mode=files
directory=/var/lib/asterisk/moh/support
Then create the directory and add ulaw encoded files to /var/lib/asterisk/moh/support.
Once this is done, you will need to edit the support context and assign a new music
on hold class to it.You can do this via the SetMusicOnHold() command. Using the supportmenu
we would set the class like this:
[supportmenu]
exten => s,1,SetMusicOnHold(support)
exten => s,2,Background(conglomocorp-supportmenu)
exten => 1,1,Dial(SIP/blivetsupportline)
exten => 2,1,Dial(SIP/widgetsupportline)
exten => 3,1,Dial(SIP/frobsupportline)
exten => #,1,Goto(s,2)
This now assigns the caller to the support class until another command assigns it
to somewhere else. To configure your musiconhold.conf to support MP3s,
you will need to change the mode= to custom and specify the exact syntax of the MP3 player command:
[RiverBottomGang]
mode=custom
directory=/var/lib/asterisk/moh/RiverbottomNightmareBandMP3s
application=/usr/bin/mpg123 -q -r 8000 -f 8192 -b 2048 --mono -s
This example would create a new class called RiverBottomGang, which would then
use MPG123 to play all the songs in
/var/lib/asterisk/moh/RiverbottomNightmareBandMP3s.
This is somewhat less reliable than using ulaw encoded files because of the conversions involved.
N.B.: Sometimes, if your files are not encoded in a way that is just right, your music on hold will sound like it is playing a twice the speed.
[supportmenu]
exten => s,1,SetMusicOnHold(support)
exten => s,2,Background(conglomocorp-supportmenu)
exten => 1,1,Dial(SIP/blivetsupportline)
exten => 2,1,Dial(SIP/widgetsupportline)
exten => 3,1,Dial(SIP/frobsupportline)
exten => #,1,Goto(s,2)
Step 21: Configure Call Queues
In a call queue, all callers form a virtual line wait to be answered by a person answering a phone. When an “answerer” hangs up, the system takes the next person out of the queue and rings the answerer’s phone.
Call queues are managed by queues.conf.A typical call queue configuration would
look like this:
[supportqueue]
musicclass=support
strategy=ringall
timeout=10
wrapuptime=30
periodic-announce = conglomocorp-your-call-is-important
periodic-announce-frequency=60
member=>SIP/10
member=>SIP/20
Starting off each queue section is the queue’s name written in brackets. The next line defines the queue’s music on hold class—which, here, is the support class we defined in the last section. The strategy line defines the ringing strategy—in this case, ringall: ring all the phones until someone picks up. The system can be configured to use a roundrobin system that will ring the phones one by one starting from the first, or do a roundrobin with memory called rrmemory in which the system will start with the next phone after the phone it rang last. The timeout line specifies how long, in seconds, a phone should ring until the system determines that no one is there. The wrapuptime line specifies how long, also in seconds, after a call is completed that the system should wait before trying to ring that phone again. The periodic-announce and the periodic-announce-frequency specify a sound file the system should play for callers instead of the music on hold music and how long it should wait after playing a file until playing it again. Finally, each member line adds a member to the pool of phones that have people answering the queue.
[supportmenu]
exten => s,1,SetMusicOnHold(support)
exten => s,2,Playback(conglomocorp-welcome-to-support-queue)
exten => s,3,Queue(supportqueue)
Step 22: Setting Agents
agents.conf In this file, you can control the sounds the agents hear when they log on and off, whether or not you want to record the conversations they have with callers, and what music on hold class the agents should be assigned. The part in which you would control agents is at the bottom of the file at the end of the [agents] section. Each agent will be configured by an agent line. The agent line syntax is:
agent => AgentNumber,Password,AgentName
If we add some agents for our queue:
agent => 1001,867,Joe Random Agent
agent => 1002,5309,James Random Agent
Now edit the support queue:
[supportqueue]
musicclass=support
strategy=ringall
timeout=10
wrapuptime=30
periodic-announce = conglomocorp-your-call-is-important
periodic-announce-frequency=60
member=>SIP/10
member=>SIP/20
member=>Agent/1001
member=>Agent/1002
Step 22: Setting Up a Conference
The first step in setting up a conference is opening up meetme.conf and adding a conference room. Conference rooms are numbered, but these are only used when connecting to conferences from extensions.conf. Users should never have to interact with them.
In meetme.conf, the conference rooms are listed under the [rooms] section.The
syntax for rooms are
conf => RoomNumber,UserPIN,AdminPIN
In a conference room, both the User PIN and Admin PIN are optional. Let’s set
up a simple, un-PINed conference room.
conf => 1234
Now, let’s edit our extensions.conf. We are putting this in a separate context for the
same reason we put the agent login in a separate context: we don’t want regular users to stumble into the conference by accident.
[conference]
exten => s,1,MeetMe(1234)
Now, just set up a way to access this context and issue a reload command to the Asterisk CLI. You should be all set. When entering the context, you should hear two beeps and silence. Then, when someone else calls in, you should both hear the same two beeps and subsequently be connected to each other. This process repeats for each person who connects. Put yourself on the back.
No comments:
Post a Comment