Need help getting started with Asterisk, please

What do you think of my question?

  • Stated roundabout or unclear
  • Stated in a clear and understandable way

0 voters

I am just getting started with Asterisk telephony. I would like to get started with a simple answering machine. I obtained a PCI card called “X100P” that is made specifically for Asterisk. I am able to configure everything up to the point of configuring /etc/zaptel.conf; using modprobe to load zaptel, wcfxo, and wcfxs; getting Channel 1 configured using the /sbin/ztcfg program; and actually monitoring the activity on the PSTN phone line using [/b]/usr/sbin/ztmonitor 1 -vv[/b]. I know how to run /usr/sbin/asterisk -vvvc and I am able to have a telephone session ONLY using OSS/dsp (the sound card as an emulated phone).

My problem is that I can’t get the asterisk program to do anything with the phone line, or to pick it up. :confused: I keep trying to see if it has the channel configured:

*CLI> channel list Channel Location State Application(Data) 0 active channels 0 active calls

I am kind of lost, and Asterisk seems to be extremely complicated. :confused: (I am technically inclined, but the vast amount of configuration files and the complexity of Asterisk will take some getting used to. :unamused: )

Here is the output from running /sbin/ztcfg -vv:

[code]$ sudo /sbin/ztcfg -vv

Zaptel Version: 1.4.0
Echo Canceller: MG2

Channel map:

Channel 01: FXS Kewlstart (Default) (Slaves: 01)

1 channels configured.[/code]

(Good news this is, I suppose. :smile: )

Here is what I added to the end of /etc/zaptel.conf:

loadzone=us defaultzone=us fxsks=1

My Linux system is Fedora Core 6, 64-bit (x86_64). (Everything was compiled in 64-bit, and actually I am trying to compile the new version after upgrading to FC6 from FC5 and now I can’t compile Asterisk at all. That’s for a different thread, though. :wink: )

I mostly went by online instructions to get thus far. Thanks in advance for any help in getting Asterisk to answer the line when it rings.

don’t see the need for a poll … do you want help or us to tell you what we thought of your question :unamused:

post your zapata.conf and the section in extensions.conf that corresponds with the context set in zapata.conf (if you have one) for the channel.

Oops… I thought polls were just an optional add-on to questions for people to give feedback.

Here is /etc/asterisk/zapata.conf:

; Zapata telephony interface
; Configuration file
; You need to restart Asterisk to re-configure the Zap channel
; CLI> reload
; will reload the configuration file,
; but not all configuration options are
; re-configured during a reload.

; Trunk groups are used for NFAS or GR-303 connections.
; Group: Defines a trunk group.
; trunkgroup => ,[,…]
; trunkgroup is the numerical trunk group to create
; dchannel is the zap channel which will have the
; d-channel for the trunk.
; backup1 is an optional list of backup d-channels.
;trunkgroup => 1,24,48
;trunkgroup => 1,24
; Spanmap: Associates a span with a trunk group
; spanmap => ,[,]
; zapspan is the zap span number to associate
; trunkgroup is the trunkgroup (specified above) for the mapping
; logicalspan is the logical span number within the trunk group to use.
; if unspecified, no logical span number is used.
;spanmap => 1,1,1
;spanmap => 2,1,2
;spanmap => 3,1,3
;spanmap => 4,1,4

; Default language
; Default context
; Switchtype: Only used for PRI.
; national: National ISDN 2 (default)
; dms100: Nortel DMS100
; 4ess: AT&T 4ESS
; 5ess: Lucent 5ESS
; euroisdn: EuroISDN
; ni1: Old National ISDN 1
; qsig: Q.SIG
; Some switches (AT&T especially) require network specific facility IE
; supported values are currently ‘none’, ‘sdn’, ‘megacom’, ‘tollfreemegacom’, ‘accunet’
; PRI Dialplan: Only RARELY used for PRI.
; unknown: Unknown
; private: Private ISDN
; local: Local ISDN
; national: National ISDN
; international: International ISDN
; dynamic: Dynamically selects the appropriate dialplan
; PRI Local Dialplan: Only RARELY used for PRI (sets the calling number’s numbering plan)
; unknown: Unknown
; private: Private ISDN
; local: Local ISDN
; national: National ISDN
; international: International ISDN
; dynamic: Dynamically selects the appropriate dialplan
; PRI callerid prefixes based on the given TON/NPI (dialplan)
; This is especially needed for euroisdn E1-PRIs
; sample 1 for Germany
;internationalprefix = 00
;nationalprefix = 0
;localprefix = 0711
;privateprefix = 07115678
;unknownprefix =
; sample 2 for Germany
;internationalprefix = +
;nationalprefix = +49
;localprefix = +49711
;privateprefix = +497115678
;unknownprefix =
; PRI resetinterval: sets the time in seconds between restart of unused
; channels, defaults to 3600; minimum 60 seconds. Some PBXs don’t like
; channel restarts. so set the interval to a very long interval e.g. 100000000
; or ‘never’ to disable entirely.
;resetinterval = 3600
; Overlap dialing mode (sending overlap digits)
; PRI Out of band indications.
; Enable this to report Busy and Congestion on a PRI using out-of-band
; notification. Inband indication, as used by Asterisk doesn’t seem to work
; with all telcos.
; outofband: Signal Busy/Congestion out of band with RELEASE/DISCONNECT
; inband: Signal Busy/Congestion using in-band tones
; priindication = outofband
; If you need to override the existing channels selection routine and force all
; PRI channels to be marked as exclusively selected, set this to yes.
; priexclusive = yes
; ISDN Timers
; All of the ISDN timers and counters that are used are configurable. Specify
; the timer name, and its value (in ms for timers).
; K: Layer 2 max number of outstanding unacknowledged I frames (default 7)
; N200: Layer 2 max number of retransmissions of a frame (default 3)
; T200: Layer 2 max time before retransmission of a frame (default 1000 ms)
; T203: Layer 2 max time without frames being exchanged (default 10000 ms)
; T305: Wait for DISCONNECT acknowledge (default 30000 ms)
; T308: Wait for RELEASE acknowledge (default 4000 ms)
; T309: Maintain active calls on Layer 2 disconnection (default -1, Asterisk clears calls)
; EuroISDN: 6000 to 12000 ms, according to (N200 + 1) x T200 + 2s
; May vary in other ISDN standards (Q.931 1993 : 90000 ms)
; T313: Wait for CONNECT acknowledge, CPE side only (default 3000 ms)
; pritimer => t200,1000
; pritimer => t313,4000
; To enable transmission of facility-based ISDN supplementary services (such
; as caller name from CPE over facility), enable this option.
; facilityenable = yes
; Signalling method (default is fxs). Valid values:
; em: E & M
; em_w: E & M Wink
; featd: Feature Group D (The fake, Adtran style, DTMF)
; featdmf: Feature Group D (The real thing, MF (domestic, US))
; featdmf_ta: Feature Group D (The real thing, MF (domestic, US)) through
; a Tandem Access point
; featb: Feature Group B (MF (domestic, US))
; fgccama Feature Group C-CAMA (DP DNIS, MF ANI)
; fgccamamf Feature Group C-CAMA MF (MF DNIS, MF ANI)
; fxs_ls: FXS (Loop Start)
; fxs_gs: FXS (Ground Start)
; fxs_ks: FXS (Kewl Start)
; fxo_ls: FXO (Loop Start)
; fxo_gs: FXO (Ground Start)
; fxo_ks: FXO (Kewl Start)
; pri_cpe: PRI signalling, CPE side
; pri_net: PRI signalling, Network side
; gr303fxoks_net: GR-303 Signalling, FXO Loopstart, Network side
; gr303fxsks_cpe: GR-303 Signalling, FXS Loopstart, CPE side
; sf: SF (Inband Tone) Signalling
; sf_w: SF Wink
; sf_featd: SF Feature Group D (The fake, Adtran style, DTMF)
; sf_featdmf: SF Feature Group D (The real thing, MF (domestic, US))
; sf_featb: SF Feature Group B (MF (domestic, US))
; e911: E911 (MF) style signalling
; The following are used for Radio interfaces:
; fxs_rx: Receive audio/COR on an FXS kewlstart interface (FXO at the
; channel bank)
; fxs_tx: Transmit audio/PTT on an FXS loopstart interface (FXO at the
; channel bank)
; fxo_rx: Receive audio/COR on an FXO loopstart interface (FXS at the
; channel bank)
; fxo_tx: Transmit audio/PTT on an FXO groundstart interface (FXS at
; the channel bank)
; em_rx: Receive audio/COR on an E&M interface (1-way)
; em_tx: Transmit audio/PTT on an E&M interface (1-way)
; em_txrx: Receive audio/COR AND Transmit audio/PTT on an E&M interface
; (2-way)
; em_rxtx: Same as em_txrx (for our dyslexic friends)
; sf_rx: Receive audio/COR on an SF interface (1-way)
; sf_tx: Transmit audio/PTT on an SF interface (1-way)
; sf_txrx: Receive audio/COR AND Transmit audio/PTT on an SF interface
; (2-way)
; sf_rxtx: Same as sf_txrx (for our dyslexic friends)
; If you have an outbound signalling format that is different from format
; specified above (but compatible), you can specify outbound signalling format,
; (see below). The ‘signalling’ format specified will be the inbound signalling
; format. If you only specify ‘signalling’, then it will be the format for
; both inbound and outbound.
; signalling=featdmf
; outsignalling=featb
; For Feature Group D Tandem access, to set the default CIC and OZZ use these
; parameters:
; A variety of timing parameters can be specified as well
; Including:
; prewink: Pre-wink time (default 50ms)
; preflash: Pre-flash time (default 50ms)
; wink: Wink time (default 150ms)
; flash: Flash time (default 750ms)
; start: Start time (default 1500ms)
; rxwink: Receiver wink time (default 300ms)
; rxflash: Receiver flashtime (default 1250ms)
; debounce: Debounce timing (default 600ms)
rxwink=300 ; Atlas seems to use long (250ms) winks
; How long generated tones (DTMF and MF) will be played on the channel
; (in milliseconds)
; Whether or not to do distinctive ring detection on FXO lines
;distinctiveringaftercid=yes ; enable dring detection after callerid for those countries like Australia
; where the ring cadence is changed after the callerid spill.
; Whether or not to use caller ID
; Type of caller ID signalling in use
; bell = bell202 as used in US
; v23 = v23 as used in the UK
; v23_jp = v23 as used in Japan
; dtmf = DTMF as used in Denmark, Sweden and Netherlands
; smdi = Use SMDI for callerid. Requires SMDI to be enabled (usesmdi).
; What signals the start of caller ID
; ring = a ring signals the start
; polarity = polarity reversal signals the start
; Whether or not to hide outgoing caller ID (Override with *67 or 82)
; Whether or not to enable call waiting on internal extensions
; With this set to ‘yes’, busy extensions will hear the call-waiting
; tone, and can use hook-flash to switch between callers. The Dial()
; app will not return the “BUSY” result for extensions.
; Whether or not restrict outgoing caller ID (will be sent as ANI only, not
; available for the user)
; Mostly use with FXS ports
; Whether or not use the caller ID presentation for the outgoing call that the
; calling switch is sending.
; See README.callingpres
; Some countries (UK) have ring tones with different ring tones (ring-ring),
; which means the callerid needs to be set later on, and not just after
; the first ring, as per the default.
; Support Caller
ID on Call Waiting
; Support three-way calling
; Support flash-hook call transfer (requires three way calling)
; Also enables call parking (overrides the ‘canpark’ parameter)
; Allow call parking
; (‘canpark=no’ is overridden by ‘transfer=yes’)
; Support call forward variable
; Whether or not to support Call Return (*69)
; Stutter dialtone support: If a mailbox is specified without a voicemail
; context, then when voicemail is received in a mailbox in the default
; voicemail context in voicemail.conf, taking the phone off hook will cause a
; stutter dialtone instead of a normal one.
; If a mailbox is specified with a voicemail context, the same will result
; if voicemail received in mailbox in the specified voicemail context.
; for default voicemail context, the example below is fine:
; for any other voicemail context, the following will produce the stutter tone:
; Enable echo cancellation
; Use either “yes”, “no”, or a power of two from 32 to 256 if you wish to
; actually set the number of taps of cancellation.
; Note that if any of your Zaptel cards have hardware echo cancellers,
; then this setting only turns them on and off; numeric settings will
; be treated as “yes”. There are no special settings required for
; hardware echo cancellers; when present and enabled in their kernel
; modules, they take precedence over the software echo canceller compiled
; into Zaptel automatically.
; Generally, it is not necessary (and in fact undesirable) to echo cancel when
; the circuit path is entirely TDM. You may, however, change this behavior
; by enabling the echo cancel during pure TDM bridging below.
; In some cases, the echo canceller doesn’t train quickly enough and there
; is echo at the beginning of the call. Enabling echo training will cause
; asterisk to briefly mute the channel, send an impulse, and use the impulse
; response to pre-train the echo canceller so it can start out with a much
; closer idea of the actual echo. Value may be “yes”, “no”, or a number of
; milliseconds to delay before training (default = 400)
; WARNING: In some cases this option can make echo worse! If you are
; trying to debug an echo problem, it is worth checking to see if your echo
; is better with the option set to yes or no. Use whatever setting gives
; the best results.
; Note that these parameters do not apply to hardware echo cancellers.
; If you are having trouble with DTMF detection, you can relax the DTMF
; detection parameters. Relaxing them may make the DTMF detector more likely
; to have “talkoff” where DTMF is detected when it shouldn’t be.
; You may also set the default receive and transmit gains (in dB)
; Logical groups can be assigned to allow outgoing rollover. Groups range
; from 0 to 63, and multiple groups can be specified.
; Ring groups (a.k.a. call groups) and pickup groups. If a phone is ringing
; and it is a member of a group which is one of your pickup groups, then
; you can answer it by picking up and dialling *8#. For simple offices, just
; make these both the same. Groups range from 0 to 63.

; Specify whether the channel should be answered immediately or if the simple
; switch should provide dialtone, read digits, etc.
; Specify whether flash-hook transfers to ‘busy’ channels should complete or
; return to the caller performing the transfer (default is yes).
; CallerID can be set to “asreceived” or a specific number if you want to
; override it. Note that “asreceived” only applies to trunk interfaces.
; AMA flags affects the recording of Call Detail Records. If specified
; it may be ‘default’, ‘omit’, ‘billing’, or ‘documentation’.
; Channels may be associated with an account code to ease
; billing
; ADSI (Analog Display Services Interface) can be enabled on a per-channel
; basis if you have (or may have) ADSI compatible CPE equipment
; SMDI (Simplified Message Desk Interface) can be enabled on a per-channel
; basis if you would like that channel to behave like an SMDI message desk.
; The SMDI port specified should have already been defined in smdi.conf. The
; default port is /dev/ttyS0.
; On trunk interfaces (FXS) and E&M interfaces (E&M, Wink, Feature Group D
; etc, it can be useful to perform busy detection either in an effort to
; detect hangup or for detecting busies. This enables listening for
; the beep-beep busy pattern.
; If busydetect is enabled, it is also possible to specify how many busy tones
; to wait for before hanging up. The default is 4, but better results can be
; achieved if set to 6 or even 8. Mind that the higher the number, the more
; time that will be needed to hangup a channel, but lowers the probability
; that you will get random hangups.
; If busydetect is enabled, it is also possible to specify the cadence of your
; busy signal. In many countries, it is 500msec on, 500msec off. Without
; busypattern specified, we’ll accept any regular sound-silence pattern that
; repeats times as a busy signal. If you specify busypattern,
; then we’ll further check the length of the sound (tone) and silence, which
; will further reduce the chance of a false positive.
; NOTE: In the Asterisk Makefile you’ll find further options to tweak the busy
; detector. If your country has a busy tone with the same length tone and
; silence (as many countries do), consider defining the
; Use a polarity reversal to mark when a outgoing call is answered by the
; remote party.
; In some countries, a polarity reversal is used to signal the disconnect of a
; phone line. If the hanguponpolarityswitch option is selected, the call will
; be considered “hung up” on a polarity reversal.
; On trunk interfaces (FXS) it can be useful to attempt to follow the progress
; of a call through RINGING, BUSY, and ANSWERING. If turned on, call
; progress attempts to determine answer, busy, and ringing on phone lines.
; This feature is HIGHLY EXPERIMENTAL and can easily detect false answers,
; so don’t count on it being very accurate.
; Few zones are supported at the time of this writing, but may be selected
; with “progzone”
; This feature can also easily detect false hangups. The symptoms of this is
; being disconnected in the middle of a call for no reason.
; FXO (FXS signalled) devices must have a timeout to determine if there was a
; hangup before the line was answered. This value can be tweaked to shorten
; how long it takes before Zap considers a non-ringing line to have hungup.
; For FXO (FXS signalled) devices, whether to use pulse dial instead of DTMF
; For fax detection, uncomment one of the following lines. The default is OFF
; This option specifies a preference for which music on hold class this channel
; should listen to when put on hold if the music class has not been set on the
; channel with Set(CHANNEL(musicclass)=whatever) in the dialplan, and the peer
; channel putting this one on hold did not suggest a music class.
; If this option is set to “passthrough”, then the hold message will always be
; passed through as signalling instead of generating hold music locally. This
; setting is only valid when used on a channel that uses digital signalling.
; This option may be specified globally, or on a per-user or per-peer basis.
; This option specifies which music on hold class to suggest to the peer channel
; when this channel places the peer on hold. It may be specified globally or on
; a per-user or per-peer basis.
; PRI channels can have an idle extension and a minunused number. So long as
; at least “minunused” channels are idle, chan_zap will try to call “idledial”
; on them, and then dump them into the PBX in the “idleext” extension (which
; is of the form exten@context). When channels are needed the “idle” calls
; are disconnected (so long as there are at least “minidle” calls still
; running, of course) to make more channels available. The primary use of
; this is to create a dynamic service, where idle channels are bundled through
; multilink PPP, thus more efficiently utilizing combined voice/data services
; than conventional fixed mappings/muxings.
; Configure jitter buffers in zapata (each one is 20ms, default is 4)
;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
; jbenable = yes ; Enables the use of a jitterbuffer on the receiving side of a
; ZAP channel. Defaults to “no”. An enabled jitterbuffer will
; be used only if the sending side can create and the receiving
; side can not accept jitter. The ZAP channel can’t accept jitter,
; thus an enabled jitterbuffer on the receive ZAP side will always
; be used if the sending side can create jitter.

; jbmaxsize = 200 ; Max length of the jitterbuffer in milliseconds.

; jbresyncthreshold = 1000 ; Jump in the frame timestamps over which the jitterbuffer is
; resynchronized. Useful to improve the quality of the voice, with
; big jumps in/broken timestamps, usually sent from exotic devices
; and programs. Defaults to 1000.

; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a ZAP
; channel. Two implementations are currently available - “fixed”
; (with size always equals to jbmax-size) and “adaptive” (with
; variable size, actually the new jb of IAX2). Defaults to fixed.

; jblog = no ; Enables jitterbuffer frame logging. Defaults to “no”.
; You can define your own custom ring cadences here. You can define up to 8
; pairs. If the silence is negative, it indicates where the callerid spill is
; to be placed. Also, if you define any custom cadences, the default cadences
; will be turned off.
; Syntax is: cadence=ring,silence[,ring,silence[…]]
; These are the default cadences:
; Each channel consists of the channel number or range. It inherits the
; parameters that were specified above its declaration.
; For GR-303, CRV’s are created like channels except they must start with the
; trunk group followed by a colon, e.g.:
; crv => 1:1
; crv => 2:1-2,5-8
;callerid=“Green Phone”<(256) 428-6121>
;channel => 1
;callerid=“Black Phone”<(256) 428-6122>
;channel => 2
;callerid=“CallerID Phone” <(256) 428-6123>
;callerid=“CallerID Phone” <(630) 372-1564>
;callerid=“CallerID Phone” <(256) 704-4666>
;channel => 3
;callerid=“Pac Tel Phone” <(256) 428-6124>
;channel => 4
;callerid=“Uniden Dead” <(256) 428-6125>
;channel => 5
;callerid=“Cortelco 2500” <(256) 428-6126>
;channel => 6
;callerid=“Main TA 750” <(256) 428-6127>
;channel => 44
; For example, maybe we have some other channels which start out in a
; different context and use E & M signalling instead.
;channel => 15
;channel => 16

; All those in group 0 I’ll use for outgoing calls
; Strip most significant digit (9) before sending
;channel => 45

;callerid=“Joe Schmoe” <(256) 428-6131>
;channel => 25
;callerid=“Megan May” <(256) 428-6132>
;channel => 26
;callerid=“Suzy Queue” <(256) 428-6233>
;channel => 27
;callerid=“Larry Moe” <(256) 428-6234>
;channel => 28
; Sample PRI (CPE) config: Specify the switchtype, the signalling as either
; pri_cpe or pri_net for CPE or Network termination, and generally you will
; want to create a single “group” for all channels of the PRI.
; switchtype = national
; signalling = pri_cpe
; group = 2
; channel => 1-23


; Used for distinctive ring support for x100p.
; You can see the dringX patterns is to set any one of the dringXcontext fields
; and they will be printed on the console when an inbound call comes in.
; If no pattern is matched here is where we go.
;channel => 1

channel => 1[/code]

Here is /etc/asterisk/extensions.conf:

[code]; extensions.conf - the Asterisk dial plan
; Static extension configuration file, used by
; the pbx_config module. This is where you configure all your
; inbound and outbound calls in Asterisk.
; This configuration file is reloaded
; - With the “extensions reload” command in the CLI
; - With the “reload” command (that reloads everything) in the CLI

; The “General” category is for certain variables.
; If static is set to no, or omitted, then the pbx_config will rewrite
; this file when extensions are modified. Remember that all comments
; made in the file will be lost when that happens.
; XXX Not yet implemented XXX
; if static=yes and writeprotect=no, you can save dialplan by
; CLI command ‘save dialplan’ too
; If autofallthrough is set, then if an extension runs out of
; things to do, it will terminate the call with BUSY, CONGESTION
; or HANGUP depending on Asterisk’s best guess. This is the default.
; If autofallthrough is not set, then if an extension runs out of
; things to do, Asterisk will wait for a new extension to be dialed
; (this is the original behavior of Asterisk 1.0 and earlier).
; If clearglobalvars is set, global variables will be cleared
; and reparsed on an extensions reload, or Asterisk reload.
; If clearglobalvars is not set, then global variables will persist
; through reloads, and even if deleted from the extensions.conf or
; one of its included files, will remain set to the previous value.
; If priorityjumping is set to ‘yes’, then applications that support
; ‘jumping’ to a different priority based on the result of their operations
; will do so (this is backwards compatible behavior with pre-1.2 releases
; of Asterisk). Individual applications can also be requested to do this
; by passing a ‘j’ option in their arguments.
; User context is where entries from users.conf are registered. The
; default value is ‘default’
; You can include other config files, use the #include command
; (without the ‘;’). Note that this is different from the “include” command
; that includes contexts within other contexts. The #include command works
; in all asterisk configuration files.
;#include “filename.conf”

; The “Globals” category contains global variables that can be referenced
; in the dialplan with the GLOBAL dialplan function:
; ${${GLOBAL(VARIABLE)}} or ${text${GLOBAL(VARIABLE)}} or any hybrid
; Unix/Linux environmental variables can be reached with the ENV dialplan
; function: ${ENV(VARIABLE)}
CONSOLE=Console/dsp ; Console interface for demo
IAXINFO=guest ; IAXtel username/password
TRUNK=Zap/g2 ; Trunk interface
; Note the ‘g2’ in the TRUNK variable above. It specifies which group (defined
; in zapata.conf) to dial, i.e. group 2, and how to choose a channel to use in
; the specified group. The four possible options are:
; g: select the lowest-numbered non-busy Zap channel
; (aka. ascending sequential hunt group).
; G: select the highest-numbered non-busy Zap channel
; (aka. descending sequential hunt group).
; r: use a round-robin search, starting at the next highest channel than last
; time (aka. ascending rotary hunt group).
; R: use a round-robin search, starting at the next lowest channel than last
; time (aka. descending rotary hunt group).
TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0)

; Any category other than “General” and “Globals” represent
; extension contexts, which are collections of extensions.
; Extension names may be numbers, letters, or combinations
; thereof. If an extension name is prefixed by a ‘_’
; character, it is interpreted as a pattern rather than a
; literal. In patterns, some characters have special meanings:
; X - any digit from 0-9
; Z - any digit from 1-9
; N - any digit from 2-9
; [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9)
; . - wildcard, matches anything remaining (e.g. _9011. matches
; anything starting with 9011 excluding 9011 itself)
; ! - wildcard, causes the matching process to complete as soon as
; it can unambiguously determine that no other matches are possible
; For example the extension _NXXXXXX would match normal 7 digit dialings,
; while _1NXXNXXXXXX would represent an area code plus phone number
; preceded by a one.
; Each step of an extension is ordered by priority, which must
; always start with 1 to be considered a valid extension. The priority
; “next” or “n” means the previous priority plus one, regardless of whether
; the previous priority was associated with the current extension or not.
; The priority “same” or “s” means the same as the previously specified
; priority, again regardless of whether the previous entry was for the
; same extension. Priorities may be immediately followed by a plus sign
; and another integer to add that amount (most useful with ‘s’ or ‘n’).
; Priorities may then also have an alias, or label, in
; parenthesis after their name which can be used in goto situations
; Contexts contain several lines, one for each step of each
; extension, which can take one of two forms as listed below,
; with the first form being preferred. One may include another
; context in the current one as well, optionally with a
; date and time. Included contexts are included in the order
; they are listed.
;exten => someexten,{priority|label{+|-}offset}[(alias)],application(arg1,arg2,…)
;exten => someexten,{priority|label{+|-}offset}[(alias)],application,arg1|arg2…
; Timing list for includes is
; |||
; Note that ranges may be specified to wrap around the ends. Also, minutes are
; fine-grained only down to the closest even minute.
;include => daytime|9:00-17:00|mon-fri||
;include => weekend||sat-sun||*
;include => weeknights|17:02-8:58|mon-fri||
; ignorepat can be used to instruct drivers to not cancel dialtone upon
; receipt of a particular pattern. The most commonly used example is
; of course ‘9’ like this:
;ignorepat => 9
; so that dialtone remains even after dialing a 9.

; Sample entries for extensions.conf
; List canonical entries here
;exten => 12564286000,1,Macro(std-exten,6000,IAX2/foo)
;exten => _125642860XX,1,Dial(IAX2/otherbox/${EXTEN:7})

; If you are an ITSP or Reseller, list your customers here.
;exten => _12564286000,1,Dial(SIP/customer1)
;exten => _12564286001,1,Dial(IAX2/customer2)

; If you are freely delivering calls to the PSTN, list them here
;exten => _1256428XXXX,1,Dial(Zap/g2/${EXTEN:7}) ; Expose all of 256-428
;exten => _1256325XXXX,1,Dial(Zap/g2/${EXTEN:7}) ; Ditto for 256-325

; Context to put your dundi IAX2 or SIP user in for
; full access
include => dundi-e164-canonical
include => dundi-e164-customers
include => dundi-e164-via-pstn

; Just a wrapper for the switch
switch => DUNDi/e164

; Locally to lookup, try looking for a local E.164 solution
; then try DUNDi if we don’t have one.
include => dundi-e164-local
include => dundi-e164-switch
; DUNDi can also be implemented as a Macro instead of using
; the Local channel driver.
; ARG1 is the extension to Dial
; Extension “s” is not a wildcard extension that matches “anything”.
; In macros, it is the start extension. In most other cases,
; you have to goto “s” to execute that extension.
; For wildcard matches, see above - all pattern matches start with
; an underscore.
exten => s,1,Goto(${ARG1},1)
include => dundi-e164-lookup

; Here are the entries you need to participate in the IAXTEL
; call routing system. Most IAXTEL numbers begin with 1-700, but
; there are exceptions. For more information, and to sign
; up, please go to or
exten => _91700XXXXXXX,1,Dial(IAX2/${GLOBAL(IAXINFO)}${EXTEN:1}@iaxtel)

; The SWITCH statement permits a server to share the dialplan with
; another server. Use with care: Reciprocal switch statements are not
; allowed (e.g. both A -> B and B -> A), and the switched server needs
; to be on-line or else dialing can be severly delayed.
;switch => IAX2/user:[key]@myserver/mycontext

; International long distance through trunk
exten => _9011.,1,Macro(dundi-e164,${EXTEN:4})
exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})

; Long distance context accessed through trunk
exten => _91NXXNXXXXXX,1,Macro(dundi-e164,${EXTEN:1})

; Local seven-digit dialing accessed through trunk interface

; Long distance context accessed through trunk interface
exten => _91800NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91888NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91877NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91866NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})

; Master context for international long distance
ignorepat => 9
include => longdistance
include => trunkint

; Master context for long distance
ignorepat => 9
include => local
include => trunkld

; Master context for local, toll-free, and iaxtel calls only
ignorepat => 9
include => default
include => trunklocal
include => iaxtel700
include => trunktollfree
include => iaxprovider

;Include parkedcalls (or the context you define in features conf)
;to enable call parking.
include => parkedcalls
; You can use an alternative switch type as well, to resolve
; extensions that are not known here, for example with remote
; IAX switching you transparently get access to the remote
; Asterisk PBX
; switch => IAX2/user:password@bigserver/local
; An “lswitch” is like a switch but is literal, in that
; variable substitution is not performed at load time
; but is passed to the switch directly (presumably to
; be substituted in the switch routine itself)
; lswitch => Loopback/12${EXTEN}@othercontext
; An “eswitch” is like a switch but the evaluation of
; variable substitution is performed at runtime before
; being passed to the switch routine.
; eswitch => IAX2/context@${CURSERVER}

; Standard trunk dial macro (hangs up on a dialstatus that should
; terminate call)
; ${ARG1} - What to dial
exten => s,1,Dial(${ARG1})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Hangup
exten => s-BUSY,1,Hangup
exten => _s-.,1,NoOp

; Standard extension macro:
; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well
; ${ARG2} - Device(s) to ring
exten => s,1,Dial(${ARG2},20) ; Ring the interface, 20 seconds maximum
exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)

exten => s-NOANSWER,1,Voicemail(${ARG1},u) ; If unavailable, send to voicemail w/ unavail announce
exten => s-NOANSWER,2,Goto(default,s,1) ; If they press #, return to start

exten => s-BUSY,1,Voicemail(${ARG1},b) ; If busy, send to voicemail w/ busy announce
exten => s-BUSY,2,Goto(default,s,1) ; If they press #, return to start

exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer

exten => a,1,VoicemailMain(${ARG1}) ; If they press *, send the user into VoicemailMain

; Standard extension macro:
; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well
; ${ARG2} - Device(s) to ring
; ${ARG3} - Optional DONTCALL context name to jump to (assumes the s,1 extension-priority)
; ${ARG4} - Optional TORTURE context name to jump to (assumes the s,1 extension-priority)`
exten => s,1,Dial(${ARG2},20|p) ; Ring the interface, 20 seconds maximum, call screening
; option (or use P for databased call screening)
exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)

exten => s-NOANSWER,1,Voicemail(${ARG1},u) ; If unavailable, send to voicemail w/ unavail announce
exten => s-NOANSWER,2,Goto(default,s,1) ; If they press #, return to start

exten => s-BUSY,1,Voicemail(${ARG1},b) ; If busy, send to voicemail w/ busy announce
exten => s-BUSY,2,Goto(default,s,1) ; If they press #, return to start

exten => s-DONTCALL,1,Goto(${ARG3},s,1) ; Callee chose to send this call to a polite “Don’t call again” script.

exten => s-TORTURE,1,Goto(${ARG4},s,1) ; Callee chose to send this call to a telemarketer torture script.

exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer

exten => a,1,VoicemailMain(${ARG1}) ; If they press *, send the user into VoicemailMain

; Paging macro:
; Check to see if SIP device is in use and DO NOT PAGE if they are
; ${ARG1} - Device to page

exten => s,1,ChanIsAvail(${ARG1}|js) ; j is for Jump and s is for ANY call
exten => s,n,GoToIf([${AVAILSTATUS} = “1”]?autoanswer:fail)
exten => s,n(autoanswer),Set(_ALERT_INFO=“RA”) ; This is for the PolyComs
exten => s,n,SIPAddHeader(Call-Info: Answer-After=0) ; This is for the Grandstream, Snoms, and Others
exten => s,n,NoOp() ; Add others here and Post on the Wiki!!!
exten => s,n,Dial(${ARG1}||)
exten => s,n(fail),Hangup

; We start with what to do when a call first comes in.
exten => s,1,Wait(1) ; Wait a second, just for fun
exten => s,n,Answer ; Answer the line
exten => s,n,Set(TIMEOUT(digit)=5) ; Set Digit Timeout to 5 seconds
exten => s,n,Set(TIMEOUT(response)=10) ; Set Response Timeout to 10 seconds
exten => s,n(restart),BackGround(demo-congrats) ; Play a congratulatory message
exten => s,n(instruct),BackGround(demo-instruct) ; Play some instructions
exten => s,n,WaitExten ; Wait for an extension to be dialed.

exten => 2,1,BackGround(demo-moreinfo) ; Give some more information.
exten => 2,n,Goto(s,instruct)

exten => 3,1,Set(LANGUAGE()=fr) ; Set language to french
exten => 3,n,Goto(s,restart) ; Start with the congratulations

exten => 1000,1,Goto(default,s,1)
; We also create an example user, 1234, who is on the console and has
; voicemail, etc.
exten => 1234,1,Playback(transfer,skip) ; “Please hold while…”
; (but skip if channel is not up)
exten => 1234,n,Macro(stdexten,1234,${GLOBAL(CONSOLE)})

exten => 1235,1,Voicemail(1234,u) ; Right to voicemail

exten => 1236,1,Dial(Console/dsp) ; Ring forever
exten => 1236,n,Voicemail(1234,b) ; Unless busy

; # for when they’re done with the demo
exten => #,1,Playback(demo-thanks) ; "Thanks for trying the demo"
exten => #,n,Hangup ; Hang them up.

; A timeout and “invalid extension rule”
exten => t,1,Goto(#,1) ; If they take too long, give up
exten => i,1,Playback(invalid) ; “That’s not valid, try again”

; Create an extension, 500, for dialing the
; Asterisk demo.
exten => 500,1,Playback(demo-abouttotry); Let them know what’s going on
exten => 500,n,Dial(IAX2/ ; Call the Asterisk demo
exten => 500,n,Playback(demo-nogo) ; Couldn’t connect to the demo site
exten => 500,n,Goto(s,6) ; Return to the start over message.

; Create an extension, 600, for evaluating echo latency.
exten => 600,1,Playback(demo-echotest) ; Let them know what’s going on
exten => 600,n,Echo ; Do the echo test
exten => 600,n,Playback(demo-echodone) ; Let them know it’s over
exten => 600,n,Goto(s,6) ; Start over

; You can use the Macro Page to intercom a individual user
exten => 76245,1,Macro(page,SIP/Grandstream1)
; or if your peernames are the same as extensions
exten => _7XXX,1,Macro(page,SIP/${EXTEN})
; System Wide Page at extension 7999
exten => 7999,1,Set(TIMEOUT(absolute)=60)
exten => 7999,2,Page(Local/Grandstream1@page&Local/Xlite1@page&Local/1234@page/n|d)

; Give voicemail at extension 8500
exten => 8500,1,VoicemailMain
exten => 8500,n,Goto(s,6)
; Here’s what a phone entry would look like (IXJ for example)
;exten => 1265,1,Dial(Phone/phone0,15)
;exten => 1265,n,Goto(s,5)

; The page context calls up the page macro that sets variables needed for auto-answer
; It is in is own context to make calling it from the Page() application as simple as
; Local/{peername}@page
exten => _X.,1,Macro(page,SIP/${EXTEN})

; Example “main menu” context with submenu
;exten => s,1,Answer
;exten => s,n,Background(thanks) ; “Thanks for calling press 1 for sales, 2 for support, …”
;exten => s,n,WaitExten
;exten => 1,1,Goto(submenu,s,1)
;exten => 2,1,Hangup
;include => default
;exten => s,1,Ringing ; Make them comfortable with 2 seconds of ringback
;exten => s,n,Wait,2
;exten => s,n,Background(submenuopts) ; “Thanks for calling the sales department. Press 1 for steve, 2 for…”
;exten => s,n,WaitExten
;exten => 1,1,Goto(default,steve,1)
;exten => 2,1,Goto(default,mark,2)

; By default we include the demo. In a production system, you
; probably don’t want to have the demo there.
include => demo

; An extension like the one below can be used for FWD, Nikotel, sipgate etc.
; Note that you must have a [sipprovider] section in sip.conf
;exten => _41X.,1,Dial(SIP/${EXTEN:2}@sipprovider,r)

; Real extensions would go here. Generally you want real extensions to be
; 4 or 5 digits long (although there is no such requirement) and start with a
; single digit that is fairly large (like 6 or 7) so that you have plenty of
; room to overlap extensions and menu options without conflict. You can alias
; them with names, too, and use global variables

;exten => 6245,hint,SIP/Grandstream1&SIP/Xlite1,Joe Schmoe ; Channel hints for presence
;exten => 6245,1,Dial(SIP/Grandstream1,20,rt) ; permit transfer
;exten => 6245,n(dial),Dial(${HINT},20,rtT) ; Use hint as listed
;exten => 6245,n,Voicemail(6245,u) ; Voicemail (unavailable)
;exten => 6245,s+1,Hangup ; s+1, same as n
;exten => 6245,dial+101,Voicemail(6245,b) ; Voicemail (busy)
;exten => 6361,1,Dial(IAX2/JaneDoe,rm) ; ring without time limit
;exten => 6389,1,Dial(MGCP/aaln/1@
;exten => 6390,1,Dial(JINGLE/caller/callee) ; Dial via jingle using labels
;exten => 6391,1,Dial(JINGLE/ ;Dial via jingle using asterisk as the transport and calling mogorman.
;exten => 6394,1,Dial(Local/6275/n) ; this will dial ${MARK}

;exten => 6275,1,Macro(stdexten,6275,${MARK}) ; assuming ${MARK} is something like Zap/2
;exten => mark,1,Goto(6275|1) ; alias mark to 6275
;exten => 6536,1,Macro(stdexten,6236,${WIL}) ; Ditto for wil
;exten => wil,1,Goto(6236|1)

;If you want to subscribe to the status of a parking space, this is
;how you do it. Subscribe to extension 6600 in sip, and you will see
;the status of the first parking lot with this extensions’ help
;exten => 6600,hint,park:701@parkedcalls
;exten => 6600,1,noop
; Some other handy things are an extension for checking voicemail via
; voicemailmain
;exten => 8500,1,VoicemailMain
;exten => 8500,n,Hangup
; Or a conference room (you’ll need to edit meetme.conf to enable this room)
;exten => 8600,1,Meetme(1234)
; Or playing an announcement to the called party, as soon it answers
;exten = 8700,1,Dial(${MARK},30,A(/path/to/my/announcemsg))
; For more information on applications, just type “show applications” at your
; friendly Asterisk CLI prompt.
; 'show application ’ will show details of how you
; use that particular application in this file, the dial plan.
; 'show functions" will list all dialplan functions
; 'show function ’ will show you more information about
; one function. Remember that function names are UPPER CASE.[/code]

What should I do next?

woah there dont post the whole file :smile:

i assume you configured everything right, and you can pick up the phone line by typing Dial zap/1 or something at the console, but you are unsure where to go next to make asterisk not suck-

here is the hardest thing for any * noob to get and something that isn’t made immediately obvious, also happens to be the most important thing with *-


what that means- a channel (zap/1, SIP/myphone, SIP/provider, etc) is an interface which asterisk can get or send a call to. It is NOT something that can be dialed, you can make an exten SIP/1234 but that does not mean dialing 1234 will ring that exten.

This is where extensions.conf comes in, putting the two together. an entry in extensions.conf is where you dial something, and that can include plugging into another channel.

In extensions.conf you have [contexts]. each context is a group of extensions you can dial. Every channel is ‘in’ a context and can only dial things in it. The ‘s’ extension is the ‘start’ exten, which is where otherwise unhandled calls will go.

So in zapata.conf define a context, say myline
then make it in extensions.conf

exten => s,1,Wait(20) ; Wait 20 seconds to see if you pick up
exten => s,2,Answer() ; pick up the line
exten => s,3,VoiceMail(1234@vmcontext) ; go to 1234 @ vmcontext, voicemail.conf has its own contexts too. default is fine so you could do 1234@default.

Also consider reading the book Asterisk: The Future of Telephony. You can get the dead-tree version from O’Rilley or download under creative commons license from
Also look into the wiki site there is much asterisk info there and many questions can be answered.

Hope that helps!

Thank you for the explanation :smile:

I was able to download the O’Reilly book. It says it’s for the (now) old version of Asterisk, 1.2, but it should still be reliable for future versions. Do you think I should still use it for 1.4? I hope so because it appears very informative.

I tried using the command you gave me in several ways. I must not have the context, channel, or console configured correctly (forgive me if I’m using those words incorrectly; I’ll catch on soon). The “active device” of the console is always dsp and I can’t change it. When I do a sample dial session, it says OSS/dsp.

Here is what I tried and the output:

Asterisk Ready. *CLI> dial zap/1 No such extension 'zap/1' in context 'default' The 'dial' command is deprecated and will be removed in a future release. Please use 'console dial' instead. *CLI> console dial zap/1 Usage: console active [device] If used without a parameter, displays which device is the current console. If a device is specified, the console sound device is changed to the device specified. *CLI> console active active console is [dsp] *CLI> console active zap/1 Usage: console active [device] If used without a parameter, displays which device is the current console. If a device is specified, the console sound device is changed to the device specified. *CLI> console active zap Usage: console active [device] If used without a parameter, displays which device is the current console. If a device is specified, the console sound device is changed to the device specified.

What do I do in order to either get Asterisk to pick up the PSTN line (channel) OR to answer when it rings? What changes should I make to zapata.conf, zaptel.conf, or extensions.conf? I’m hoping that once I can get it to do one of these things initially, I will be more easily able to learn the rest.

Thanks :smile:

book should mostly be relevant for 1.4, although I think 1.2 is a bit more stable at the moment. Its up to you tho.

do what i suggested to extensions.conf.

zapata.conf defines what context the zap channels are ‘in’, then you make that context in extensions.conf and put stuff in it.

so when a call comes in, it does
okay we have an incoming call on zap/1. zap/1 is in the context [mycontext] so we are going to start with mycontext,s,1. S,1 says to wait for 20 seconds so we wait
(20 seconds later)
okay on to the next one, it says to answer (asterisk siezes the line)
okay on to the next one, it says to run the app VoiceMail() to 1234@default, so VoiceMail() executes and lets the caller record voicmeail for 1234@default.