Asterisk 1.2

It looks like Asterisk 1.2 is out. From the release announcement:

This release of Asterisk contains over 3,000 improvements on version 1.0, including hundreds of new features and applications.

I’m planning on upgrading my home Asterisk server soon, possibly today, and then I’ll look at migrating pieces of my dial plan to RAGI and/or AEL.

Posted by Scott Laird Thu, 17 Nov 2005 14:08:49 GMT


Asterisk extension language

While I really like all of the things that Asterisk allows me to do with my phone system, I’m really not very fond of its configuration language. The language provided in Asterisk 1.0 is slightly better then sendmail.cf, but it’s still a lousy language. They made a few small improvements early in the Asterisk 1.2 development process that helped a bit, but I assumed that we’d have to wait for another year or two before someone broke down and wrote a decent language for Asterisk.

It looks like I may have been overly pessimestic. I discovered the Asterisk extension language on a list of new features for Asterisk 1.2 today. Somehow I’d missed this when it first went into Asterisk.

Here’s a chunk out of my old config file. It’s not perfect, but it’s what you get when you’re stuck dealing with line numbers:

[macro-diallocal]
  exten => s,1,AbsoluteTimeout(7200)
  exten => s,n,SetAMAFlags(default)
  exten => s,n(analog),Dial(${TRUNK}/${ARG1})
  exten => s,n,Congestion
  exten => s,analog+101,Macro(condsetcid)
  exten => s,n,SetCIDName(LAIRD SCOTT)
  exten => s,n,SetAMAFlags(billing)
  exten => s,n(nufone),Dial(${NUFONE}/1${ARG1})
  exten => s,n,Congestion
  exten => s,nufone+101,Busy

And here’s the equivalent using the new configuration language:

macro diallocal( number ) {
  AbsoluteTimeout(7200);
  SetAMAFlags(default);
  Dial(${TRUNK}/${number});
  if(${DIALSTATUS} = "CONGESTION" || ${DIALSTATUS} = "CHANUNAVAILABLE") {
    &condsetcid();
    SetCIDName("LAIRD SCOTT");
    SetAMAFlags(billing);
    Dial(${NUFONE}/1${number});
    switch(${DIALSTATUS}) {
      case BUSY:
        Busy;
      default:
        Congestion;
    }
  }
}

It’s still not ideal–${VAR} is ugly–but it’s vastly better then the old syntax. This plus a bit of Rails integration should give us a really nice phone environment. I’m rapidly approaching the “tear it down and rebuild it” point with my Asterisk system–there’s a lot of stuff that I’d like to add that just doesn’t fit in with my current configuration files–so I’ll have a set of articles on integrating Asterisk, AEL, and Rails in a few weeks.

Posted by Scott Laird Mon, 10 Oct 2005 19:28:54 GMT


Pingtel Xpressa

One side effect of running my own business is that I’ve been spending a lot of time on the phone. Unfortunately, the $10 analog phone that I was using was hard to use for more then 15 minutes at a time, and it wasn’t always very easy to hear what the other party was saying. That’s not a great mix for a business phone.

So, I’ve been looking around to find a cheap way to get a good phone with a headset on my desk. None of the analog headsets phones that I’ve looked at have been very appealing, so I’ve been looking at cheap VoIP phones with 2.5mm phone jacks. Amazingly enough, VoIPSupply.com decided to clear out a bunch of old phones via eBay at just the right time, so I was able to pick up a Pingtel Xpressa for a song.

The Xpressa was a first-generation VoIP phone, and it was orphaned by Pingtel over a year ago. However, in many ways it’s still the highest-end SIP phone on the market. It comes with a Palm-like 160x160 grayscale display, supports (pre-standard) Power-over-Ethernet, and runs Java applets natively on the phone. The SDK is still available from Pingtel, but you have to hunt for it a bit. I paid about the same for the Xpressa as I did for my Sipura/Linksys SPA-841, but the Pingtel is clearly better in nearly every area–it’s easier to use, it’s more solid, it’s more attractive, it has more features, and sounds better. It’s lacking a few NAT features and I can’t find a way to use different ringtones for different lines, but other then that it does everything that I need. It comes with a standard 2.5mm headphone jack, so I picked up a cheap Plantronics headset; I’ve spent nearly two hours on the phone so far today, and everything has been perfect.

Er, well, mostly everything. I actually ordered the mango colored model from VoIPSupply, but somehow ended up with a charcoal-colored phone instead. Hopefully they’ll be able to fix that soon. Also, since Pingtel discontinued the phone (and actually sold it off to an unnamed vendor, alleged to be 3com), they’ve pulled all of the add-on software packages off of their website; that means that I haven’t been able to find their LDAP-based phonebook. I’ve been fishing around and I’m sure that I can find a copy somewhere. For now, I’ve been using Jon’s Phone Tool to dial from Quicksilver. JPT is swimming in features, 95% of which are useless to me, but it seems to do a decent job dialing my phone for me, so I’ll probably pay the $12 fee for it if I can’t get the Pingtel Phonebook to work.

Update: As expected, VoIPSupply is fixing the mango-colored problem. I should have a mango phone on the way shortly.

Posted by Scott Laird Sat, 08 Oct 2005 00:54:18 GMT


Bad tech day

So pretty much nothing worked yesterday.

It started with an 8:00 phone call over VoIP that only had one-way audio. Then my 11:00 phone call gave a potential client an “all circuits busy” instead of ringing through to my VoIP phone. I’ve been using Asterisk for almost 18 months, and this is the first time that I’ve ever seen either of these, so I spent a while trying to reproduce the problems and sending support email off to two different VoIP providers.

After that, I finally started in on The Evil Thing–I bought a copy of XP and I was planning on installing it on a spare PC so I could test Typo with IE 6. How hard could it be, right?

I gave up on it at 8:00 PM.

Here’s a short list of things that went wrong:

  • I couldn’t find an old Windows CD to use to make the upgrade test on my XP CD happy. I should have CDs for ‘98 and 2000 sitting here somewhere, but I couldn’t find either. I had to borrow one to make XP’s installer happy. It would have been easier to download a cracked copy then to use the legitimate version and fight with its copy and licensing protection.

  • Once I got past the upgrade test, the installer refused to format my hard drive. No matter which options I picked (full disk or small partition, NTFS or FAT, quick format or full format), it would always die out within 5 seconds with a “Setup was unable to format the partition” error. The error suggests that I check the power on my external SCSI drive. Since I’m installing onto a completely standard 80 GB internal IDE drive, the error isn’t very helpful. Digging around a bit, bad IDE cables and bad CD drives seem to be the most common causes for this error. Since this is an old box that I put together from spare parts, the system is using old 40-pin IDE cables; I need to swing by a store and pick up a couple 80-pin IDE cables. Maybe that will help.

  • For the fun of it, I tried booting my borrowed XP disk (the one that I was using to pass the upgrade test), and *it* partitioned the drive without any problems. Unfortunately, it refused to take my license key. The nice hologrammed one that came directly from Microsoft. Apparently my key is just good for XP Pro Upgrade CDs that come with SP2 pre-installed or something. Rebooting with my CD put me right back into formatting limbo.

I swear, I should have just downloaded and installed a cracked version–I would have been done early yesterday afternoon.

Posted by Scott Laird Tue, 13 Sep 2005 17:31:16 GMT


Rails and Asterisk

Oooh. Just when it looks like I’m going to have to stoop to programming in Perl to do a bit of Asterisk integration, someone comes out with a way to use Rails with Asterisk’s AGI scripting interface.

This has the potential to be really interesting, because Asterisk+Rails should be about a decade more advanced then anything that the IVR people are used to seeing.

I have a couple small Asterisk scripting jobs that I’ve promised to various family memebers; if my schedule allows, I’ll give RAGI a spin and share how it goes later this week.

Posted by Scott Laird Mon, 12 Sep 2005 14:11:20 GMT


Asterisk 1.2 is approaching

I’ve fallen a bit behind on Asterisk with all of the time that I’ve spent working on Typo lately, but I found this announcement sitting in my inbox today:

As previously mentioned on the lists by Olle Johannson, we are actively trying to get Asterisk in shape for a 1.2 release within the next 60 days.

I will produce the first release candidate on August 20th, with followup versions produced every week until we deem the release ready for public consumption. I expect it will require at least three -RC releases for us to get things in shape, so that means that 1.2 itself may be ready by September 15th.

Asterisk has desperately needed a new stable release for months now, and it looks like version 1.2 will be out within the next two months.

Posted by Scott Laird Tue, 26 Jul 2005 18:41:11 GMT


Nokia N91 lust

Darn it, I think I’ve fallen in love with another unreleased phone.

This week, it’s the Nokia N91. It was announced a couple months ago, and isn’t supposed to ship until late in 2005. It’s going to be marketed as a “music phone,” but I think the specs more or less speak for themselves:

  • 4 GB hard drive
  • 802.11g
  • Bluetooth
  • 2 MP still camera, 352x288 video capture
  • Series 60 3.0 software
  • Video player (MPEG4, Real, H.263)
  • GSM/EDGE/WCDMA (3G) support
  • FM radio receiver
  • mini-USB jack (can act like USB mass storage device)
  • phone keypad and music controls, but no keyboard
  • battery life: 12 hours music playback, 3-4 hours talk time, 7-ish days standby time

You can get more details from Nokia’s own flashcrapular site.

Nokia N91

It’s not a small phone by any stretch. It’s very slightly smaller then a Treo 650–4mm narrower, 1mm thinner, 16g lighter.

The thing that I find so fascinating about the N91 is that it can replace practically every device that I’ve been cramming into my pockets:

  • phone
  • iPod–the N91’s not as nice as the iPod photo, but for light use, it’ll probably be good enough.
  • pocket camera–much better then my T616 (which is worthless as a camera). 1600x1200 is big enough for web photos and the occasional whiteboard photo at work. If the shots are anything like the N90 sample shots then I’ll be happy.
  • organizer (it’ll sync with the Mac once Apple tweaks their list of supported Series 60 devices). It’s not quite as capable as the Clie that I’m still dragging around, but it’ll probably be good enough.
  • USB flash drive (you’ll need a mini-USB to USB zip cable, but they’re small)
  • video player (er, well, if you don’t mind watching on a 2” screen)
  • photo album – if the iPod photo can do it, why can’t the N91? Their screens are basically the same resolution.

The other thing that fascinates me about the N91 is its SIP support. The specs list support for JSR-180, which is SIP for J2ME apps. There are rumors online that the demo N-series phones have native SIP support in the phone UI. That’d let me use the N91 as a cordless phone when I’m at home or at work, which is just one more thing to like about it.

Of course, there have to be downsides–the camera doesn’t look as good as the one that comes with the N90 (but the N90 doesn’t have 802.11 or the hard drive). It doesn’t have the N90’s video-conferencing camera, either (that’d be cool with SIP). It’s kind of big. It doesn’t have a keyboard (although external bluetooth ones will work). It won’t ship until the very end of 2005. The specs don’t list 850 MHz support, although they’re clearly marketing this to the US, so presumably there will be a US model with 850/1900 MHz support. Finally, the price: at least $700 US before subsidies, possibly closer to $900. So, frankly, it’s probably too expensive for me to buy, but I’m going to be really tempted. Since Palm is rumored to be saving the next Treo for Spring of 2006, the N91 may not even have any competition for “Cool Phone of the Year” in my mind.

Posted by Scott Laird Fri, 08 Jul 2005 23:50:28 GMT


SIP/GSM MNVO/VoIP double-play?

I want to see a combination VoIP/MVNO double-play. That’s one company that sells cellular service (using someone else’s network), sells VoIP service, and integrates the two services.

There are two specific scenarios that seem obvious:

  1. They sell the customer mobile phone service and VoIP service via an ATA or SIP hardphone. This would be great for people who have turned off their home phone service while continuing to pay for some form of Internet access. One number would ring both devices, the first one to pick up wins. Outgoing calls would have the same caller ID from either device. Alternate products would be family plans with multiple phones, each with their own number, then a shared number that will ring all devices; and centrex plans for small businesses, where the company provides both VoIP desk phones and mobile phones.

  2. They sell the customer mobile phone service and act like a SIP client. This way the customer can integrate their mobile phones directly into their existing phone system. Ideally, the MVNO’s SIP gateway will register and unregister with the SIP PBX as the phone gains and loses service; this will let the PBX do the Right Thing with voicemail, and also enable a number of other services.

Personally, I’d love to buy services like this. I’d prefer GSM phones, simply because the most interesting phones are almost always GSM-only. Accoring to Cellular News, there are at least three GSM MVNOs in the US right now, using both Cingular and T-Mobile’s networks, so this is certainly possible.

On the hardware front, several companies seem to be providing GSM/SIP gateway equipment:

It’s possible that Earthlink will be rolling something like this out soon–they’re building a MVNO, and they share at least one board member with Bridgeport Networks. They seem to be concentrating more on EV-DO then anything GSM-related, though.

There seems to be a huge push in the cellular industry to integrate SIP into their networks, so something like this will be possible sooner or later. My current contract with Cingular is up in 6 months; it’d be nice if someone has something on the market that I can buy by then.

Posted by Scott Laird Fri, 08 Jul 2005 18:35:26 GMT


Updated Asterisk config files

I’ve had several people ask me for a more recent version of my Asterisk configuration files, and it’s been about a year since I last posted them, so here they are.

extensions.conf

Here’s extensions.conf. I’ve lightly redacted a few phone numbers and deleted a few really obvious bits of cruft, but this is essentially what my Asterisk server is running. There’s at least a year’s worth of cruft lurking in here, but it’s a real, live example:

[general]
  static=yes
  writeprotect=no

[globals]
  TRUNK=Zap/1                         ; FXO interface
  ANALOG=Zap/2                        ; FXS interface

  KITSIP=Sip/203
  BEDSIP=Sip/204
  BASESIP=Sip/210

  NUFONE=IAX2/username@NuFone
  EBC=IAX2/username@EBC
  PHONES=${ANALOG}&${KITSIP}&${BEDSIP}

; Fax receiving macro.  Handles rxfax and directing the fax to the 
; correct email address.
[macro-faxreceive]
  exten => s,1,SetVar(FAXFILE=/var/spool/asterisk-fax/${UNIQUEID}.tif)
  exten => s,2,DBGet(EMAILADDR=extensionemail/${MACRO_EXTEN})
  exten => s,3,rxfax(${FAXFILE})
  exten => s,103,SetVar(EMAILADDR=scott@sigkill.org)
  exten => s,104,Goto(3)

; This fixes up incoming CallerID.  NuFone doesn't transmit CID name
; info on incoming toll-free calls.  So, we cache the name when we see
; it and use the cached copy when we can.
; 
; This is kind of close to LookupCIDName, except we also *store* the
; CID Name when we know it.
[macro-cidfix]
  exten => s,1,GotoIf($["${CALLERIDNUM:0:2}" = "+1"]?600)
  exten => s,n(dbget),DBGet(cidfixname=cidname/${CALLERIDNUM})
  exten => s,n,SetCIDName(${cidfixname})
  exten => s,dbget+101,GotoIf($[${CALLERIDNAME} = "Toll-Free Call"]?500:104)
  exten => s,n,GotoIf($["X${CALLERIDNAME}" = "X"]?500:104)
  exten => s,n,DBput(cidname/${CALLERIDNUM}=${CALLERIDNAME})
  exten => s,500,SetCallerID("No Caller ID <Unknown>")
  exten => s,600,SetCIDNum($[${CALLERIDNUM:2:100}])
  exten => s,n,Goto(dbget)

; Conditionally set the CallerID.  If we already have a valid CallerID
; (basically, it's more then 4 digits long), then we leave it in place.
; Otherwise, replace it with our home phone number
[macro-condsetcid]
  exten => s,1,NoOp
  exten => s,2,GotoIf($[${CALLERIDNUM:0:4} = ${CALLERIDNUM}]?3:4)
  exten => s,3,SetCallerID(4254889014)
  exten => s,4,NoOp

; Do call forwarding out of a database.  Look up the caller ID number, 
; and if it exists in the forward DB, then forward the call to the 
; specified number.
[macro-dbcallforward]
  exten => s,1,DBGet(FORWARDTO=forward/${CALLERIDNUM})
  exten => s,2,Macro(condsetcid)
  exten => s,3,Wait(1)
  exten => s,4,Dial(Local/${FORWARDTO}@inside/n)
  exten => s,102,Noop

; Outside line macro.  This handles incoming phone calls from outside
; of the house, including caller-ID rewriting, blacklisting, and
; distinctive ring.
[macro-outsideline]
  exten => s,1,AbsoluteTimeout(7200)
  exten => s,2,SetCDRUserField(Outside (${CHANNEL}))
  exten => s,3,Macro(cidfix)
  exten => s,4,Macro(dbcallforward)
  exten => s,5,Macro(setalertinfo)
  exten => s,6,LookupBlacklist
  exten => s,7,Dial(${PHONES},30,Ttr)
  exten => s,8,Answer
  exten => s,9,Goto(outside-ivr,s,1)
  exten => s,107,Goto(208)
  exten => s,108,Goto(8)
  exten => s,207,Wait(3600)
  exten => s,208,Hangup

; Extension dialing logic.  Call an internal extension and bounce to VM
; if no answer.
[macro-callextension]
  exten => s,1,Dial(${ARG1},30,t)
  exten => s,2,Voicemail(${ARG2})
  exten => s,3,Hangup
  exten => s,102,Voicemail(${ARG2})
  exten => s,103,Hangup

; The next block of macros handle outgoing calls.  This is more complex
; then you'd expect for a couple reasons.  First, I'm using two different
; outgoing mechanisms--NuFone and my POTS line, but I'd like either one
; to be able to work as a fallback if the other fails.
;
; Next, I want to be able to handle 7- and 10-digit dialing without
; having to remember which area codes and prefixes require a '1' first.
; I'm in the Seattle area, and part of 425 is free, along with 95% of
; 206.  With POTS, I must dial a '1' iff it is a toll call.  With
; NuFone I must always dial a 1.
;
; See http://scottstuff.net/scott/archives/000163.html
[macro-diallocal]
  exten => s,1,AbsoluteTimeout(7200)
  exten => s,n,SetAMAFlags(default)
  exten => s,n(analog),Dial(${TRUNK}/${ARG1})
  exten => s,n,Congestion
  exten => s,analog+101,Macro(condsetcid)
  exten => s,n,SetCIDName(LAIRD SCOTT)
  exten => s,n,SetAMAFlags(billing)
  exten => s,n(nufone),Dial(${NUFONE}/1${ARG1})
  exten => s,n,Congestion
  exten => s,nufone+101,Busy

; This handles 10-digit local numbers
[macro-dialanalogwithfallback]
  exten => s,1,Macro(diallocal,${MACRO_EXTEN})

; This handles 7-digit local numbers
[macro-dialanalogwithfallback425]
  exten => s,1,Macro(diallocal,425${MACRO_EXTEN})

; This handles 10-digit non-local numbers
[macro-dialanalogwithfallback1]
  exten => s,1,Dial(${TRUNK}/1${MACRO_EXTEN})
  exten => s,2,Congestion
  exten => s,102,Macro(condsetcid)
  exten => s,103,SetCIDName(LAIRD SCOTT)
  exten => s,104,Dial(${NUFONE}/1${MACRO_EXTEN})
  exten => s,105,Congestion
  exten => s,205,Busy

; This just dials via POTS without any special handling
[macro-dialanalog]
  exten => s,1,Dial(${TRUNK}/${MACRO_EXTEN})
  exten => s,2,Congestion
  exten => s,102,Busy

; ditto, but for NuFone.
[macro-dialnufone]
  exten => s,1,Macro(condsetcid)
  exten => s,n,SetCIDName(LAIRD SCOTT)
  exten => s,n,SetAMAFlags(billing)
  exten => s,n,Dial(${NUFONE}/${MACRO_EXTEN})
  exten => s,n,Congestion

[macro-dialnufonewithfallback]
  exten => s,1,Macro(condsetcid)
  exten => s,n,SetCIDName(LAIRD SCOTT)
  exten => s,n,SetAMAFlags(billing)
  exten => s,n(nufone),Dial(${NUFONE}/${MACRO_EXTEN})
  exten => s,n,Congestion
  exten => s,nufone+101,SetAMAFlags(default)
  exten => s,n(analog),Dial(${TRUNK}/${MACRO_EXTEN})
  exten => s,n,Macro(fastbusy)
  exten => s,analog+101,Busy

; for 10-digit dialing in non-local areas
[macro-dialnufonewithfallback1]
  exten => s,1,Macro(condsetcid)
  exten => s,n,SetCIDName(LAIRD SCOTT)
  exten => s,n,SetAMAFlags(billing)
  exten => s,n(nufone),Dial(${NUFONE}/1${MACRO_EXTEN})
  exten => s,n,Congestion
  exten => s,nufone+101,SetAMAFlags(default)
  exten => s,n(analog),Dial(${TRUNK}/1${MACRO_EXTEN})
  exten => s,n,Macro(fastbusy)
  exten => s,analog+101,Busy

; This sets the ALERT_INFO variable based on the CALLERIDNUM
; setting via a lookup in the 'distinctivering' database.  See
; http://scottstuff.net/scott/archives/000163.html
[macro-setalertinfo]
  exten => s,1,DBGet(ALERT_INFO=distinctivering/${CALLERIDNUM})

; This is the 'inside' context, where calls made from inside of the
; house start out.  The 'inside' context (or 'inside-sip'/'inside-analog')
; is referred to in sip.conf and zapata.conf.  That's what ties this all
; together.
[inside]
  include => parkedcalls
  include => operator
  include => e911
  include => forced-analog
  include => information
  include => local
  include => pstn-local10
  include => tollfree
  include => pstn-nonlocal10
  include => international

; There's no real reason for these to exist right now; I could
; just replace the references to them in sip.conf/zapata.conf
; with references to the 'inside' context.  This is kind of 
; historical.
[inside-sip]
  include => inside

[inside-analog]
  include => inside

[operator]
  exten => 0,1,Macro(dialanalog)

[e911]
  exten => 911,1,Macro(dialanalog)
  exten => 9911,1,Macro(dialanalog)

[forced-analog]
  ; Only allow 2, 3, 7, and 10-digit strings.  Without this, calls to area
  ; codes that start with a '9' (like my sister's cell phone in NYC) don't
  ; work.
  exten => _9XX,1,Macro(dialanalog)
  exten => _9XXX,1,Macro(dialanalog)
  exten => _9XXXXXXX,1,Macro(dialanalog)
  exten => _9XXXXXXXXXX,1,Macro(dialanalog)

[information]
  exten => 411,1,Macro(dialanalog)

; The 'local-extensions.conf' file is autogenerated.  See
; http://scottstuff.net/scott/archives/000163.html and
; http://svn.scottstuff.net/project/asterisk-lca-map/
[pstn-local10]
#include "local-extensions.conf"

[pstn-nonlocal10]
  exten => _NXXNXXXXXX,1,Macro(dialnufonewithfallback1)
  exten => _1NXXNXXXXXX,1,Macro(dialnufonewithfallback)

[tollfree]
  exten => _1888NXXXXXX,1,Macro(dialanalogwithfallback)
  exten => _1877NXXXXXX,1,Macro(dialanalogwithfallback)
  exten => _1866NXXXXXX,1,Macro(dialanalogwithfallback)
  exten => _1855NXXXXXX,1,Macro(dialanalogwithfallback)
  exten => _1800NXXXXXX,1,Macro(dialanalogwithfallback)

  exten => _888NXXXXXX,1,Macro(dialanalogwithfallback1)
  exten => _877NXXXXXX,1,Macro(dialanalogwithfallback1)
  exten => _866NXXXXXX,1,Macro(dialanalogwithfallback1)
  exten => _855NXXXXXX,1,Macro(dialanalogwithfallback1)
  exten => _800NXXXXXX,1,Macro(dialanalogwithfallback1)

[international]
  exten => _011.,1,Macro(dialnufone)

[local]
  exten => 200,1,Macro(callextension,${PHONES},200)
  exten => 201,1,Macro(callextension,${ANALOG},200)
  exten => 202,1,Macro(callextension,${BEDSIP},200)
  exten => 203,1,Macro(callextension,${KITSIP},200)
  exten => 204,1,Macro(callextension,${BEDSIP},200)

  exten => 210,1,Macro(callextension,${BASESIP},210)

  exten => 230,1,Answer
  exten => 230,2,Wait(5)
  exten => 230,3,Goto(fax,2201,1)

  exten => 221,1,Answer
  exten => 221,2,Goto(outside-ivr,s,1)
  exten => 221,3,Beep
  exten => 221,4,Hangup

  exten => 222,1,Wait,2
  exten => 222,2,VoicemailMain(s200)
  exten => 222,3,Hangup

  exten => 211,1,Wait(2)
  exten => 211,n,VoicemailMain(s210)

  exten => 223,1,Wait,2
  exten => 223,2,VoicemailMain
  exten => 223,3,Hangup

[outside-ivr]
  ; This is the outside IVR
  ; Playback a "We're not home message"
  ; To leave a message for Scott, press 1
  ; To leave a message for C, press 2
  ; Otherwise stay on the line.
  ;
  ; Also, 3 => main voicemail
  ;  4 => check voicemail (main)
  ;  5 => check voicemail
  ;
  ; Check for fax, too

  exten => s,1,AppendCDRUserField( -> IVR)
  exten => s,2,DigitTimeout(5)
  exten => s,3,ResponseTimeout(2)
  exten => s,4,Wait(1)
  exten => s,5,Background(laird/ivr-greeting)

  exten => 1,1,AppendCDRUserField( -> 1)
  exten => 1,2,Wait(1)
  exten => 1,3,VoiceMail(us201)
  exten => 1,4,Hangup

  exten => 2,1,AppendCDRUserField( -> 2)
  exten => 2,2,Wait(1)
  exten => 2,3,VoiceMail(us202)
  exten => 2,4,Hangup

  exten => 3,1,AppendCDRUserField( -> 3)
  exten => 3,2,Wait(1)
  exten => 3,3,VoiceMail(us200)
  exten => 3,4,Hangup

  exten => 4,1,AppendCDRUserField( -> 4)
  exten => 4,2,Wait(1)
  exten => 4,3,VoiceMailMain(200)
  exten => 4,4,Hangup

  exten => 5,1,AppendCDRUserField( -> 5)
  exten => 5,2,Wait(1)
  exten => 5,3,VoiceMailMain
  exten => 5,4,Hangup

  exten => fax,1,AppendCDRUserField( -> fax)
  exten => fax,2,Answer
  exten => fax,3,Goto(fax,2201,1)

  exten => t,1,AppendCDRUserField( -> timeout)
  exten => t,2,VoiceMail(s200)
  exten => t,3,Hangup

  exten => i,1,AppendCDRUserField( -> invalid)
  exten => i,2,Playback(tt-allbusy)
  exten => i,3,Goto(s,3)

[fax]
  exten => fax,1,Macro(faxreceive)
  exten => 2201,1,Macro(faxreceive)
  exten => 2202,1,Macro(faxreceive)
  exten => 2203,1,Macro(faxreceive)

  exten => h,1,system(/usr/local/sbin/mailfax ${FAXFILE} ${EMAILADDR} "${CALLERIDNUM} ${CALLERIDNAME}")

; This is where outside calls enter the system, thanks to 
; zapata.conf, sip.conf, and iax2.conf.  By and large, calls are
; directed to the 'outsideline' macro, *except* for the second 
; 866 number; that's just for checking voicemail.
[outside]
  exten => s,1,GotoIf($[X${CALLERIDNAME} = X]?200:2)
  exten => s,2,Macro(outsideline)
  exten => s,3,Hangup
  exten => s,200,Wait(30)
  exten => s,201,Hangup
  exten => 4254889999,Macro(outsideline)
  exten => 4254889999,2,Hangup
  exten => 8662299999,1,Macro(outsideline)
  exten => 8662299999,2,Hangup
  exten => 2068389999,1,Macro(outsideline)
  exten => 2068389999,n,Hangup
  exten => 8003949999,1,Macro(cidfix)
  exten => 8003949999,n,Goto(outside-ivr,s,1)
  exten => 8003949999,n,Hangup
  exten => 8888299999,1,SetAccount(pannell)
  exten => 8888299999,n,Macro(cidfix)
  exten => 8888299999,n,Dial(${BASESIP},30,t)
  exten => 8888299999,n,Voicemail(u210)
  exten => 4253549999,1,Macro(outsideline)
  exten => 4253549999,2,Hangup

  exten => 8662559999,1,VoicemailMain(200)
  exten => 8662559999,2,Hangup
  exten => 8662559999/2064849999,1,VoicemailMain(s200)
  exten => 8662559999/2064849999,2,Hangup
  exten => 8662559999/2069799999,1,VoicemailMain(s200)
  exten => 8662559999/2069799999,2,Hangup

  exten => scott,1,VoiceMail(us201)
  exten => scott,2,Hangup
  exten => cynthia,1,VoiceMail(us202)
  exten => cynthia,2,Hangup

  exten => fax,1,Goto(fax,2201,1)
  exten => t,1,Hangup
  exten => h,1,Hangup

[outside-analog]
  exten => s,1,GotoIf($[X${CALLERIDNAME} = X]?200:2)
  exten => s,2,Goto(outside,4254889999,1)
  exten => s,3,Hangup
  exten => s,200,Wait(30)
  exten => s,201,Hangup

[outside-sip]
  include => outside

[outside-nufone]
  include => outside

[outside-ebc]
  include => outside

[default]
  exten => s,n,Goto(outside,2068389999,1)
  exten => _x.,n,Goto(outside,2068389999,1)

sip.conf

Here’s sip.conf, again slightly redacted:

;
; SIP Configuration for Asterisk
;
[general]
port = 5060                   ; Port to bind to
bindaddr = 0.0.0.0    ; Address to bind to
context = outside-sip         ; Default for incoming calls
srvlookup = yes               ; Enable SRV lookups on outbound calls
;pedantic = yes               ; Enable slow, pedantic checking for Pingtel
tos=lowdelay
disallow=all                  ; Disallow all codecs
allow=gsm
allow=ilbc
allow=ulaw            ; Allow codecs in order of preference
insecure=very

[201]
type=friend
secret=zzzz
auth=md5
nat=yes
host=dynamic
reinvite=no
canreinvite=no
qualify=1000
dtmfmode=rfc2833
mailbox=200,201
callerid="Scott Laird" <201>
disallow=all
allow=gsm
allow=ulaw
allow=ilbc
context=inside-sip

[202]
type=friend
secret=zzzz
auth=md5
nat=yes
host=dynamic
reinvite=no
canreinvite=no
qualify=1000
dtmfmode=rfc2833
mailbox=200,202
callerid="Cynthia Laird" <202>
disallow=all
allow=gsm
allow=ulaw
allow=ilbc
context=inside-sip

[203]
type=friend
secret=zzzz
auth=md5
nat=yes
host=dynamic
reinvite=no
canreinvite=no
qualify=1000
dtmfmode=rfc2833
mailbox=200
callerid="Kitchen" <203>
disallow=all
allow=gsm
allow=ulaw
allow=ilbc
context=inside-sip

iax.conf

Finally, iax.conf:

; Inter-Asterisk eXchange driver definition
;
;
[general]
bandwidth=low
allow=gsm
disallow=ilbc
disallow=speex
disallow=ulaw
disallow=alaw
disallow=lpc10                ; Icky sound quality...  Mr. Roboto.
jitterbuffer=yes

register => laird:zzzz@switch-2.nufone.net
register => laird:zzzz@voip.teliax.com
authdebug=yes
tos=lowdelay

[guest]
type=user
context=outside
callerid="Guest IAX User"

[NuFone]
type=user
host=switch-2.nufone.net
secret=zzzz
context=outside-nufone
qualify=400
amaflags=billing

[NuFone]
type=peer
host=switch-1.nufone.net
secret=zzzz
qualify=400
amaflags=billing

[teliax]
context=outside
type=friend
host=voip.teliax.com
auth=md5
secret=zzzz
disallow=all
;allow=ilbc
allow=gsm
qualify=400

Posted by Scott Laird Thu, 07 Jul 2005 16:12:00 GMT


VoIP Fraud

It’s amazing the ways that people can find to steal money. The latest scam goes like this:

  1. Set up the local equivalent of a CLEC in some third-world country.
  2. Publish exorbitant rates for a block of numbers (say, $5/minute).
  3. Sign up with a US-based VoIP provider using a freshly-stolen credit-card number.
  4. Verify that the VoIP provider doesn’t know about your rates, and only charges a small fee to dial the country in question (say, $0.10/minute).
  5. Have a SIP auto-dialer call your numbers via the VoIP provider until the CC is declined or the account’s balance limit is hit.
  6. Repeat.
  7. At some point in the future, the VoIP provider will receive a massive bill from their upstream provider, while the Telco in whatever third-world country you’re using will hand you a big check.

This is just a twist on the old “modem dialer” scam, but it’s been costing VoIP providers big money. NuFone has apparently lost $400,000 recently, and other providers are reporting huge fraud rates–according to Teliax, roughly 1/3 of their new customer signups are fraudulent.

There’s a long thread following this on Digium’s list server.

It looks like this has helped kill at least one VoIP provider: LiveVoIP has declared bankruptcy, although they had a spotty reputation to start with.

Posted by Scott Laird Tue, 28 Jun 2005 02:43:19 GMT