Using asterisk as a RAS server

So I’ve got a client that has a need to have his clients dial into his network using ISDN. Right, so stagger a bunch of ISDN modems, use mgetty on them … yea yea. Figured I’d go the interesting route, get a few quad-port Digium ISDN PRI cards into a box (5 cards, => 5 * 4 * 40 = 20 * 30 = 600 odd available channels) and do this using asterisk.

The first steps is simple enough, set up your ISDN to connect to your PSTN (whether you’re using BRI cards, or PRI doesn’t really matter, for testing I used BRI, B410P). Some requirements first though:

  • Compile ppp statically into the kernel (dahdi-linux doesn’t pick up on this otherwise – patch at https://issues.asterisk.org/view.php?id=17990).
  • Make sure you compile and install the dahdi.so module as part of dahdi-tools (in the dahdi-tools source dir run “make -C ppp” and “make -C ppp install”
  • You don’t want asterisk running as root, so you need to patch asterisk to not pass root requiring options to pppd (or replace /usr/sbin/pppd with a wrapper script that retakes proper root before invoking the real pppd – I prefer patching asterisk):
    --- asterisk-1.6.2.13.ORIG/apps/app_dahdiras.c	2008-11-02 04:50:33.000000000 +0200
    +++ asterisk-1.6.2.13/apps/app_dahdiras.c	2010-09-16 09:44:57.112000237 +0200
    @@ -119,8 +119,6 @@
     		c = strsep(&stringp, ",");
     	}
     
    -	argv[argc++] = "plugin";
    -	argv[argc++] = "dahdi.so";
     	argv[argc++] = "stdin";
     
     	/* Finally launch PPP */

Right, so before we go off writing asterisk dialplan code, we need a way for pppd to actually work. I’m going to assume you’ve got some experience with pppd, and I’m thus going to take a guess that you’re capable of doing this. In /etc/ppp/peers (we require some privileged statements so we do need a peer, not simply an options file) create a file called ras that looks something like:

#uncomment when testing:
debug
 
name ras
auth
 
# more options to specify how auth
# needs to happen, chap vs pap vs eap
 
# This is critical.
plugin dahdi.so

It should be noted that this setup will most likely only work with TRANSFERCAPABILITY DIGITAL (SPEECH will imply an analog modem on the remote end which will require full blown modem emulation).

Now, in your dialplan simply send the call into:

exten => _X.,n,DAHDIRAS(call,ras)

For pppd output monitor /var/log/messages (or wherever pppd is set up to log to). There are some errors to look out for, I’ll list the ones I bumped into and how to fix them here:

using the plugin option requires root privilege
This means your DAHDIRAS hasn’t been patched as per above, nor is asterisk running as root.

dahdi: PPP support not compiled in
This is actually in dmesg (but gets logged to /var/log/messages anyway), this means dahdi-linux didn’t pick up on the ppp configuration in the kernel. Make sure your kernel is configured statically with ppp support or go apply the patch referenced above. Alternatively, in your dahdi-linux sources, edit include/dahdi/dahdi_config.h and make sure that CONFIG_DAHDI_PPP does get defined (just remove the lines before and after the #define, it’s an #ifdef, and a #endif).

If you run into any other problems, please let me know and I’ll see if I can assist.

2 thoughts on “Using asterisk as a RAS server

  1. Hi,

    No, this will not function as an analog dialup, for that you would need to actually demodulate the signal from analog => digital first. I’m not sure what would be involved in doing that, but I’m guessing you need to add an additional layer between the ISDN circuit and pppd to emulate the modem portion. Obviously your throughput will be lower than 64Kbps, probably in the region of 56Kbps max, depending on the clarity of the line at the other end.

    Whilst researching this I have seen references to software that should make this possible, I have however not tried it.

Leave a Reply

Email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam Protection by WP-SpamFree