Asterisk Primer

cool high-tech things you can do with super old-school technology

Cory Forsyth

co-founder, Popularity Dialer and pheeder

Pheeder Logo

Overview

What is Asterisk?

What is VoIP?

A VoIP Call's Path

What Can You Do With Asterisk?

Getting Set Up

  1. Installing Asterisk
    • You Need a Server
    • Most Hosting Providers Don't Support Asterisk
    • One Hosted Solution: Lylix.net
  2. Finding a VoIP Provider
  3. Building Your App

Getting Set Up: Installing

Getting Set Up: Installing

Getting Set Up: VoIP Providers

  1. Installing Asterisk
  2. Finding a VoIP Provider
    • Your Link to/from Real-World Phones
    • Get Your DID (Phone #) From Them
    • Dial Out Through Them
    • sip.conf and iax.conf
  3. Building Your App

Getting Set Up: VoIP Providers 2

Getting Set Up: Building

  1. Installing Asterisk
  2. Finding a VoIP Provider
  3. Building Your App
    • Dialplans, Contexts and Extensions
    • AGI
    • Manager API

Building Your App: Dialplans

  1. Dialplan is a Text File With BASIC-like Rules That Controls Call Flow
  2. Master Dialplan is Located at /etc/asterisk/extensions.conf
  3. After Changing the Dialplan, Must Reload Asterisk
  4. 		[context-name]
    		exten => s,1,Playback(beep)
    		exten => s,2,Playback(beep)
    		exten => s,3,Echo
    		exten => s,4,Hangup
    
    		exten => 1,1,Playback(beep)
    		exten => 1,2,Playback(goodbye)
    		exten => 1,2,Hangup
    		

Building Your App: Dialplans 2

  1. More Dialplan Options
  2. Dial, Record, GoTo and GoToIf, Variables
  3. [context-name]
    exten => _XXXXXXXXXX,1,Wait(2)
    exten => _XXXXXXXXXX,n,DIAL(SIP/teliax/${EXTEN},30,tr)
    
    exten => 3,1,Playback(beep)
    exten => 3,2,Record(filename.format, 2, 30)
    
  4. Remember to Reload!

Building Your App: AGIs

  1. AGIs Communicate Via Stdin and Stdout
  2. Almost Like Web Pages
  3. Several Readymade AGI Libraries
  4. PHPAGI (recommended)
  5. RAGI

Demo Twitter App

Preparing Sounds for Asterisk

  1. Easy, Low-Fi Solution: Record Directly With Asterisk
  2. WAV or GSM Format
  3. Case Matters!
  4. Use sox to convert WAVs to GSM
  5. Sounds Get Quieter
  6. Phones Are Low-Fi

Asterisk Debugging Tips

  1. Build Slowly and Deliberately: One Thing at a Time
  2. "asterisk -r" command line
    • "set verbose 15"
    • "agi debug" (and "agi no debug")
    • "sip debug" (and "sip no debug")
  3. File Permissions
  4. Weird Syntax

Reference: Resources

  1. voip-info.org: Great Wiki
  2. Nerdvittles.com: Good How-Tos
  3. Voxilla.com: Good Forums

Reference: Glossary

  1. PSTN/POTS -- "Normal" Telephone Network
  2. DID -- Direct Inward Dial Number
  3. DTMF -- Dual-Tone Multi-Frequency
  4. SIP -- Session Initiation Protocol
  5. IAX -- Inter-Asterisk Exchange
  6. GSM -- Global Systems for Mobile
  7. CO -- Central Office
  8. Softphone

Reference: Locations of Files

  1. Conf Files: /etc/asterisk/
    • extensions.conf: Master Dialplan
    • sip.conf: SIP Configurations: Use Values From Your VoIP Provider
    • iax.conf: IAX Configurations: Use Values From Your VoIP Provider
    • manager.conf: Enable Manager API, Set Username/Password
  2. AGI Files: /var/lib/asterisk/agi-bin/
  3. Sound Files: /var/lib/asterisk/sounds/
    • WAV and GSM Formats. Reference These Without Extension in the Dialplan

The Perils of Cold-Calling

Payphone Warriors

Payphone Warriors Logo

Thank You