Top

Differences between SIP and IAX for your Asterisk Installations

April 22, 2009

Today VoipSupply is running a contest about IAX vs SIP because of a new phone launch that supports IAX (finally!).

So, we thought we'd go over a couple of the differences of SIP and IAX and why IAX may suit your needs better.

IAX:

  • Only one port needed on firewall
  • Works much easier with NAT environments
  • Smaller network footprint
  • Out of Band DTMF for ease of use
  • Created by the Asterisk Team (well supported)

SIP:

  • Standard Protocol
  • Works with not only Asterisk
  • Great if you're not NATing
  • Well Supported
  • Higher Bandwidth usage than IAX
  • Can be a problem with DTMF sometimes

Those are pretty much the bare facts about SIP vs IAX. We're not out to start a war between which one is better, obviously both have their benefits and disadvantages. For us, we like using IAX with any remote office for trunking purposes or for external lines behind firewalls we don't control. For inside the office, we opt for SIP as much nicer phones are available with this protocol.

Which do you prefer?

Don't forget to check out the contest from VOIPSUPPLY while you're at it.

Hack MagicJack to work with your Asterisk PBX Installation, 20$ Calls for a year!

August 31, 2008

Recently there's been a bit of a conversation about hacking the MagicJack VOIP boxes to enable it to work with Asterisk. Like some of the other list users, we weren't aware of this, but this was posted as a followup. Probably old for most of you, but some may find it useful for your Magic Jack.

As of 5-31-08 to obtain your sip credentials you will need to dump your memory while magicjack.exe is running in order to view the decrypted password.
All other information can be had with any packet capture program.

Original, and All credit goes here: http://revolution.hackthisbox.com/magicjack/readme

Replace EXXXXXXXXXX01 with your MJ number. Include E and 01.
Replace the proxy proxy1.Atlanta.talk4free.com:5070 with the proxy your MJ registers to and change host=67.90.138.70 to host=YourProxyIPHere.
Replace XXXXXpasswordXXXXX with your password. Currently a 20 character string consisting of numbers and letters. Mine is all uppercase.

~~~~~sip.conf~~~~~

register => EXXXXXXXXXX01:XXXpasswordXXXX@proxy1.Atlanta.talk4free.com:5070

[magicjack]
context=incoming
username=EXXXXXXXXXX01
type=friend
secret=XXXXXpasswordXXXXX
port=5070
nat=yes
insecure=very
host=67.90.138.70
fromuser=EXXXXXXXXXX01
dtmfmode=inband
qualify=2000

~~~~~sip.conf~~~~~

~~~~~extensions.conf~~~~~

[incoming]
exten => YourMJNumber,1,Answer
exten => YourMJNumber,2,Dial(sip/sipura,30,r) ;dial someone...such as an ATA

[MagicJackOutgoing]
exten => _1NXXNXXXXXX,1,Dial(SIP/${EXTEN}@magicjack,30,r)
exten => _1NXXNXXXXXX,2,congestion()
exten => _1NXXNXXXXXX,102,busy()
exten => i,1,Hangup
exten => t,1,Hangup
exten => h,1,Hangup

[sip]
include => MagicJackOutgoing

~~~~~extensions.conf~~~~~

Spamming People using Dead VOIP Numbers..

June 2, 2008

So, Someone posted this to the Asterisk-Users list today, interesting because I myself have received a few calls from these toll frees, well, not these specific ones, but from ones with the exact same circumstances. This post got me to thinking, what if spammers are trolling all the SIP/IAX Providers websites that list out the VOIP DID Prefixes without username/password that are available, or are just reading off regular mailings from these companies. IE: Say you scan a few websites, and see that they have did's available in a bunch of prefixes, you simply call all the ones that are available with a wardialer and see which ones aren't dead, and which ones are. Then, use the dead ones in your outgoing CID spoof, which will lead back to the originating voip company, and not yourself. I'm not saying that's what these people are doing, but just something that I started thinking about when reading this guys post. I'm sure there are a plethora of ways they could be doing this, but interesting none the less. anyway, here's the post:

 

 

 

Hello all,

not sure this belongs here, but I'm wondering if anyone else has
received "phone spam" lately. Over the last eight weeks, I've received
over 60 calls to my toll-free numbers, originating from various fake
numbers in the 940 and 956 area codes. When I still *listened* to them,
they began with "for all your office needs go to smtmco.com."

Whenever I call the numbers back (based on caller id), I get one or two
rings, then a click, then dead air. That's also the reason I'm posting
this here -- these folks either have access to a large pool of numbers,
or to a list of "dead" numbers. The last six numbers (three today) are:
940.387.0483
956.982.1640
940.891.6197
956.554.7617
940.891.6099
956.421.3378

The 956 numbers are all SWBell exchanges, while the 940s are GTE/Verizon
exchanges. All calls came in through my toll-free numbers (which in
turn are hosted by vitelity/exgn).

The website referenced isn't loading, but registered to:

Registrant:
Sales Team
321 High School Rd NE, PMB 348
Suite D3
Bainbridge Island, Washington 98110
United States
(800) 921-0136 ; NS1.ORDERSHOPPER.COM

Ordershopper.com also seems a dead-end, as it's registered "by proxy",
as all good spammers do.

I have since established a greylisting function, which simply does the
zapateller and then prompts the caller to call back within ten minutes
to be put through. If the same caller (by ID) calls the same number
within those 10 minutes, he's put through to a person and whitelisted.
If the caller hangs up before hearing the message (during the SIT tone),
the numbers is marked for blacklisting. Outgoing calls are
automatically whitelisted, as are certain (local) area codes. This has
kept the phone silent for a couple of weeks, and afaik, no valid calls
were killed.

But the real question is -- has anyone else seen this?

FreePBX Music on Hold with Madplay instead of Format_mp3

November 22, 2007

We've just recently replaced our company PBX with FreePBX and Asterisk 1.4. We were getting complaints about format_mp3 and how it plays the same song, from the beginning every time you put someone on hold. This is honestly a bad way to do hold music, and I'm not sure why the Asterisk Developers haven't fixed it, but, it's easy enough to fix. Here are the steps to take to use madplay instead. Note that we're using Ubuntu Linux, so the commands may change a bit.

1. Install madplay

# apt-get install madplay

2. Login to the FreePBX Control Console and create a Music On Hold context. Next you will want to upload all your mp3's to this context.

3. Once your satisfied with the mp3's you've uploaded to your context, you will have to ssh to your box

# ssh your.pbx.ip

4. After logging in, and su'ing to root, go to /etc/asterisk and edit musiconhold_additional.conf. It should end up looking like this. Replace [Flewid] with your Music on Hold context.

[Flewid]
mode=custom
directory=/var/lib/asterisk/mohmp3/Flewid/
application=/usr/bin/madplay -Qzr -o raw:- --mono -R 8000 -a -12
random=yes

5. Now you will have to stop and start asterisk. Something like this should do the trick.

# /etc/init.d/asterisk stop
# /etc/init.d/asterisk start

6. Now when you issue a ps you should see that madplay is now running. You should see something like the following.

# ps aux | grep madplay

asterisk 15921 0.0 0.4 5732 2156 ? S Nov21 0:00 /usr/bin/madplay -Qzr -o raw:- --mono -R 8000 -a -12 Party 1992 Intromusic.mp3 A Touch of Spring.mp3 Ice Frontier.mp3 imphobia.mp3 Aquaphobia - 1993 spring.mp3 Lavender Hill.mp3 M16A.mp3 M16C.mp3 MENU.mp3 Minimum Velocity.mp3 Purple Sky II.mp3 Satellite one..mp3 technology.mp3 Turbulence.mp3 Unreal Symphony.mp3 When the heavens fall.mp3

7. That's it. Now you should have fancy music on hold that won't start at the beginning of every song, and when people are put on music on hold they will hear the song immediately, instead of waiting for it to start.

There is one problem with this method, in that if you decide to upload any more music on hold files to your context, musiconhold_additional.conf will get overwritten, and you will have to apply this fix again.

It would be nice if the freepbx developers added the option of using madplay from the administration interface. But this isn't really too big of a deal since musiconhold is changed infrequently (at least for us).

Hack FreePBX and Asterisk 1.4 to Support MD5Secret for Cisco (and other) SIP Devices.

November 19, 2007

This weekend I enlisted the help of a programmer friend of mine to help me make FreePBX / Asterisk 1.4 capable of taking md5secrets for the password, instead of just the unencrypted secret field. I'm not sure why FreePBX doesn't include this functionality already, I suppose the developers don't see a need in password security for their peers, but we do!

It wasn't very hard to get this done, and we've submitted a patch to FreePBX. Hopefully they will incorporate this into their next release and also add it for IAX Devices as well.

What This Hack Does:

  1. Allow you to specify secret or md5secret for peer
  2. Allow you to type plaintext secret in md5secret field, and it will run md5sum

What This Hack Doesn't Do:

  1. Add MD5Secret Ability to IAX Devices
  2. Work if your asterisk realm is set to something other than "asterisk".
  3. Allow device passwords longer than 32 characters.
  4. Display Popup warnings if no passwords are entered


How to enable this on your FreePBX / Asterisk 1.4 Installation:

  1. Edit the Functions.inc.php in the core modules directory of freepbx

    # cd /var/www/admin/modules/core/functions.inc.php
    # cp functions.inc.php functions.inc.php.original
    # nano functions.inc.php

  2. Look for the function named "core_Devices_addsip" and replace it with the following:

    //add to sip table
    function core_devices_addsip($account) {
    global $db;
    global $currentFile;

    foreach ($_REQUEST as $req=>$data) {
    if ( substr($req, 0, 8) == 'devinfo_' ) {
    $keyword = substr($req, 8);
    if ( $keyword == 'dial' && $data == '' ) {
    $sipfields[] = array($account, $keyword, 'SIP/'.$account);
    } elseif ($keyword == 'mailbox' && $data == '') {
    $sipfields[] = array($account,'mailbox',$account.'@device');
    } elseif ($keyword == 'md5secret' && $data != '') {
    $sipfields[] = array($account, 'md5secret', md5($account.':asterisk:'.$data));
    } else {
    $sipfields[] = array($account, $keyword, $data);
    }
    }
    }

  3. Directly following the "core_devices_addsip" function, is the sipfields array. Replace it with the following piece of code:

    if ( !is_array($sipfields) ) { // left for compatibilty....lord knows why !
    $sipfields = array(
    //array($account,'account',$account),
    array($account,'accountcode',(isset($_REQUEST['accountcode']))?$_REQUEST['accountcode']:''),
    array($account,'secret',(isset($_REQUEST['secret']))?$_REQUEST['secret']:''),
    array($account,'md5secret', (isset($_REQUEST['md5secret']))? $_REQUEST['md5secret']:''),
    array($account,'canreinvite',(isset($_REQUEST['canreinvite']))?$_REQUEST['canreinvite']:'no'),
    array($account,'context',(isset($_REQUEST['context']))?$_REQUEST['context']:'from-internal'),
    array($account,'dtmfmode',(isset($_REQUEST['dtmfmode']))?$_REQUEST['dtmfmode']:''),
    array($account,'host',(isset($_REQUEST['host']))?$_REQUEST['host']:'dynamic'),
    array($account,'type',(isset($_REQUEST['type']))?$_REQUEST['type']:'friend'),
    array($account,'mailbox',(isset($_REQUEST['mailbox']) && !empty($_REQUEST['mailbox']))?$_REQUEST['mailbox']:$account.'@device'),
    array($account,'username',(isset($_REQUEST['username']))?$_REQUEST['username']:$account),
    array($account,'nat',(isset($_REQUEST['nat']))?$_REQUEST['nat']:'yes'),
    array($account,'port',(isset($_REQUEST['port']))?$_REQUEST['port']:'5060'),
    array($account,'qualify',(isset($_REQUEST['qualify']))?$_REQUEST['qualify']:'yes'),
    array($account,'callgroup',(isset($_REQUEST['callgroup']))?$_REQUEST['callgroup']:''),
    array($account,'pickupgroup',(isset($_REQUEST['pickupgroup']))?$_REQUEST['pickupgroup']:''),
    array($account,'disallow',(isset($_REQUEST['disallow']))?$_REQUEST['disallow']:''),
    array($account,'allow',(isset($_REQUEST['allow']))?$_REQUEST['allow']:'')
    //array($account,'record_in',(isset($_REQUEST['record_in']))?$_REQUEST['record_in']:'On-Demand'),
    //array($account,'record_out',(isset($_REQUEST['record_out']))?$_REQUEST['record_out']:'On-Demand'),
    //array($account,'callerid',(isset($_REQUEST['description']))?$_REQUEST['description']." <".$account.'>':'device'." <".$account.'>')
    );
    }

  4. Look for the SIP Temporary Arrays, around line 2973 and add this value. We're not sure if it's required, but it works with it here so we left it.

    $tmparr['md5secret'] = array('value' => '', 'level' => 0);

  5. Exit and save the file
  6. Refresh FreePBX Extension and you should now see md5secret available as an option. This field also appears on the add new sip extension page as well.

You can download the modified functions.inc.php by using this link

FreePBX Ubuntu Howto

November 3, 2007

Note, If you're looking for current information please see Free PBX Guide for the latest tutorial with updated information from what is located below.
Free PBX Guide

Hi Guys,

With the help of one of my contractors (elisand.com), we've developed a little howto for FreePBX and Ubuntu. This should work on LTS and Regular versions of Ubuntu with minimal changes. We install all required software, asterisk 1.4 and FreePBX. It's been working for 2 of our clients without issue, so it was decided that it's time to post it up for the world.

In the interest of keeping it easy to read, I've decided to post it up as word format, and PDF documents. See below to download them.

We hope this helps you as much as it has us. It's taken the time down from around 5-7 hours for the initial install when we created this document, to more like 30-40 minutes including compile time. Swanky!

Please comment below if you have any additions, flames, praise!

Note, If you're looking for current information please see Free PBX Guide for the latest tutorial with updated information from what is located below.
Free PBX Guide

Asterisk 1.4.5 SpanDSP Integration Howto

June 24, 2007

Here is a quick and dirty HowTo on getting SpanDSP to work with the latest editions of Asterisk 1.4. If you have any issues let me know in the comments and we'll get them sorted out.

First we'll have to download the asterisk source from their site.

# cd /usr/src
# wget ftp://ftp1.digium.com/pub/asterisk/asterisk-1.4.5.tar.gz
# tar xzvf asterisk-1.4.5.tar.gz

Now we'll have to grab the latest SpanDSP from Soft-Switch. We'll also have to compile this and make sure no other SpanDSP versions are available on our server. The paths may change if you are using /usr/local so edit the following commands appropriately.

# cd /usr/lib
# rm -rf *spandsp*
# cd /usr/include
# rm -rf *spandsp*
# cd /usr/src
# wget http://www.soft-switch.org/downloads/spandsp/spandsp-0.0.4pre3.tgz
# tar xzvf spandsp-0.0.4pre3.tgz
# cd spandsp-0.0.4pre3
# ./configure && make && make install
# ldconfig -v

Now that SpanDSP has been compiled and installed, we can continue with the integration to Asterisk 1.4.

First we will need to copy the app_txfax.c and app_rxfax.c into the Asterisk Applications directory. This can be done like this:

# cd /usr/src
# cd asterisk-1.4.5
# cd apps
# wget http://www.soft-switch.org/downloads/snapshots/spandsp/test-apps-asterisk-1.4/app_rxfax.c
# wget http://www.soft-switch.org/downloads/snapshots/spandsp/test-apps-asterisk-1.4/app_txfax.c
# cd ..

Now we'll have to add the SpanDSP support to Asterisk in order to make use of these applications. I prefer to manually apply the patch file from Soft-Switch because it almost always fails. You can try either way you want.

Open up the patch file in a web browser so you can easily see what lines need to change, the patch file is located here

patch file: http://www.soft-switch.org/downloads/snapshots/spandsp/test-apps-asterisk-1.4/asterisk.patch

Now we'll need to manually apply these lines. Assuming you know something about patch files it should be pretty easy for you to modify the files, I'll briefly outline what needs to be done below.

First, Make sure you are in the Asterisk source directory.

# cd /usr/src/asterisk-1.4.5

Now, We'll have to modify the menuselect dependencies.

# nano build_tools/menuselect-deps.in

Search for RADIUS=@PBX_RADIUS@ and directly below this line put in the following new line

SPANDSP=@PBX_SPANDSP@

Exit and save the file.

Now you'll have to add a line to configure.ac

# nano configure.ac

Search for AST_EXT_LIB_SETUP([RADIUS], and directly below this line, put this in

AST_EXT_LIB_SETUP([SPANDSP], [spandsp Library], [spandsp])

Now, in the same file (configure.ac) we also have to add another line. Search for AST_EXT_LIB_CHECK([RADIUS], and directly below this line, add the following all on one line:

AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [fax_init], [spandsp.h], [-ltiff])

Exit and save the file.

Now our last file to edit is the make options, which you can do like this

# nano makeopts.in

Search for the line like this RADIUS_LIB=@RADIUS_LIB@, add this directly below it

SPANDSP_INCLUDE=@SPANDSP_INCLUDE@
SPANDSP_LIB=@SPANDSP_LIB@

Exit and save the file.

Now we are almost ready to get the compiling going. But first, we have to copy the plc.h file to the Asterisk source so we won't get errors during compiling later on. You can do this as such:

# cd /usr/src/asterisk-1.4.5
# cd includes/asterisk
# cp plc.h plc.h.backup
# cp /usr/include/spandsp/plc.h .

Now because we've added new options to Asterisk, we'll have to bootstrap it

# cd /usr/src/asterisk-1.4.5
# ./bootstrap.sh

Now we re-run configure like the following, your options might be different

# ./configure --with-netsnmp --with-ssl --with-spandsp

Now we should go into the menuselect program to ensure that app_rxfax and app_txfax will be included when you compile Asterisk.

# make menuselect

Ensure that both applications are selected under the Applications menu. Exit the menuselect utility by pressing "x" to save your changes if required.

Now we can continue with the regularly scheduled compiling of the program.

# make
# make install

You should have a brand new copy of app_txfax.so and app_rxfax.so located in /usr/lib/asterisk/modules

Note that you might have to add /usr/local/lib or /usr/lib to your ld.so.conf in /etc in order to make this work, once you add the library path, re-run ldconfig, then try to start asterisk.

Have fun!

Next Page »

Bottom