Asterisk Guide for INOC-DBA v.20050105.txt John Todd (jtodd@pch.net) updated by Gaurab Raj Upadhaya (gaurab@pch.net) Many users of the INOC-DBA system have been impressed with how useful the VoIP system is with it's very basic functionality for voice communications between individuals. There are, however, some features lacking by design. The system does not (at this time) provide voicemail, or an IVR, or outbound PSTN connectivity. There are many other features that are possible with a more full-featured iPBX, but INOC-DBA does not have all of these features as part of it's mission charter - INOC-DBA simply serves as a directory server and call completion gateway between users at different ASN holding organizations. Knowing the particular desires and button-and-blinky-lights fascination that much of the crowd here has, there have been some who have wanted more local control over their voice traffic as well as more features that they have come to expect with any other traditional voice telephony platform. I have written this guide to provide a very skeletal example of how to configure such a system and integrate it with the INOC-DBA SIP service using the Asterisk PBX open-source package. It is possible to get full use out of the INOC-DBA system simply by using any SIP phone pointed at the inoc-dba.pch.net server as a SIP proxy. I do not wish to confuse people into thinking that any further equipment other than (as an example) a Cisco 7960 phone would be required to use the service. However, it may be the case that more sophisticated users wish to control more features and have some basic ease-of-use NAT features that a program like Asterisk can provide, and so these instructions are written for a quick guide to that end. Configuration files include a recipe for the following configuration: - two handsets, assuming Cisco 7960 or ATA-186 - two users, 32767*234 and 32767*987 - voicemail for each extension and for the general ASN - stutter dialtone or message waiting light when voicemail exists - registration for both users and main ASN on INOC-DBA server - dual ring for main ASN (32767) on both phones - dials INOC-DBA numbers by looking for and stripping "8" as first digit - dialing outbound US-based numbers to long-distance SIP ITSP - email delivery of voicemail messages to each extension holder What this guide will NOT cover: - basic UNIX commands and compiling syntax - advanced troubleshooting your Asterisk installation - how to get an INOC-DBA account - how to configure your 7960 (in detail) - what is VoIP? - how to sign up with iconnecthere.com Further reading: Asterisk main site: http://www.asterisk.org/ Asterisk mailing lists: http://lists.digium.com/mailman/listinfo/ SIP-implementors: http://lists.cs.columbia.edu/mailman/listinfo/sip-implementors INOC-DBA: http://www.pch.net/inoc-dba/ Convert your 7960 to a SIP phone: http://www.cisco.com/en/US/tech/tk652/tk701/technologies_tech_note09186a00 80094584.shtml Example configuration files for a 7960: http://www.loligo.com/asterisk/Cisco/79xx Step 1: Get and compile Asterisk. mkdir /usr/src/asterisk cd /usr/src/ export CVSROOT=:pserver:anoncvs@cvs.digium.com:/usr/cvsroot cvs login [password is "anoncvs"] cvs checkout asterisk cd asterisk make make install make samples You may want to ensure you're getting the correct processor specified in /usr/src/asterisk/Makefile. You may need to edit the Makefile by hand to specify the correct architecture by un-commenting the PROC line that matches your system, and commenting out all the other lines starting with PROC that override that setting. If when launching Asterisk for the first time you get "Illegal Instruction" errors, that's due to the wrong processor being selected by the Makefile. Step 2: Launch to confirm operation. Try typing "asterisk -vvvvgc" and you should see Asterisk launch. A whole slew of debug messages should scroll across your screen. Ignore them. After the startup messages, you should see "*CLI>" confirming activation. Type "shutdown now" to halt the process. Step 3: Set up basic configuration files. Pretty much all the configuration files won't be used for this example except for three: sip.conf, voicemail.conf, and extensions.conf. The configuration files are stored by default in /etc/asterisk - cd to that directory and delete all three files. Backups can be found in /usr/src/asterisk/configs if you'd like to examine more options in each file. See example files included below. Change the ASN and extensions as you see fit. Step 4: Set up your 7960. It's assumed you have a 7960 running SIP. The image that PCH loads into your 7960 (if you had previously been using the PCH server) should be sufficient. I won't go into much detail here, other than to say that you need to point the proxy1_address to be your Asterisk server, and then set the line1* settings to match that of one of the extensions in your sip.conf file. I would suggest setting nat_enable to "1", nat_address to "" (null), and nat_received_processing to "1" if you are behind a NAT or PAT. For a full example, see the 7960 config example I list above in the References section. Use tcpdump or (better yet) tethereal from the command line to watch traffic on port 5060 to ensure correct registration and SIP call flow. Step 5: Change voicemail greetings. Call "111" from one of your phones, and then enter your password, as defined in voicemail.conf. Listen to the menu, and then under mailbox options change your busy greeting, your unavailable greeting, and record your name. Step 6: If you want to dial an INOC-DBA number, you'll need to dial with the prefix "8" in front of the call. All other calls are normal dialing patterns, and will be passed to iconnecthere.com for long distance termination. Step 7: There is no step seven. You're done. -------------------------- ; sip.conf ; ; This is the sip.conf file - all SIP configurations ; and registrations are kept here. ; [general] port = 5060 bindaddr = 0.0.0.0 context = from-sip allow=all ; ; NOTE: Passwords are not required for INOC-DBA yet, but will ; be shortly. As mandatory authentication will be enforced in near future, ; please use the correct passwords are required. The examples below ; assume that you have used the online interface to create your username ; and password. ; ; We register all three extensions; the two "individual" extensions ; and then the "main" ASN and send each to their respective extensions ; within extensions.conf in the [from-sip] context. In other words, ; when someone dials 32767*234, the Asterisk system will send that ; call to simply the "234" extension in [from-sip]. It's actually ; changing the Contact: line in the SIP header. ; ; We encourage registering each user and extension instead of simply ; registering the main number and doing some sort of internal ; directory service. The point of INOC-DBA is to allow individuals ; more transparency instead of calling a faceless IVR or call queue. ; register => 3856:nosuchpasswordfoo@inoc-dba.pch.net/32767 register => 3856*999:yourpassword:testuser@inoc-dba.pch.net/999 register => 3856*478:mypassword:gaurab@inoc-dba.pch.net/478 ; ; ; Here is our ITSP, a company called iconnecthere.com ; They take any long-distance calls for the continental US and will ; gateway them through to a PRI connection somewhere. They'll also ; do international calling, no technical changes required. See their ; website for more details. They require DTMF inband for some reason. ; For $9.95 a month for 1000 minutes, it's a pretty good deal as far ; as I'm concerned. ; [iconnect] type=friend secret=9983 username=38461225 host=213.137.73.177 dtmfmode=inband canreinvite=no ; ; ; ; This is for outbound and inbound INOC-DBA calls. We can ; set our caller ID within Asterisk to the individual extensions ; numbers, so we just use the "main" ASN registration here for ; authentication outbound. You can use any valid name/password ; pair here. ; [inoc-dba] type=friend host=inoc-dba.pch.net port=5060 username=testuser fromuser=3856*999 secret=yourpassword canreinvite=yes context=from-inoc-dba insecure=very ; ; you can also use md5 authentication, in which case you will replace ; the 'secret=yourpassword' with the following ; auth=md5 ; secret=yourmd5secret ; ; ; Now we define our SIP phones. These can be ATA-186, Cisco 7960, ; Xten, or any other SIP client. Note that the Cisco devices ; are the only ones I personally have confirmed work behind a NAT. ; "canreinvite=no" is specified to force RTP sessions to pass ; through the Asterisk server; required for NAT. ; [234] type=friend username=234 secret=mysipclientpassword mailbox=234,32767 host=dynamic context=from-client dtmfmode=rfc2833 nat=1 canreinvite=no ; ; ; [987] type=friend username=987 secret=anothersipclientpassword mailbox=987,32767 host=dynamic context=from-client dtmfmode=rfc2833 nat=1 canreinvite=no ----------------------------- ; extensions.conf ; ; General housekeeping settings. [general] static=yes writeprotect=yes ; ; ; We'll use these in a few places, so abstract it into ; a variable. ; [globals] MYASN=32767 MYPHONENUMBER=2125551212 ; ; [from-inoc-dba] ; ; If call is to 32767, then ring both users for ; 20 seconds, and then dump to voicemail. ; exten => 32767,1,Dial(SIP/234&SIP/987,20,r) exten => 32767,2,Voicemail2(u32767) ; ; Send callers to each extension to the appropriate ; lines in the local-extension context. ; exten => 234,1,Goto(local-extensions,${EXTEN},1) exten => 987,1,Goto(local-extensions,${EXTEN},1) ; ; All other callers get congestion tones exten => _X.,1,Answer exten => _X.,2,Congestion ; ; ; This is where all our SIP clients will send their ; calls. Figure out what to do with the calls and ; include housekeeping "h"angup and "i"nvalid extensions. ; [from-client] include => dial-inoc-dba include => iconnect include => local-extensions exten => h,1,Hangup exten => i,1,Congestion ; ; ; ; Send calls starting with the digit "8" out to the inoc-dba ; service. Set the caller ID to be ASN*EXTENSION. Figure ; out what extension the caller is coming in from, and set ; the caller ID Name appropriately. If not 234 or 987, then ; set to "Unknown". Strip the first digit off and Dial for ; 90 seconds and play ringing tones. ; [dial-inoc-dba] exten => _8.,1,SetCallerID(${MYASN}*${CALLERIDNUM}) exten => _8.,2,GotoIf($[${CALLERIDNUM} = 234]?3:5) exten => _8.,3,SetCIDName(Jane Smith) exten => _8.,4,Goto(9) exten => _8.,5,GotoIf($[${CALLERIDNUM} = 987]?6:8) exten => _8.,6,SetCIDName(John Doe) exten => _8.,7,Goto(9) exten => _8.,8,SetCIDName(Unknown Caller) exten => _8.,9,Dial(SIP/${EXTEN:1}@inoc-dba,90,r) exten => _8.,10,Congestion exten => _8.,110,Busy ; ; ; ; The [iconnect] lines specify how and when calls are ; sent out to the iconnecthere.com gateways for PSTN ; termination. Set limits of 100 minutes on calls to ; prevent "stuck" calls from ever happening. Set the ; ANI to be a "real" phone number so called parties can ; see a valid return string. If you have opted for the ; service where iconnect.com gives you a phone number, ; this would be that number. (You would need additional ; lines in sip.conf to handle this case, as well - not ; covered in this example. See my other examples for that.) ; [iconnect] exten => _1.,1,SetCallerID(${MYPHONENUMBER}) exten => _1.,2,AbsoluteTimeout(6000) exten => _1.,3,Dial(SIP/${EXTEN}@iconnect,90,r) exten => _1.,4,Congestion exten => _1.,104,Busy ; ; ; [local-extensions] ; ; If 234 is dialed, then ring SIP user 234 for 25 seconds, ; while playing ring tone. If no answer, go to "unavailable" ; message. If busy, go to "busy" message. ; exten => 234,1,Dial(SIP/234,25,r) exten => 234,2,Voicemail2(u234) exten => 234,102,Voicemail2(b234) ; ; 987 is similar to 234 exten => 987,1,Dial(SIP/987,25,r) exten => 987,2,Voicemail2(u987) exten => 987,102,Voicemail2(b987) ; ; Dial ext. 111 to get to the voicemail system ; exten => 111,1,VoiceMailMain2(${CALLERIDNUM}) -------------------------- ;voicemail.conf ; ; This is where we set the values for the voicemail system and email ; forwarding of voicemail files. ; format=wav serveremail=asterisk attach=yes maxsilence=10 silencethrehold=128 maxlogins=3 ; ; ; Initial passwords for each extension is 5555 - can be changed from ; voicemail system. ; [default] 987 => 5555,John Doe,jdoe@somecompany.com 234 => 5555,Jane Smith,jsmith@somecompany.com 32767 => 5555,Main Mailbox,noc@somecompany.com