How to configure Asterisk for VoicePulse Connect
Who is VoicePulse?
Voicepulse no longer offers IAX2
Voicepulse is a broadband phone company that offers connectivity via SIP and IAX to the PSTN. The most appealing thing about VoicePulse is how easy it is to connect your Asterisk server to VoicePulse. It allows you to truly start playing with Asterisk without any special hardware in your computer. They offer phone numbers in several hundred cities in several dozen US states.
Purchasing an account
The first step is to set up an account with VoicePulse’s connect service. Go to their website and click the Free Trial Account link located on the toolbar. This service costs 2.40 cents a minute for outbound calls to the US48 and $11/month for an inbound phone number. The free trial will provide you with $2.00 of service, which is enough to do several hours of outbound calling. It will allow you to play around with the service and see if you like it. If you like the service, then charge up your account with the minimum amount of $50.
Logging back in to your VoicePulse account
This section is to save you from the stupid mistake that so many of us have made. There are TWO separate login pages for VoicePulse. The one on the main menu of http://www.voicepulse.com is NOT for the connect service.
Configuring outbound dialing
After signing up with the service you’ll receive an email with some instructions. The email will contain a couple of important pieces of information that you’ll want to place in your Asterisk configuration.
Example (data is fake, don’t try to actually use it!):
Host: gw5.voicepulse.com
Login: Abc1dEF2GH
Password: zYX9VUt8sr
Context: VPWS
First thing to do is edit the /etc/asterisk/extensions.conf and place the line from the email that below the [default] line:
exten => _1NXXNXXXXXX,1,Dial,IAX2/Abc1dEF2GH@voicepulse/${EXTEN}
This line instructs Asterisk to route outbound calls to VoicePulse. The next thing to do is to edit the /etc/asterisk/iax.conf and add the information about how to connect to VoicePulse. At the bottom of the file paste the information from the email. It should look something like this:
[voicepulse]
context = foo
secret=zYX9VUt8sr
auth=md5
type=friend
host=gw5.voicepulse.com
At this point you should be able to start Asterisk up, connect with your SIP or IAX phone, and place an outbound call to your favorite land line friend. DIAX is a good IAX based phone and X-Lite is a good SIP based phone.
To provide your own CallerID number on outbound calls, add the following prior to the Dial line. (Renumber the priority as appropriate)
exten => _1NXXNXXXXXX,1,SetCallerID(“Me” <2165551212>)
The name portion (“Me”) will not apply when contacting PSTN lines, but the phone number will be matched to the number database for the local telephone company. Remember that providing a 313-xxx-xxxx identification to a phone in the 216 area code will likely just result in “Michigan Call” instead of a person’s name. Providing a number that is local to the destination will result in a proper name lookup.
Configuring inbound dialing (optional)
If you’re interested in receiving inbound calls from VoicePulse on your Asterisk box, then complete the following section. The first thing you will need to do is purchase a phone number. Log in to the VoicePulse connect interface. Click on the phone numbers tab. Select the area code and prefix that you would like your phone number. Pick your area code so that your friends can call you locally. Or you could purchase a phone number in another city where your friends and family live, etc. Remember that there is a charge of like $7.95/month for this phone number. So you’ll have to have at least that much credit on your account.
Important: The inbound lines are billed the first of every month, and VoicePulse does not do prorated billing for inbound numbers. If you sign up for a number on the 30th of the month, you will get billed $7.95 and then another $7.95 a day or two later.
After you’ve purchased the phone number through the web interface, you will receive an email with the information on how to register your Asterisk to VoicePulse so that it receives the inbound calls. The email will contain a line that says something like:
register => Abc1dEF2GH:[email protected]
Remember to replace the example login and password with the one that you received in your introductory email. You will want to place this register statement under the general section of the /etc/asterisk/iax.conf. I typically place it just under the port statement. This will cause Asterisk to register with VoicePulse when it is started up.
Don’t go placing that inbound call just yet! You’ll need to define an extension for your inbound number. Let’s say the phone number that you’re assigned is 212-555-1212 just for the sake of this example. Then you will want to edit the /etc/asterisk/extensions.conf file and add a section like this:
[voicepulse]
exten => 2125551212,1,Goto(mycompany,s,1)
This line instructs Asterisk to route the call to the start of the mycompany context. You’ll want to edit mycompany to be whatever the context name is for your Asterisk install. At this point you should be able to place an inbound call, enter your extension number from the menu, and talk away.
Note that if you do not have a dedicated context set up to handle the inbound Voicepulse number, as shown above, but instead allow the inbound calls to go to a default context, such as:
[incoming]
exten => s,1,answer...
for some reason the “s” extension will not work with Voicepulse. To use a default handler like this you must use “_.”, such as:
[incoming]
exten => _.,1,answer...
Choosing the codec to use with VoicePulse
If you would like a higher quality call from VoicePulse than GSM provides, then choose the codec you want with the following lines in the /etc/asterisk/iax.conf:
disallow=all
allow=ulaw
allow=alaw
This example removed everything but G.711 ulaw and G.711 alaw. VoicePulse supports the following codecs:
- GSM
- G.711ulaw
- G.711alaw
- ADPCM
- ILBC
- SPEEX
For a list of the abbreviations used in the iax.conf file for the codecs click on Asterisk config iax.conf.
CallerID Name Lookup
Voicepulse does perform a database dip in order to present CallerID Name information. However, this is only done when you register with the connect01.voicepulse.com (and 02 and 03) SIP gateways. The SFO and NYC gateways do not do this.
Conclusion
If you follow this documents instructions on how to configure Asterisk and VoicePulse and think something was left out, then please signup for an account on this WIKI and edit the document. Your notes and tips are very important.
The example config did not work for me
I think partly because VoicePulse has changed their hardware configuration.
This is an example of the configuration I am using that is working as of 8/2/2004.
****************** iax.conf
[general]
;
; At this point I have tried so many different
; fixes that I am no longer sure if the
; static binding and "externip" entries
; are required to get VoicePulse to work.
; But these setting WORK for me
;
bindaddr=192.168.199.10
externip=asterisk-pbx.dyndns.org
language=en
bandwidth=medium
disallow=all
allow=ulaw
allow=alaw
allow=ilbc
allow=gsm
jitterbuffer=no
:
; register with voicepulse
;
; this format is critical
;
register=>in-username:[email protected]
;
; this context directs inbound
; VoicePulse calls to a handler
; in the inbound calls section of
; extensions.conf
;
[voicepulse]
context=voicepulse-in
username=username
secret=password
auth=md5
type=friend
disallow=all
allow=gsm
allow=ulaw
allow=alaw
allow=ilbc
host=gw5.voicepulse.com
nat=yes
qualify=yes
;
; this is the first of two servers
; at VoicePulse that ONLY handle
; out bound calls
;
[vpconnect-t01]
type=peer
context=VPWS
username=username
secret=password
host=gwiaxt01.voicepulse.com
auth=md5
qualify=yes
disallow=all
allow=gsm
allow=ulaw
allow=alaw
allow=ilbc
nat=yes
externip=asterisk-pbx.dyndns.org
;
; this is the second of two servers
; at VoicePulse that ONLY handle
; out bound calls
[vpconnect-t02]
type=peer
context=VPWS
username=username
secret=password
host=gwiaxt02.voicepulse.com
auth=md5
qualify=yes
disallow=all
allow=gsm
allow=ulaw
allow=alaw
allow=ilbc
nat=yes
externip=asterisk-pbx.dyndns.org
;
****************** extensions.conf
[globals]
;
; IMPORTANT - I have seen a number of suggested
; dial plans for VoicePulse that have either
; the username or the password in the dial
; command. This may work for some folks, but
; it DID NOT WORK for me. I found that to
; dial out from VoicePulse, I had to use
; both the in the "username:password" format.
;
; IMPORTANT - Notice that I setup a dial format
; for each of the two VoicePulse "peer"
; contexts that were entered in sip.conf
;
IAXTRUNK1=IAX2/username:password@vpconnect-t01
IAXTRUNK2=IAX2/username:password@vpconnect-t02
;
[voicepulse-in]
;
; Voicepulse rings in with the extension set the
; DID number they assigned you. You MUST have
; a handler that parses the DID number and
; then hands off to another context to get it
; get it * to handle the inbound call.
;
exten => _8005551212,1,SetMusicOnHold(default)
exten => _8005551212,2,Dial(${RINGGROUP03},10,tr)
exten => _8005551212,3,Wait(2)
exten => _8005551212,4,Answer
exten => _8005551212,5,Wait(1)
exten => _8005551212,6,Goto(mainmenu,s,1)
;
;
[outbound]
;
; Master context for outbound dialing
;
; In my dial plan I dial
; 9 to dial out using analog
; 8 to dial out using VoicePulse
; 7 to dial out using BroadVoice
;
; How you modify your dial plan is up to you
; but I can tell you this WORKS for me.
;
; handle outbound local calls - force VoicePulse
;
; In our area (Wash DC Metro), local calls require
; 10 digit dialing. Notice that I insert a
; "1" in front of the EXTEN on a 10 digit
; local dial call. VoicePulse NEEDS this.
; Suspect this is not important in areas
; where local calls are still 7 digits, but
; it WORKS for me.
;
; Notice that I try one of the VoicePulse peers
; then the other. VoicePulse seems to be
; getting popular in spite of their poor
; support. They have implemented redundant
; outbound servers to handle the load. If one
; is seriously lagged, this dial plan tries the
; other one.
;
; GOTTA have that @VPWS on the end of the dial
; string! Won't authenticate without it!!
;
exten => _8NXXNXXXXXX,1,ChanIsAvail(${IAXTRUNK1})
exten => _8NXXNXXXXXX,2,Dial(${IAXTRUNK1}/1${EXTEN:1}@VPWS)
exten => _8NXXNXXXXXX,3,Hangup
exten => _8NXXNXXXXXX,102,ChanIsAvail(${IAXTRUNK2})
exten => _8NXXNXXXXXX,103,Dial(${IAXTRUNK2}/1${EXTEN:1}@VPWS)
exten => _8NXXNXXXXXX,104,Hangup
exten => _8NXXNXXXXXX,203,Congestion
;
; handle outbound long distance calls - force VoicePulse
;
exten => _81NXXNXXXXXX,1,ChanIsAvail(${IAXTRUNK1})
exten => _81NXXNXXXXXX,2,Dial(${IAXTRUNK1}/${EXTEN:1}@VPWS)
exten => _81NXXNXXXXXX,3,Hangup
exten => _81NXXNXXXXXX,102,ChanIsAvail(${IAXTRUNK2})
exten => _81NXXNXXXXXX,103,Dial(${IAXTRUNK2}/${EXTEN:1}@VPWS)
exten => _81NXXNXXXXXX,104,Hangup
exten => _81NXXNXXXXXX,203,Congestion
;
; handle outbound internationl calls - force VoicePulse
;
exten => _8011.,1,ChanIsAvail(${IAXTRUNK1})
exten => _8011.,2,Dial(${IAXTRUNK1}/${EXTEN:1}@VPWS)
exten => _8011.,3,Hangup
exten => _8011.,102,ChanIsAvail(${IAXTRUNK2})
exten => _8011.,103,Dial(${IAXTRUNK2}/${EXTEN:1}@VPWS)
exten => _8011.,104,Hangup
exten => _8011.,203,Congestion
;
;
Voicepulse Connect Flexrate for Local and Longdistance
Modified version of Voicepulse Flexrate to accommodate 7 and 10 digit dialing.
[globals]
VOICEPULSE_API_KEY=your voicepulse api key
VOICEPULSE_API_PREFIX=VOICEPULSE_
VOICEPULSE_GATEWAY_OUT_A=voicepulse02 ; your iax/sip.conf entries
VOICEPULSE_GATEWAY_OUT_B=voicepulse01
[outbound context]
; Local 7 Digit Numbers
exten => _NXXXXXX,1,Set(CALLERID(all)="Callerid Name" <calleridnumber>)
exten => _NXXXXXX,2,Set(OTHER_PROVIDERS_FLAT_RATE=0.02);
exten => _NXXXXXX,3,Macro(voicepulseflexrate,${VOICEPULSE_API_KEY},1NXX${EXTEN}) ;put your areacode before ${EXTEN}
exten => _NXXXXXX,4,Verbose(The rate is ${VOICEPULSE_FLEXRATE})
exten => _NXXXXXX,5,GotoIf($[${VOICEPULSE_FLEXRATE} > ${OTHER_PROVIDERS_FLAT_RATE}]?outbound|${EXTEN}|700
exten => _NXXXXXX,6,Dial(IAX2/${VOICEPULSE_GATEWAY_OUT_A}/1NXX${EXTEN});desired area code prefix
exten => _NXXXXXX,7,GotoIf($[${DIALSTATUS}=CHANUNAVAIL]?${EXTEN}|500)
exten => _NXXXXXX,500,Dial(IAX2/${VOICEPULSE_GATEWAY_OUT_B}/1NXX${EXTEN})
exten => _NXXXXXX,700,Dial(IAX2/username@voip-providerA/1NXX${EXTEN}) ; if they're cheaper
exten => _NXXXXXX,701,Dial(IAX2/${VOICEPULSE_GATEWAY_OUT_A}/1NXX${EXTEN}); failover voicepulse 1
exten => _NXXXXXX,702,Dial(IAX2/${VOICEPULSE_GATEWAY_OUT_B}/1NXX${EXTEN}); failover voicepulse 2
exten => _NXXXXXX,703,Dial(IAX2/username@voip-providerD/1NXX${EXTEN}) ; another failover
; US Numbers
exten => _1NXXNXXXXXX,1,Set(CALLERID(all)="Your Name" <your number>)
exten => _1NXXNXXXXXX,2,Set(OTHER_PROVIDERS_FLAT_RATE=0.011)
exten => _1NXXNXXXXXX,3,Macro(voicepulseflexrate,${VOICEPULSE_API_KEY},${EXTEN})
exten => _1NXXNXXXXXX,4,Verbose(The rate is ${VOICEPULSE_FLEXRATE})
exten => _1NXXNXXXXXX,5,GotoIf($[${VOICEPULSE_FLEXRATE} > ${OTHER_PROVIDERS_FLAT_RATE}]?outbound|${EXTEN}|800
exten => _1NXXNXXXXXX,6,Dial(IAX2/${VOICEPULSE_GATEWAY_OUT_A}/${EXTEN})
exten => _1NXXNXXXXXX,7,GotoIf($[${DIALSTATUS}=CHANUNAVAIL]?${EXTEN}|600)
exten => _1NXXNXXXXXX,600,Dial(IAX2/${VOICEPULSE_GATEWAY_OUT_B}/${EXTEN})
exten => _1NXXNXXXXXX,800,Dial(IAX2/username@voip-providerA/${EXTEN})
exten => _1NXXNXXXXXX,801,Dial(IAX2/${VOICEPULSE_GATEWAY_OUT_A}/${EXTEN})
exten => _1NXXNXXXXXX,802,Dial(IAX2/${VOICEPULSE_GATEWAY_OUT_B}/${EXTEN})
exten => _1NXXNXXXXXX,803,Dial(IAX2/username@voip-providerD/${EXTEN})