More Adventures in VoIP / by Eddie Jennings

No, I haven't just worked with VoIP for past seven days.  Other things have to be accomplished as well; however, today was a nice breakthrough from 24 hours of struggling with my lab.  I'm currently comparing two SIP providers: Twilio and VoIP.ms.

The set-up for VoIP.ms was trivial, and following Jared Busch's guide, it worked like a charm.  Twilio, not so much.  However, I really think my struggles were more about me not following the documentation to the word, as well as needing to understand how dialed numbers can be manipulated by the trunk.

In Twilio's documentation, it says that you must have a + in the outbound dial prefix.  So, I had that configured, and kept receiving an "all circuits busy" message.  Further in the documentation, it mentions the goal is to have the number following the E.164 standard.  For me, this means adding a 1, even though the call I'm making isn't truly a long distance call for me.  So I had to make the outbound dialing prefix a +1.  Now, there's probably a more eloquent way to handle this, as I'm sure my users will instinctively dial a 1 when calling a "long distance" number, and having +1 in the prefix will make the resultant number be +11, but for right now, the goal was simply "be able to terminate a call with FreePBX and Twilio"

Another aspect of the documentation that I learned must be strictly followed is that the outbound CID must follow that same numbering standard (E.164).  So I had to configure it to be my number from Twilio with +1.  Not configuring that resulted in the same error message.

The final thing I overcame was a failure of attention to detail.  As I was troubleshooting why the trunk seemed to be failing for terminating calls, I kept seeing an error in the Asterisk logs about a URI being invalid.  Well, I checked my configuration, and everything looked to be in order.  Spelling was correct.  Hyphens and dots were in the right places.  It wasn't until I noticed what seemed to be an extra space between the URI listed in the log and the error message.  So after cursing to myself, I checked my FreePBX configuration again, and saw that I did have an extra space in SIP server URI configuration for my trunk -- got to love cutting and pasting.

Other tasks I tried today included configuring the FreePBX trunk to use CHAN_SIP instead of PJSIP, since PJSIP seemed to be "failing".  I did this because the Twilio documentation example appeared to have similar settings to that of FreePBX's CHAN_SIP configuration.  After a while (and time lost due to my eagerness and not following the documentation closely enough), I was able to terminate calls -- discover all of the above things about dialing patterns and CID configuration.

So what's the result?  The result is I was able to successfully originate and terminate calls with Twilio and FreePBX using both PJSIP trunks and CHAN_SIP trunks.  Time could've been saved had I followed the documentation closely during my initial attempts to get PJSIP working.  On a positive note, the troubleshooting I did was useful in it forced me to narrow problems down step by step as well as showed me exactly how some pieces worked (especially dialing patterns), so overall today was a win.