Asterisk cmd ZapRAS


The ZapRAS command is for use with Zap channel ISDN connections. It provides a Remote Access Server (RAS) to permit you to use some of your ISDN channels as data channels to give you a data link (perhaps an Internet connection). This command is not for use with analog lines; it does not provide a modem emulator.



Executes a RAS server using pppd on the given channel. Your pppd must be patched to be Zaptel-aware, also your kernel needs to be ppp-aware.

Starting points

  • You need to get your pppd patched to support Zaptel. See http://downloads.digium.com/pub/zaptel/misc/.
  • You will need the tarball and both patches listed.
  • You need to apply the PPPoE patch then the Zaptel patch.
  • It seems you need to have PPPoE support for your kernel. Try to tag any ppp-related kernel options as modules. It helps.

At this point you should be able to compile and install the pppd daemon. After that you should re-compile zaptel and then asterisk it-self.

Once you have this new pppd compiled, and you have the ppp support in your kernel, you are ready for the configuring your Dialplan. Here is the entry I used to get started with:

exten => 9022,1,Answer
exten => 9022,2,ZapRas(debug|64000|noauth|netmask||

ZapRAS requires you to split the pppd arguments so it is easy to pass them to exec. The line above will log problems to syslog, and importantly, defines the IP addresses to be used on each side (note: netmask above is not correct, ppp is a point-to-point protocol, it should be sth like or even .255, remeber to add some routes ("# ip route add ... via ...") . You will want to figure out what pppd flags will work best for your installation, for links with many B channels it's good to disable CCP protocol at all (compression in pppd).

The above line was used as a proof of concept to prove that I could get packets flowing. I too still have to change these flags for the final production environment. We connected using a Lucent (Ascend) Pipeline 75, and were able to pass traffic(ping) between the pipeline and the gateway machine.

Just add multilink to the options list of ZapRAS, and you can bond as many channels as are configured for idledial under one ppp interface. (This has been tested between two Asterisk boxes across a PRI.)

Also tested on asterisk with Allied-Telesyn mid-range router 410 with PRI/E1 card. I was able to dial from asterisk with multilinked 30 B channels and use full (~200 KB/s) bandwith.
Recently my link with two boxes and 4x E1 port cards (TE 405 compatible) was upgraded from one E1 to 4 E1 from telco. It's possible to link them to achive ~8 Mbps link. It works in production enviroment for half a year now, and gives no problem.

for dialingout it's better to use a dialplan like this:

exten => 111,1,Set(CALLERID(ALL)=123456789)
exten => 111,2,Dial(zap/g1/0987654321)
exten => 111,3,ZapRas(debug|64000|noauth|netmask||

and in zapata.conf (on calling side):

  • keep at LEAST two unused channels for Voice
  • keep at LEAST one data channel
  • as effect of this settings for ZapRAS there could be any number of open B channels starting from 1 and ending in (30-2) 28 (on E1 link).
  • note there is the "0" before dialled number and no "0" in callerid


On "server" side you need only to receive incoming call.

Return codes

Always returns -1.

See Also


  • The stuff in zapata.conf, idledial, etc., is only for the client side.
  • On the server side, note that ZapRAS does NOT automatically answer the line. You must add an Answer before ZapRAS in your extensions.conf, i.e.:
exten => 9022,1,Answer
exten => 9022,2,ZapRas(debug|64000|noauth|netmask||
  • When connecting two asterisk boxes, remember to add (on both sides) some restart-watchdog script which kills all pppd and maybe even asterisk PIDs when no ping response goes for 15-30 seconds.
  • On the Client side use a dialplan entry, and as the very first thing remeber to set CALLERID, many Telco providers won't allow connection w/o this.
  • I was able to achive a stable link with using 30 B channels, witch provided ~200 KBps bandwith (testet with ftp).
  • After tests remeber to add somekind of PAP/CHAP authorization to PPP. The compression is no need when using a ~30 channels. But when keeping only one B somekind of ppp compression would be good thing to have.
  • disadvantage of asterisk to RAS servers/routers you always request a 0x00 SPEECH call (so called Data-Over-Voice) and use data on it, you can't pass a 'bearer capability' request for "transparent data", and you can't add 5-ascii character name to link (it could be used to distgundish from many (multi-)ppp-links when only one DDI number is avalible, naming one call "prima" and other "deman" would be uselfull ). So basically your host/telco provider does consider your call as normal voice call.
  • Billing info: remeber that you are calling some numer, in Poland you cold have buissness group (i.e. say 2 B channels without charching for traffice between them). And charching for call could be expensive.

See also

Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

Created by: oej, Last modification: Thu 04 of Nov, 2010 (03:41 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+