Home |
Last modified: 15-07-2010 |
Important: To log stuff to the console, either use Verbose(), or use NoOp() but the latter will only work if you set "verbosity" to at least 3 (in the console, type "set verbose 3").
To set up Asterisk, several solutions are available:
Here are the latest infos I gathered on the X100P/X101P cards to explain why a lot of people have problems with this hardware:
Like a lot of people, I had very bad experience with clone X101P (glorified voice softmodems). Some have got them working OK (check www.x100p.com), but they're probably very country-specific (impendance.)
Stand-alone cards like those from Digium cost ten times more but are much better quality, but even those don't necessarily handle call information OK (caller ID, call progress), at least in countries other than the US. OpenVox makes cheaper clones of Digium cards.
Some experienced people say that external boxes (ie. SIP gateways) that do FXO/SIP aren't always that great either, especially lower-end models. They recommend against Digium hardware, and use Sangoma instead. Bottom line: Make sure you can return the product in case it doesn't work OK with your setup.
"X100P: If you have a new 3.3v only motherboard then make very sure that the brand that you buy supports this or your system will refuse to boot with the card inserted. A lot of X100P clone cards have the 3.3v notch in their PCI interface, but do not support 3.3v operation.
Most of the clone cards don't support far-end disconnect supervision, so you'll have problems where Asterisk can't tell that the other party has hung up the phone.
The X100 isn't all that bad, at least for a starter card. It can have issues with long loops, doesn't work well in the UK. If you already have a X100P at home, some echo problems and some spare time, take a look at http://www.rowetel.com/ucasterisk/oslec.html and http://www.rowetel.com/blog/?p=33 "
Includes MySQL support for call detail records and MP3 support for MOH.
In case of trouble, take a look at OpenVox's Troubleshooting of Analog cards
Used to disable loading modules causing trouble for Dahdi, eg. netjet
Once installed, Asterisk files can be located in the following directories:
Modules are located under /lib/modules/'uname -r'/misc (eg. wcfxo.o, zaptel.o, ztdummy.o, etc.)
By default, Asterisk loads a lot of stuff, and must be told explicitely not to load them through /etc/asterisk/modules.conf, using eg. noload => pbx_ael.so. Modules usually live under /usr/lib/asterisk/modules/.
Since Asterisk is often updated, packages found on the Net are usually a bit stale, and it's better to learn how to compile it yourself. Here are some tips I gathered:
Remove unneeded modules: /etc/asterisk/modules.conf
In sip.conf, make use of templates:
libpri even when not using an ISDN board? "Libpri provides the libraries required for using Primary Rate ISDN (PRI) trunks, as well as a number of other telephony interfaces. Even if we do not have a PRI line at this time, it is a good idea to install it, as it will not create any conflicts. Parts of the Asterisk code depend on the libraries included in the libpri package. Therefore, any time we install libpri, we should recompile Asterisk."
If our system is configured to start the Zaptel hardware at boot time, we can accomplish this by running:
$ /etc/init.d/zaptel stop
$ /etc/init.d/zaptel start
If, however, we elected not to start Zaptel interfaces at boot time, we can implement our changes as we go by running:
$ ztcfg -vvv
Remember: Changes to the file will not take effect until we have zaptel.confrestarted the drivers.
Zapata.conf is read by Asterisk. Therefore, to read changes made to this file, we can issue a reload in the Asterisk console. Zaptel will NOT have to be restarted to apply any changes we make in zapata.conf.
To test the card, run "zttest -c 10"
NEEDED? Load modules wcfxo (zaptel loaded automagically?)
NEEDED? echo "ztdummy" >> /etc/modules : "Zaptel "ticks" once per millisecond (1000 times per second). On each tick every active zaptel channel reads and 8 bytes of data. Asterisk also uses this for timing, through a zaptel pseudo channel it opens.
However, not all PBX systems are connected to a telephony provider via a T1 or similar connection. With an analog connection you are not synced to the other party. And some systems don't have Zaptel hardware at all. Even a digital card may be used for other uses or is simply not connected to a provider. Zaptel cards are also capable of providing timing from a clock on card. Cheap x100P clone cards are sometimes used for that pupose.
If all the above fail, you can use the module ztdummy to provide timing alone without needing any zaptel hardware. It will work with most systems and kernels.
You can check the zaptel timing source with zttest, which is a small utility that is included with zaptel. It runs in cycles. In each such cycle it tries to read 8192 bytes, and sees how long it takes. If zaptel is not loaded or you don't have the device files, it will fail immedietly. If you lack a timing device it will hang forever in the first cycle. Eitherwise it will just give you in each cycle the percent of how close it was. Also try running it with the option -v for a verbose output."
NEEDED? modprobe ztdummy (modprobe = insmod, rmmod)
Do you actually have any zaptel kernel modules loaded ?
lsmod
how to unload/reload zaptel? rmmod?
ubuntu*CLI> zap show channels
No such command 'zap show' (type 'help' for help)
zap show status
ztmonitor
The main method to configure Zaptel devices is using the utility *ztcfg*. ztcfg reads data from the configuration file /etc/zaptel.conf , figures out what configuration to send to channels, and send it.
is ztdummy automatically loaded when loading either zaptel or wcfxo? Zaptel timers for Asterisk, How to compile ztdummy
if ztcfg -vv = 0 channels configured. -> /etc/zaptel.conf
How to install asterisk from source on Debian
What do I do if I can't compile Zaptel package on my system ?
What is fxotune and how do I use it?
If an extension is behind a device performing Network Address Translation (NAT), such as a router or firewall,configure nat=yes to force Asterisk to ignore the contact information for the extension and use the address from which the packets are being received. Setting host=dynamic will require the extension to register so that Asterisk knows how to reach the phone. To limit an endpoint to a single IP address or fully qualified domain name (FQDN),replace dynamic with the IP address or domain name. Note that this limits only where you place calls to,as the user is allowed to place calls from anywhere (assuming she has authenticated successfully). If you set host=static, the end device is not required to register.
We’ve also set canreinvite=no. In SIP, invites are used to set up calls and to redirect media. Any invite issued after the initial invite in the same dialog is referred to as a reinvite. For example,suppose two parties are exchanging media traffic. If one client goes on hold and Asterisk is configured to play Music on Hold (MoH), Asterisk will issue a reinvite to the secondary client,telling it to redirect its media stream toward the PBX. Asterisk is then able to stream music or an announcement to the on-hold client. The primary client then issues an off-hold command in a reinvite to the PBX,which in turn issues a reinvite to the secondary party requesting that it redirect its media stream toward the primary party,thereby ending the on-hold music and reconnecting the clients.
Normally,when two endpoints set up a call they pass their media directly from one to the other. Asterisk generally breaks this rule by staying within the media path, allowing it to listen for digits dialed on the phone’s keypad. This is necessary because if Asterisk cannot determine the call length,inaccurate billing can occur. Configuring canreinvite=no forces Asterisk to stay in the media path,not allowing RTP messages to be exchanged directly between the endpoints."
Probably the biggest technical hurdle SIP has to conquer is the challenge of carrying out transactions across a NAT layer. Because SIP encapsulates addressing information in its data frames, and NAT happens at a lower network layer, the addressing information is not modified, and thus the media streams will not have the correct addressing information needed to complete the connection when NAT is in place. In addition to this, the firewalls normally integrated with NAT will not consider the incoming media stream to be part of the SIP transaction, and will block the connection."
;sip.conf
[general]
context=invalid ;Protection against someone calling in from the Net to use the PSTN line...
bindport=5060
bindaddr=0.0.0.0
srvlookup=yes
;VoIP provider
externip=1.2.3.4
nat=yes
localnet=192.168.0.0/24
qualify=yes
canreinvite=no
rtptimeout=60
rtpholdtimeout=300
dtmfmode=auto
disallow=all
allow=ulaw
allow=alaw
register => mylogin:test@voip.com
defaultexpirey=1800
[200]
;username=200
type=friend
secret=test
qualify=yes ; Qualify peer is no more than 2000 ms away
nat=no ; This phone is not natted
host=dynamic ; This device registers with us
canreinvite=no ; Asterisk by default tries to redirect
context=myinternal
See this.
"OpenBTS is an open-source Unix application that uses the Universal Software Radio Peripheral (USRP) to present a GSM air interface to standard GSM handset and uses the Asterisk software PBX to connect calls. The combination of the ubiquitous GSM air interface with VoIP backhaul could form the basis of a new type of cellular network that could be deployed and operated at substantially lower cost than existing technologies in greenfields in the developing world.
In plain language, we are working on a new kind of cellular network that can be installed and operated at about 1/10 the cost of current technologies, but that will still be compatible with most of the handsets that are already in the market. This technology can also be used in private network applications (wireless PBX, rapid deployment, etc.) at much lower cost and complexity than conventional GSM."
Echo, heard either at your end or the remote end, can have two causes:
More information:
The meat of Asterisk resides in extensions.conf, ie. the dialplan.
"An application is something that performs an action on a channel (such as playing a sound prompt, gathering DTMF input, putting the call into a call queue, etc.). A function, on the other hand, is used to get or set values, and doesn't directly manipulate the channel. These values *might* have something to do with the channel (such as is the case with the CDR function), but don't necessarily have to (such as is the case with the CUT and LEN functions).
You could also think of it as the difference between a procedure and a function. A procedure does something and returns nothing. A function may or may not be doing something, but its primary function is to return a value. Unlike other languages, in Asterisk, the return value of a function may not be directly ignored (i.e. you HAVE to get it, even if you do nothing with it). Of course, setting a dialplan function completely ruins this nice dichotomy. ;-)"
"An application is a "command" executed by a dialplan priority, such as Record, Verbose, TrySystem, etc. A function needs to be evaluated inside ${ } and returns a string value that is substitued in place of the ${ }."
"In addition to dialplan applications, which have been part of Asterisk almost from the very beginning, Asterisk also supports functions as of Asterisk 1.2. This is part of a long-standing effort to make Asterisk behave more like a programming environment.
In contrast to applications, functions may not be called directly. Instead, they are called inside applications and return a value, or -- in a departure from the classical definition of a function -- they may even be written to using the application Set() (see the section called “Set()”). Function names are always written in uppercase letters. Surprisingly, functions are written in the same way as variables, inside curly braces and preceded by a $ character ( ${} ). This is necessary because strings are not always bounded by quotation marks."
BLACKLIST BLACKLIST() Check if the callerid is on the blacklist
CUT CUT(<varname>,<char-delim>,<range-s Slices and dices strings, based upon a named delimiter.
DB DB(<family>/<key>) Read from or write to the Asterisk database
DB_DELETE DB_DELETE(<family>/<key>) Return a value from the database and delete it
DB_EXISTS DB_EXISTS(<family>/<key>) Check to see if a key exists in the Asterisk database
ENV ENV(<envname>) Gets or sets the environment variable specified
EVAL EVAL(<variable>) Evaluate stored variables.
EXISTS EXISTS(<data>) Existence Test: Returns 1 if exists, 0 otherwise
FIELDQTY FIELDQTY(<varname>|<delim>) Count the fields, with an arbitrary delimiter
FILTER FILTER(<allowed-chars>|<string>) Filter the string to include only the allowed characters
GLOBAL GLOBAL(<varname>) Gets or sets the global variable specified
IF IF(<expr>?[<true>][:<false>]) Conditional: Returns the data following '?' if true else the data following ':'
ISNULL ISNULL(<data>) NULL Test: Returns 1 if NULL or 0 otherwise
LANGUAGE LANGUAGE() Gets or sets the channel's language.
LEN LEN(<string>) Returns the length of the argument given
MATH MATH(<number1><op><number 2>[,<type Performs Mathematical Functions
MD5 MD5(<data>) Computes an MD5 digest
QUOTE QUOTE(<string>) Quotes a given string, escaping embedded quotes as necessary
RAND RAND([min][|max]) Choose a random number in a range
REGEX REGEX("<regular expression>" <data> Regular Expression
SET SET(<varname>=[<value>]) SET assigns a value to a channel variable
SHA1 SHA1(<data>) Computes a SHA1 digest
SORT SORT(key1:val1[...][,keyN:valN]) Sorts a list of key/vals into a list of keys, based upon the vals
SPRINTF SPRINTF(<format>|<arg1>[|...<argN>] Format a variable according to a format string
STAT STAT(<flag>,<filename>) Does a check on the specified file
STRFTIME STRFTIME([<epoch>][|[timezone][|for Returns the current date/time in a specified format.
STRPTIME STRPTIME(<datetime>|<timezone>|<for Returns the epoch of the arbitrary date/time string structured as described in the format.
TIMEOUT TIMEOUT(timeouttype) Gets or sets timeouts on the channel.
AGI: Executes an AGI compliant application
Answer: Answer a channel if ringing
BackGround: Play an audio file while waiting for digits of an extension to go to.
BackgroundDetect: Background a file with talk detect
Busy: Indicate the Busy condition
Congestion: Indicate the Congestion condition
ContinueWhile: Restart a While loop
DBdel: Delete a key from the database
DBdeltree: Delete a family or keytree from the database
Dial: Place a call and connect to the current channel
Echo: Echo audio, video, or DTMF back to the calling party
EndWhile: End a while loop
Exec: Executes dialplan application
ExecIf: Executes dialplan application, conditionally
ExitWhile: End a While loop
ExtenSpy: Listen to a channel, and optionally whisper into it
FollowMe: Find-Me/Follow-Me application
Gosub: Jump to label, saving return address
GosubIf: Conditionally jump to label, saving return address
Goto: Jump to a particular priority, extension, or context
GotoIf: Conditional goto
Hangup: Hang up the calling channel
HasNewVoicemail: Conditionally branches to priority + 101 with the right options set
HasVoicemail: Conditionally branches to priority + 101 with the right options set
LookupBlacklist: Look up Caller*ID name/number from blacklist database
LookupCIDName: Look up CallerID Name from local database
Macro: Macro Implementation
MacroExclusive: Exclusive Macro Implementation
MacroExit: Exit From Macro
MacroIf: Conditional Macro Implementation
MailboxExists: Check to see if Voicemail mailbox exists
NoOp: Do Nothing
Playback: Play a file
PrivacyManager: Require phone number to be entered, if no CallerID sent
Random: Conditionally branches, based upon a probability
Read: Read a variable
ReadFile: ReadFile(varname=file,length)
Record: Record to a file
Return: Return from gosub routine
Set: Set channel variable(s) or function value(s)
SetCallerID: Set CallerID
SetCallerPres: Set CallerID Presentation
SetGlobalVar: Set a global variable to a given value
System: Execute a system command
TryExec: Executes dialplan application, always returning
TrySystem: Try executing a system command
Verbose: Send arbitrary text to verbose output
VoiceMail: Leave a Voicemail message
VoiceMailMain: Check Voicemail messages
Wait: Waits for some time
WaitExten: Waits for an extension to be entered
WaitForSilence: Waits for a specified amount of silence
While: Start a while loop
(Source)
Note: For a long time, priority jumping was a standard way of moving a call about the dialplan. Specific applications (e.g. Dial()) would elevate the priority by 101 under certain circumstances. This feature is now officially deprecated. Basically, this means that while it is currently still supported, eventually it will be removed. Anyone who continues to use it is making their dialplans vulnerable to failure after an upgrade.
Here's an example of While/EndWhile:
Also look at ContinueWhile()
Here's how to check if a CID number is in the database, and branch to the right location depending on the result:
Here's how to check if a file exists, and branch to the right location:
Important: AGI scripts dump error messages to the Asterisk ’console’ session. If you started your session using normal init scripts, just attaching to it normally won’t show you these messages. You need to launch asterisk with the command ’asterisk -vvvvvvcr’. For debugging purposes you can type "agi debug" on the CLI.
(from some online source) New in Asterisk v1.2.11: GET VARIABLE can now retrieve global variables (see bug 7609)
New in Asterisk v1.2: CallerID is reported with agi_callerid and agi_calleridname instead of a single parameter holding both. The agi_callerid previously held the value "Name"<Number> and the agi_calleridname was not present. In v1.2, agi_callerid has Number and the agi_calleridname has Name.
Asterisk communicates with the AGI program over stdin and stdout. The arguments are passed directly to the AGI program at execution time.
The AGI program must be flagged as executable in the filesystem. The path is relative to the Asterisk AGI directory, which is at /var/lib/asterisk/agi-bin/ by default.
Returns -1 on hang-up or if the program requests a hang-up; returns 0 if not.
This application sets the following channel variable upon completion:
AGISTATUS
The status of the attempt to the run the AGI script text string, one of SUCCESS | FAILED | HANGUP
To run AGI programs on inactive channels (as in the case of an h-extension, where the channel is on-hook), used DeadAGI() instead. Should your AGI program need access to the incoming audio stream, use EAGI() instead of AGI(). The incoming audio stream is provided on file descriptor 3[47]
; run AGI on a hung-up channel:
exten => h,1,DeadAGI(agi-test)
asterisk*CLI> agi show
get variable Gets a channel variable
set callerid Sets callerid for the current channel
a reminder: 0: stdin, 1: stdout, 2:stderr. File descriptor 3 is freely assignable.
As an alternative you may execute PHP scripts using System(). See also. the section called “System()”, the section called “AGI()”
exten => 777,1,Set(CALLERIDNUM=1234567890)
exten => 777,n,ExecIf($[${LEN(${CALLERIDNUM})} = 10],AGI,/root/dummy.php,${CALLERIDNUM},param2)
; Retrieve http://example.com/page.php?id=1&action=view :
exten => 123,1,Set(foo=${CURL(http://example.com/page.php?id=1&action=view)})
(As of Asterisk 1.2.8, use a pipe ("|") character instead of commas as a parameter delimiter.)
; set HOME:
exten => 123,1,Set(ENV(HOME)=/myAst)
Here's an example of a Python script that can be called from Asterisk through AGI:
Here's an example of a command-line PHP script (the -q switch tells PHP not to return HTML headers) using an SQLite database and being called from Asterisk through the AGI application:
In addition to calling the Lua interpreter through the AGI interface to make it easier to write a diaplan application, Matt Nicholson from Digium added the pbx_lua module (/usr/lib/asterisk/modules/*so) in 2008 so you can use /etc/asterisk/extensions.lua instead of extensions.conf.
extensions.lua is more readable than extension.conf, but doesn't seem to add more syntax, so calling Lua scripts through AGI seems like a more interesting alternative.
Here's the plan to use Asterisk as an Interactive Voice Response, ie. an automated attendant:
CLI > database put cidname 12345 "John Smith"
CLI > database show cidname
Important: Do NOT add a file extension to specify the sound file format used for a file; Otherwise, you'll get this type of cryptic error:
Just use "test" instead of "test.wav", make sure this file is available in the different codecs supported by the caller as specified in sip.conf, and let Asterisk pick the right version.
Useful CLI commands:
Here's how to convert a WAV file into PCM (µ/A-Law), and have it played by Asterisk as music on hold:
To debug SIP, either launch Asterisk in console mode, or connect to a running Asterisk in console mode, and run either "sip debug" or "sip debug ip 192.168.0.1" if you just want to read SIP messages sent/received to that specific host. To disable debug mode, run "sip no debug". To see users and peers, run "sip show users" and "sip show peers", respectively. To tell Asterisk to reload its configuration files after you made changes, open an Asterisk console (asterisk -r), and run "reload" followed by "stop gracefully" (or "stop now" if there aren't ongoing calls.)
Some basic infos on how SIP works (from "Asterisk, the future of telephony"):
"The Session Initiation Protocol (SIP),often used in VoIP phones (either hard phones or soft phones),takes care of the setup and teardown of calls,along with any renegotiations during a call. Basically,it helps two endpoints talk to each other (if possible, directly to each other). SIP does not carry media; rather,it uses the Real-time Transport Protocol (RTP) to transfer the media directly between phone A and phone B once the call has been set up. We use the term media to refer to the data transferred between endpoints and used to reconstruct your voice at the other end. It may also refer to music or prompts from the PBX.
SIP is an application-layer signaling protocol that uses the well-known port 5060 for communications. SIP can be transported with either the UDP or TCP transport-layer protocols. Asterisk does not currently have a TCP implementation for transporting SIP messages,but it is possible that future versions may support it (and patches to the code base are gladly accepted). SIP is used to “establish,modify,and terminate multimedia sessions such as Internet telephony calls.” SIP does not transport media between endpoints. RTP is used to transmit media (i.e.,voice) between endpoints. RTP uses high-numbered, unprivileged ports in Asterisk (10,000 through 20,000, by default).
Domain Name System Service records (DNS SRV records) are a way of setting up a logical,resolvable address where you can be reached. This allows calls to be forwarded to different locations without the need to change the logical address. By using SRV records,you gain many of the advantages of DNS,whereas disabling them breaks the SIP RFC and removes the ability to place SIP calls based on domain names. (Note that if multiple records are returned,Asterisk will use only the first.) DNS SRV record lookups are disabled by default in Asterisk,but it’s highly recommended that you turn them on. To enable them,set srvlookup=yes in the [general] section of sip.conf.
Each connection is defined as a user,peer,or friend. A user type is used to authenticate incoming calls,a peer type is used for outgoing calls,and a friend type is used for both. The extension name is defined within square brackets ([]). In this case,we have defined the extension john as a friend.
If an extension is behind a device performing Network Address Translation (NAT), such as a router or firewall,configure nat=yes to force Asterisk to ignore the contact information for the extension and use the address from which the packets are being received. Setting host=dynamic will require the extension to register so that Asterisk knows how to reach the phone. To limit an endpoint to a single IP address or fully qualified domain name (FQDN),replace dynamic with the IP address or domain name. Note that this limits only where you place calls to,as the user is allowed to place calls from anywhere (assuming she has authenticated successfully). If you set host=static, the end device is not required to register.
We’ve also set canreinvite=no. In SIP, invites are used to set up calls and to redirect media. Any invite issued after the initial invite in the same dialog is referred to as a reinvite. For example,suppose two parties are exchanging media traffic. If one client goes on hold and Asterisk is configured to play Music on Hold (MoH), Asterisk will issue a reinvite to the secondary client,telling it to redirect its media stream toward the PBX. Asterisk is then able to stream music or an announcement to the on-hold client. The primary client then issues an off-hold command in a reinvite to the PBX,which in turn issues a reinvite to the secondary party requesting that it redirect its media stream toward the primary party,thereby ending the on-hold music and reconnecting the clients.
Normally,when two endpoints set up a call they pass their media directly from one to the other. Asterisk generally breaks this rule by staying within the media path, allowing it to listen for digits dialed on the phone’s keypad. This is necessary because if Asterisk cannot determine the call length,inaccurate billing can occur. Configuring canreinvite=no forces Asterisk to stay in the media path,not allowing RTP messages to be exchanged directly between the endpoints."
Asterisk SIP 'users' and 'peers' are have been the source of much confusion for Asterisk users. With newer versions of Asterisk the concept of SIP 'users' will be phased out.
Quotes from Kevin Fleming of Digium on Asterisk Mailing list Dec 23, 2005:
"SIP uses a challenge/response system to authenticate users. An initial INVITE is sent to the proxy with which the end device wishes to communicate. The proxy then sends back a 407 Proxy Authorization Request message, which contains a random set of characters referred to as a “nonce.” This nonce is used along with the password to generate an MD5 hash, which is then sent back in the subsequent INVITE. Assuming the MD5 hash matches the one that the proxy generated, the client is then authenticated.
Probably the biggest technical hurdle SIP has to conquer is the challenge of carrying out transactions across a NAT layer. Because SIP encapsulates addressing information in its data frames, and NAT happens at a lower network layer, the addressing information is not modified, and thus the media streams will not have the correct addressing information needed to complete the connection when NAT is in place. In addition to this, the firewalls normally integrated with NAT will not consider the incoming media stream to be part of the SIP transaction, and will block the connection."
"To get started, Asterisk will need its SIP server module running so that it can listen for SIP calls. By default, Asterisk's SIP server module listens on UDP port 5060, the commonly used port number for SIP. If you use the SIP phone (10.1.1.103) to dial the Asterisk server (10.1.1.10) by IP address, you should get a 404 message on the phone's display: 404 is a SIP error code that means "Not Found"just like the 404 message used on the Web. If you get this response from the Asterisk server, it means the SIP module is listening and has responded to you.
Now, in order to go from dialing only by IP address to dialing by extension, the IP phone must be pointed to the SIP server.
Until you authorize a SIP phone to communicate with Asterisk using Asterisk's SIP configuration file, you will always receive SIP error messages when trying to dial to (or through) the Asterisk server. Asterisk refers to IP phones and other SIP devices as peers. SIP peers are defined in Asterisk's configuration file, /etc/asterisk/sip.conf.In its default configuration, Asterisk has an autoattendant that can route calls using an automated attendant. To try it out, take the IP phone off hook and dial 2. Then dial Send. You will hear a friendly voice saying, "Asterisk is an open source, fully featured PBX and IVR platform..."
While listening to the automated attendant greeting, dial 500. This will cause the Asterisk server to greet you; connect you to a server at Digium, Inc., using the Internet; and allow you to listen to another automated greetingthe one being played back by a production Asterisk PBX at Digium's office. This connection does not use the PSTN at all, but rather a Voice over IP "trunk" that is set up on the fly by Asterisk.
The Voice over Internet demo requires UDP port 4569. If you're using a firewall or NAT device, be sure it permits outbound traffic on this port. Most home-grade firewalls will permit this type of traffic by default. The UDP port does not need to be inwardly mapped or proxied.
The connection to Digium is established using IAX, not SIP. So the Asterisk server is managing two different kinds of channels simultaneously in order to facilitate this call. Listen to the sound quality. Do you notice any difference between the quality of the autoattendant on your Asterisk server and the one on Digium's? The difference in quality should be negligible, if even noticeable, especially over a fast Internet connection.
You can also perform an echo test by dialing 600 and accessing Asterisk's built-in voice mail service by dialing 8500. These are covered in greater detail later.
The application responsible for providing music and messages for holding callers is called Mpg123, but don't confuse it with the Mpg321 application that ships with Red Hat Linux. Mpg321 doesn't work with Asterisk, so you must replace it with Mpg123.
Along with Mpg123, Asterisk uses the configuration file called /etc/asterisk/musiconhold.conf to define various "classes" of music-on-hold. Each class can be used in different situations or contexts depending on how the Asterisk administrator opts to handle each hold scenario. Mpg123 isn't required to deliver prerecorded sounds; Asterisk can do that on its own using files in the GSM-encoded format (and other telephony codec formats). What Mpg123 does is allow MP3 files to be played back for holding callers to listen to while they wait."
Si la plupart des gens connectent un combiné sur leur Freebox pour passer des appels (gratuits vers des fixes, payant vers des portables), Free propose également un mode SIP pour se connecter à leur serveur de téléphonie. Voici comment configurer les choses (source: http://www.freephonie.org/doku/tutoriel:asterisk):
"The Asterisk source contains a very important file named SECURITY, which outlines several steps you should take to keep your Asterisk systemsecure. It is vitally important that you read and understand this file. If you ignore the security precautions outlined there, you may end up allowing anyone and everyone to make long-distance or toll calls at your expense!"
There are several ways to monitor Asterisk. Most notably, the Asterisk CLI console application (asterisk -r) offers a real-time console log. When you launched Asterisk with the -v option, this was enabled. The more v's, the more detail goes into the console log. The same is true of the logfiles that Asterisk puts out.
In addition to standard output and standard error, which you can redirect using the shell, Asterisk has some important logfiles. They are stored in /var/log/asterisk by default.
The Asterisk Manager is a text-based socket API that allows management applications to monitor and control the Asterisk server. One such application is Astman, which is included in the Asterisk distribution. Astman allows you to watch a list of calls in progress and allows you to redirect calls and disconnect them.
Channels are logical pathways for voice connections at the application layer, just as TCP and UDP provide logical pathways for data transfer and the transport layer. Whenever an endpoint contacts the Asterisk server, a channel is established that remains open for the duration of the connection. If one endpoint calls another endpoint via the Asterisk softPBX, two channels are established one to each endpoint. If one endpoint calls another endpoint that is hosted by a completely separate Asterisk server, two channels on each server are established, meaning that, between the two servers, it required four channels to connect a single call. Astman can monitor the channels on only a single Asterisk server, though.
If you want to develop a more advanced version of Astman or create your own management or CTI (computer-telephony integration) applications, then the Asterisk Management API is the way to go. It's a text-based protocol that provides you with the ability to monitor the system, direct calls in progress, originate calls, and add or remove extensions.
Here's what I learned while installing AsteriskWin32 release 0.60 on a host running Windows 2003 Server. To my knowledge, this is the only port available for Windows. *Win32 is apparently managed by Patrick Deruel, and is updated about once a year.
Here's how to set it up to have a couple of SIP accounts into a ring group to be called by a VoIP gateway when a call comes in from the PSTN:
Here's the sip.conf and extensions.conf to create three SIP extensions (two for users, one for a Linksys VoIP gateway), and add a remote VoIP account for calling out:
=> Every minute, or so, server does this:
May 16 02:16:31 DEBUG[632] chan_sip.c: Stopping retransmission on '3dd817065abd672c0f18f87e5decf14b@192.168.0.2' of Request 102: Match Found
=> Every hour, this : remote X-Lite?
May 16 01:43:59 DEBUG[632] chan_sip.c: Auto destroying call 'OWUzMGJiMWZhZDJhOGQ2MTZjNTFkMmNmNjhkNDI0MDc.'
=> Every hour, Linksys 3102 and Linksys 921 do this:
May 15 20:01:21 DEBUG[632] chan_sip.c: Auto destroying call '52d3dd8a-437ae2bd@192.168.0.253'
May 15 19:03:25 DEBUG[632] chan_sip.c: Auto destroying call 'ae36c08a-f73d5d98@192.168.0.3'
=> Tried to call a Perl script when a call comes in, but...
exten => group,n,AGI(notify.agi|${CALLERID(num)}|${CALLERID(name)})
May 15 15:49:00 DEBUG[632] res_agi.c: winconsole 687308 agi script 20 stdin stdout 21 stderr 0 pid 392
AsteriskWin32 as Service : Crashed while doing nothing:
May 16 04:53:10 DEBUG[632] chan_sip.c: Stopping retransmission on '6a452a3560580aa22a1089646cbfe33d@192.168.0.2' of Request 102: Match Found
May 16 04:53:10 DEBUG[632] chan_sip.c: Stopping retransmission on '5e42a7b90a539f6232a98f0d689a0a78@192.168.0.2' of Request 102: Match Found
May 16 04:53:10 DEBUG[632] chan_sip.c: Stopping retransmission on '4598d2f5495119071812c6b7170d667c@192.168.0.2' of Request 102: Match Found
May 16 04:53:25 DEBUG[632] chan_sip.c: Auto destroying call '0E7C0C26D9CE4EE58C22B3716205D0450xc0a80034'
May 16 06:06:22 WARNING[632] channel.c: PTHREAD_KILL(SIGURG) softhangup_nolock on SIP/202-006a3470 !
May 16 06:06:22 DEBUG[632] channel.c: Didn't get a frame from channel: SIP/202-006a3470
May 16 06:06:22 DEBUG[632] channel.c: Bridge stops bridging channels SIP/203-0069df40 and SIP/202-006a3470
May 16 06:06:22 DEBUG[632] channel.c: Didn't get a frame from channel: SIP/202-00658810
The order in which you do the modprobe’s IS important. If you modprobe the FXO (modprobe wcfxo) card first then it will be channel 1, if you modprobe the FXS (modprobe wcfxs) card first then its first port will be channel 1, the second channel 2 and so on…
The order that the drivers are loaded will determine the channel assignments of the drivers. You must load the drivers in the appropriate order:
Next, when editing /etc/zaptel.conf, the lines setting a protocol to a channel (eg. fxsks=1) must match the order that the modules were modprobed:
A Useful Debugging Tip
The NoOp() application (No-Operation) is useful for debugging purposes. It can be used to echo information to the Asterisk console. For example, Zap channels don’t print the caller ID information on incoming calls, but we can do the following:
The CallerID information will then be output to the Asterisk console with of the predefined channel variable ${CALLERID}.
Incoming Zap channels are labeled simply:
Where <channel> is the channel number and <instance> is a number from 1 to 3 representing which of up to 3 logical channels associated with a single physical channel this is.
Running Asterisk is actually rather straight forward. Asterisk, if run with no arguments, is launched as a daemon process. Often, it is useful to execute Asterisk in a verbose, console mode, providing you with useful debugging and state information, as well as access to the powerful Asterisk command line interface.
Some important console mode commands:
When a call comes in on an FXO interface,you will want to perform some action. The action to be performed is configured inside a block of instructions called a context. Incoming calls on the FXO interface are directed to the incoming context with context=incoming. The instructions to perform inside the context are defined within extensions.conf.
The Session Initiation Protocol (SIP),often used in VoIP phones (either hard phones or soft phones),takes care of the setup and teardown of calls,along with any renegotiations during a call. Basically,it helps two endpoints talk to each other (if possible, directly to each other). SIP does not carry media; rather,it uses the Real-time Transport Protocol (RTP) to transfer the media* directly between phone A and phone B once the call has been set up.
SIP is an application-layer signaling protocol that uses the well-known port 5060 for communications. SIP can be transported with either the UDP or TCP transport-layer protocols. Asterisk does not currently have a TCP implementation for transporting SIP messages,but it is possible that future versions may support it (and patches to the code base are gladly accepted).
RTP is used to transmit media (i.e.,voice) between endpoints. RTP uses high-numbered, unprivileged ports in Asterisk (10,000 through 20,000, by default).
Domain Name System Service records (DNS SRV records) are a way of setting up a logical,resolvable address where you can be reached. This allows calls to be forwarded to different locations without the need to change the logical address. By using SRV records,you gain many of the advantages of DNS,whereas disabling them breaks the SIP RFC and removes the ability to place SIP calls based on domain names. (Note that if multiple records are returned,Asterisk will use only the first.) DNS SRV record lookups are disabled by default in Asterisk,but it’s highly recommended that you turn them on. To enable them,set srvlookup=yes in the [general] section of sip.conf.
The Inter-Asterisk eXchange (IAX) protocol is usually used for server-to-server communication; more hard phones are available that talk SIP. However,there are several soft phones that support the IAX protocol,and work is progressing on several fronts for hard phone support in firmware. The primary difference between the IAX and SIP protocols is the way media (your voice) is passed between endpoints. With SIP,the RTP (media) traffic is passed using different ports than those used by the signaling methods. For example,Asterisk receives the signaling of SIP on port 5060 and the RTP (media) traffic on ports 10,000 through 20,000, by default. The IAX protocol differs in that both the signaling and media traffic are passed via a single port: 4569. An advantage to this approach is that the IAX protocol tends to be better suited to topologies involving NAT.
The dialplan is truly the heart of any Asterisk system, as it defines how Asterisk handles inbound and outbound calls. In a nutshell, it consists of a list of instructions or steps that Asterisk will follow. The dialplan is made up of four main parts: contexts, extensions, priorities, and applications.
The Asterisk dialplan is specified in the configuration file named extensions.conf. The dialplan is made up of four main parts: contexts, extensions, priorities, and applications.
Dialplans are broken into sections called contexts. Contexts are named groups of extensions. Simply put, they keep different parts of the dialplan from interacting with one another. Contexts are denoted by placing the name of the context inside square brackets ([]). Caution: Spaces are not allowed!
At the beginning of the dialplan, there are two special contexts named [general] and [globals].
Within each context, we define one or more extensions. An extension is an instruction that Asterisk will follow, triggered by an incoming call or by digits being dialed on a channel. Extensions specify what happens to calls as they make their way through the dialplan.
The syntax for an extension is the word exten, followed by an arrow formed by the equals sign and the greater-than sign, like this: exten => . This is followed by the name of the extension.
When dealing with telephone systems, we tend to think of extensions as the numbers you would dial to make another phone ring. In Asterisk, you get a whole lot more—for example, extension names can be any combination of numbers and letters. Assigning names to extensions may seem like a revolutionary concept, but when you realize that many Voice-over-IP transports support (or even actively encourage) dialing by name or email address instead of by number, it makes perfect sense. This is one of the features that make Asterisk so flexible and powerful.
A complete extension is composed of three components:
These three components are separated by commas, like this: exten => 123,1,Answer( ) . In this example, the extension name is 123, the priority is 1, and the application is Answer( ).
Each extension can have multiple steps, called priorities. Each priority is numbered sequentially, starting with 1. Each priority executes one specific application. If you skip a priority, Asterisk will not continue past it.
Version 1.2 of Asterisk, however, adds a new twist to priority numbering. It introduces the use of the n priority, which stands for “next.” Each time Asterisk encounters a priority named n, it takes the number of the previous priority and adds 1. This makes it easier to make changes to your dialplan, as you don’t have to keep renumbering all your steps. For example, your dialplan might look something like this:
When calls enter a context without a specific destination extension (for example, a ringing FXO line), they are handled automatically by the s extension. (The s stands for “start,” as most calls start in the s extension.)
Here's to answer the phone, play a sound file, and hang up:
Here's how to tell the caller which digit was typed, or the number was invalid, and loop back to the beginning of the context. If the caller doesn't answer within 10 seconds (default), a sound file is played, and Asterisk hangs up:
... where the "i" priority stands of "invalid", and "t" stands for "time-out".
Here's how to ring a phone connected to the Zap/1 channel when a call comes in, play a sound file and hang up if the call times out (after 10 seconds in this example), or play a sound file and hang up if the phone is busy. If the extension is busy, Dial() jumps to priority n+101, ie. 102, here:
Here's how to route calls to either extension 101 (a handset connect to an FXS port) or 102 (an SIP phone):
If you wish to dial an external phone (eg. your cellphone or an SIP phone plugged into the Internet on the other side of the earth) when someone calls an extension:
Here's an additional context for use in the internal network. It doesn't matter what type of phone users use to make a call, whether it's a handset connect to an FXS port on the Asterisk PBX, an IP phone, or a softphone; they can all be configured to originate in this context:
A VoIP transport lets you dial names instead of numbers, hence the "john" and "jane" extensions above.
Global variables should be declared in the [globals] context at the beginning of the extensions.conf file:
They can also be defined programmatically, using the SetGlobalVar( ) application. Here is how both methods look inside of a dialplan:
A channel variable is a variable (such as the Caller*ID number) that is associated only with a particular call. Unlike global variables, channel variables are defined only for the duration of the current call and are available only to the channel participating in that call.
Many predefined channel variables are available (see /doc/README.variables in the Asterisk source.) Channel variables are set via the Set( ) application:
Environment variables are a way of accessing Unix environment variables from within Asterisk. These are referenced in the formof ${ENV(var)}, where var is the Unix environment variable you wish to reference.
Pattern matching to allow you to use one section of code for many different extensions. Patterns always start with an underscore _ . After the underscore, you can use one or more of the following characters:
To use pattern matching in your dialplan, simply put the pattern in the place of the extension name (or number):
Note that if Asterisk finds more than one pattern that matches the dialed extension, it will use the most specific one.
If you need to know what digits were dialed, read the ${EXTEN} channel variable. To have Asterisk read you the digits, you can use the SayDigits() application :
Here's how to let users dial internal extensions, as well as dial out by prepending the number with the familiar 9:
Important: For security’s sake you should always make sure that your [inbound] context never allows outbound dialing, as people could dial into your system, and then make outbound toll calls that would be charged to you.
Use $[] to run expressions:
Asterisk also supports operators like |, &, {=,>,<, etc.}:
In addition to applications, Asterisk supports functions:
Conditionnal branching:
Macros:
The voicemail configuration is defined in the configuration file called voicemail.conf. Here's a couple of examples:
.. and add this to extensions.conf:
Here's a list of applications available to include in a diaplan:
A call comes in on one of several channels (SIP in our case) and is "destined" for a dialed number. The Asterisk process first deals with the call via whatever channel it came in on, and learns what to do with it in that manner, and into what context to send the call in extensions.conf.
Now that sip.conf has told our call what context to go to, the control is handed over to the definitions created by the file extensions.conf. The extensions.conf file works by defining various "contexts," which are clusters of dialed-number matching statements. The context is the central building block of Asterisk, and, loosely, is used as one might use a subroutine. Within a context are a number of matching statements that perform match tests against the number being processed. The call is passed through the comparison list until a match is found.
Each context has a set of extension matches, which determine what applications should be triggered by the call, and how the call should be routed.
Wildcards can be used in extension mapping, and match strings beginning with the underscore character (_), meaning that the following portions of the match string include wildcard characters. Commonly used wildcards are N (digits 2-9), X (any digit), . (any number of digits), and a variety of regular-expression matching methods.
On an SIP-only setup, we only need to modify three files for our mini-PBX two-line system: sip.conf (this defines the SIP peers, which are the software or hardware SIP phones), extensions.conf (this is where the dialplans are kept -- the meat of the system), and voicemail.conf (where we define the voice mailboxes for each user).
Since only SIP channels are being used, we only need to modify three files for our mini-PBX two-line system:
Some users have reported successful use of voice modems instead of FXO cards, but you should limit yourselves to the few hardware-based modems left instead of win/softmodems, so that you won't be missing a Linux driver and save CPU cycles (digitizing and compressing incoming voice calls is work better left to peripherals.) For instance, an Asterisk user is happy with the Intel 56k Internal Modem, and recommends Intel-based hardware modems.
To broadcast caller ID from Asterisk to all hosts on the LAN (and beyond) http://www.voip-info.org/wiki/view/Asterisk+call+notification
Installation d'Asterisk sur un système Linux
"Il y a AMP (Asterisk Management Portal) qui est devenu maintenant FreePBX (http://asteriskvoip.blogspot.com/2006/03/freepbx-201-released.html)."
"Est-ce que qq a acheté récemment une vraie X100P (Chip Motorola) livrée avec les drivers ?"
" Dans le cas d'un systeme telephonique personnel, je conseillerai donc un asterisk VoIP pure avec un Sipura / Linksys SPA-3000 qui numerisera la ligne France Telecom avant de la renvoyer sur asterisk, et qui fait aussi office d'ATA 1 port. "
"Le PAP2 (comme le SPA-3000) n'est pas a considerer pour une utilisation professionel. C'est par contre un bon moyen de brancher des lignes qui servent peu a moindre cout ( 70 EUR pour 2 lignes )."
"Ces cartes ne sont plus produites par digium, et ont été remplacées par les cartes "TE", qui comme leur nom l'indique font T (US&Canada), E (EUR) et J (Japon).
T100P : Carte pour brancher un T1 E100P : Carte pour bancher un E1 T400P : Carte pour 4 T1 E400P : Carte pour 4 E1"
Windows versions: AsteriskWin32 and AstWind
AstLinux, a live CD built specifically for Asterisk (World's smallest VoIP PBX?)
Some kits are available:
Softphones are software VoIP clients, while IP phones are stand-alone handsets that connect to the LAN through an RJ45 cable without any need for a PC.
Asterisk consists of the following bits and pieces:
Here are the options I found if you want to build yourself a small form-factor Asterisk server. As for using a Compact Flash card to hold the whole system, ie. even logs and voice messages: "Just make sure your using an industrial compact flash card. These support 1-2 million cycles where many of the retail cards only support 100,000 cycles. We also greatly limit the logs being generated. Writing logs files creates many times more write cycles than voicemail ever could. If your concerned about logs use syslog to send them to an external system."
Since those hosts don't have much horse-power, avoid asking Asterisk to convert from one sound format to another. "show translation" shows the time needed to convert sound files, and gives an idea of performance.
To convert between different codec formats can you use the asterisk CLI command:
To convert from a shell script can you do like this:
http://www.pcengines.ch/alix.htm
Besides the motherboards, you need a CF as main storage device (it is mounted ro on /). You could also use a USB stick to mount /var in rw mode. Obviously you need even a power supply (sold by Pcengines).
"The IP04 is a 4 port IP-PBX that runs Asterisk and uClinux on a powerful embedded Blackfin processor. To build an Asterisk IP-PBX you normally need a x86 PC plus a PCI card for the analog ports. With the IP04 you get all of that functionality in a tiny, low cost, low power, silent box. uCasterisk is in the process of being deprecated. Astfin is the successor to uCasterisk, and where most Blackfin Asterisk software development is now focused."
http://linuxdevices.com/news/NS5862403213.html
http://linuxdevices.com/news/NS6530620277.html
PCI adaptor kit available for this thin client device.
Linux/Asterisk OpenWRT on a Linksys
WRTGS54SL
router (or Asus WL-500g series). The exisisting implementations of both
run very poorly on a non-fpu cpu's, especialy if clock speed < 400 Mhz
I have run asterisk (and still do) on mips,ixp and powerpc (all without
fpu's) and i think that without modifications the codecs are not so usable
Apparently
you can add a SD card interface to a WRT54g relatively easily. You could
also use something like a Linksys NSLU2 network storage device with a USB
memory stick in it.
Through USB port, add an SD Card/Memory Key/USB
Hard Drive. Check the Mitsubishi Diamond R100 (rebranched Asus WL-500g)
"I've been using a Linksys nslu2
(slug) as a lightweight asterisk server. It isn't a broadband router, but
it is cheap and works well. Add a usb flash/hdd"
http://www.voip-info.org/wiki/view/Asterisk+Linksys+NSLU2
http://en.wikipedia.org/wiki/NSLU2
"I have purchased a couple of the soekris net4801 boards and have asterisk up and running on them fine but they just don't quite cut it in the processing power department. I've been able to get about 10 simultaneous SIP calls with simple ulaw (no encoding decoding). While this might be OK for a very small business or home I just don't think it leaves a lot of overhead to do anything else.
Perhaps the new Soekris net5501 that is about to be released will help you?"
http://www.voip-info.org/wiki/view/Asterisk+hardware+Soekris
About 500E for a full host (motherboard, RAM, IDE hard disk, DVD drive, case).
Via Epia motherboard: I've built several systems based on this motherboard
(the 1GHz fanless one) Compressed codecs are fine - as long as you aren't
transcoding ;-) I figured I could push 30 non transcoded calls through one,
but I've never had the ability to fully test it out. The max. I had going
on one system was 20 calls. 5 calls to music on hold (where it's transcoding
from the GSM moh file to G711 is causing my R&D box (wich has a 533MHz
VIA processor with 64Kb cache) is using between 5 and 12% CPU. I'd expect
one of my 1Ghz boxes to hardly notice this at all.Make sure you compile
asterisk in i586 mode - it's in the Makefile in 1.2.x. It'll crash otherwise
as the VIA processors are lacking some vital MMX instructions. Boot it off
flash and have it load an initrd.gz into RAM. Everything will run entirely
from RAM - no writes to the flash at all! I can get everything inside a
48MB flash drive, but I use 64MB ones which gives me space to store configs,
etc.. (of-course, I make it sound so simple ;-) but I'd already worked this
out some years back for a diskless router project). I keep voicemail on
a 2nd flash IDE device mounted as ext2 (not 3 as ext3 writes regularly!)
Get
a low end motherboard, like a VIA EPIA that doesn't use much power and a
solid state hard drive. a CompactFlash card can be connected to IDE with
a simple adapter and used as a 'drive'. It is recommended to store logs
and stuff on another flash drive as flash memory wears down over time, this
way you don't lose any config files if/as/when it dies.
Moved here.
AskoziaPBX is derived from m0n0wall, is based on FreeBSD and, as of January 2008, runs Asterisk 1.4. Currently, it's off-limit to any customization, ie. you can't change the dialplan, and can't even get a login console when booting the CF card. Pretty much all you're allowed to do is add phone extensions to it.
To modify an AskoziaPBX image, you'll need a FreeBSD system to decompress and mount distribution images, and reflash the CF card.
Here's how to install Askozia on a Compact Flash card:
If you're having problems with Asterisk, here are some tricks to try:
If Asterisk is sitting behind a NAT router, and the phone is living on the outside, make sure sip.conf tells Asterisk that it's set up in a private network, and that UDP5060 is statically open on the router to allow remote phones to connect to Asterisk:
Resolving hangup detection problems with fxo cards
"Hint: if you are experiencing problems with echo on your analog calls, you may wish to uncomment the KFLAGS+=-DAGGRESSIVE_SUPPRESSOR line and run make clean; make; make install -- this enforces a more rapid echo interceptor for analog circuits."
If modeprobing wcfxo says something like..
... and dmesg says:
... this is most likely because the FXO card shares its interrupt with another PCI card. Go into the BIOS, and configure the slot so that it has its own IRQ. Run "lspci -v" to check if another card is sharing the IRQ.
Besides playing with the BIOS, you can launch Linux with the "pci=noacpi" switch ("interrupt problems are more likely on Linux 2.6 than 2.4 since the ACPI interface is more fully utilised. Try booting with acpi=off".) When OK, the FXO card should show up in /proc/zaptel/1 (or 2, etc.)
If using a Linux distro that uses the udevd daemon to dynamically populate /dev with device nodes, you must add some rules to /etc/udev/rules.d/50-udev.rules.
As specified in /etc/asterisk/asterisk.conf, modules are loaded from /etc/asterisk/modules.conf, but the binary might have been compiled to either look for modules elsewhere or (CHECK) have modules compiled directly in the asterisk binary.
Here's a working modules.conf:
Yes, by compiling it with support for Curl:
This can also be used to retrieve voicemail records. It's easier than using a database, reloading app_voicemail.so, or when removing a voicemail box. All the passwords are updated via the web server, so there is no need to update / write to the voicemail.conf file.
As of Jan 2008, either use the func_odbc() application, call a script with AGI(), or try the recent Asterisk cmd MYSQL add-on.
Remove the file extension:
Looks like recent versions of Linux no longer need the ztdummy kernel module to provide a software timing source in the absence of a hardware timing source.
In case it's still needed, and provided the "make install" or "make config" didn't already take care of business:
asterisk -V
This channel variable is set by Record() only if you use the %d trick to have it generate a new, sequential filename dynamically:
It apparently depends on the verbosity level. Use Verbose() instead.
This is just due to the fact that chan_zap cannot change the signalling of a channel when typing "reload" in the CLI. This parameter is ignored on reload.
1.2.2.: rtp.conf
rtpstart=
Takes a numeric value, which is the first port of the port range that can be used by asterisk to send and receive RTP.
rtpend=
Takes a numeric value, which is the last port of the port range that can be used by asterisk to send and receive RTP.
This is useful when either using an IP hardphone that only displays CID numbers (eg. the GrandStream BudgeTone 101), or when users simply don't have an extension and simply want to see who's calling. A good and free that does just is NetCID, the client-side of the great Identify caller ID application for Windows.
Here's how to configure Asterisk to broadcast a message when a call comes in, so NetCID can pick it up through its default UDP 42685 (more information):
The only issue I found is when using characters > 128, ie. non-basic ASCII characters: Show up OK in NetCID, but not in eg.X-Lite, but it's an issue with code pages when importing data into Asterisk to rewrite CID data on the fly through LookupCID().
Here's the Python version of the above Perl ncid.agi script:
This works because LookupCIDName looks for numbers in families cidname (and blacklisted numbers from the blacklist family). More information on using the database here.
Here are some useful commands that you can use while in an Asterisk console:
Here's how to call a PHP script from an AGI Perl script each time a call comes in:
And here's how to tell Asterisk to call the script:
Just hit CTRL-C or type "exit". "stop now" stops the server as well.
Because Zaptel cards actually predate Asterisk, so are not specifically built to run with this software. Once configured through zaptel.conf, a Zaptel card can be used by any application, not just Asterisk. Hence the need for zapata.conf to act as a glue between the Zaptel card and Asterisk.
"In the early days of Linux, the system’s /dev/ directory was populated with a list of devices with which the system could potentially interact. At the time, nearly 18,000 devices were listed. That all changed when devfs was released, allowing dynamic creation of devices that are active within the system. Some of the recently released distributions have incorporated the udev daemon into their systems to dynamically populate /dev/ with device nodes." (from "Asterisk, the future of telephony")
So-called Zaptel cards, ie. either the X100P or X101P cards, are cheaper because they essentially are so-called voice winmodems, ie. they need a driver to perform part of the work that real modems normally do themselves through an on-board CPU.
They're cheaper, and usable for a personal server, but shouldn't be considered for a professional server.For such servers, you should consider either...
"En fait, evite a tout prix les x100p - la qualite est degeulasse sur le reseau Francais du a une difference d'impedance (et il ne faut pas oublier qu'a la base c'est un modem...).
Avec les TDM400P et autre cartes analogique comme celle cite ci dessus, la qualite est du niveau d'une ligne analogique, acceptable mais vu qu'en France les lignes numeris coutent pour les professionels le meme prix que les ligne analogiques, il ne faut pas s'en priver! (Ligne Analogique : 16.80 EUR H.T./Mois, Acces de base isole (2 lignes) : 33.60 EUR H.T./Mois, presentation du numero et du nom comprise - tu as aussi numeris duo qui est la meme chose que l'acces de base isole avec un numero en + et un adaptateur analogique (pratique pour le fax))
L'ISDN (Numeris) est parfait pour tout ce qui est suivi d'appel, on peut voir sans problemes le status de la ligne (100, 183 call in progess etc.) et gerer ca correctement, avec l'analogique, c'est une autre histoire. De plus la qualite est bien meilleur, sur une connection numerique de bout en bout (ISDN vers ISDN ou ISDN vers VoIP ou VoIP vers ISDN), la qualite est generalement excelente)."
"Evite la x100p et desactive l'annulateur d'echo de la Freebox qui est une merde (prefix annulateur: 3699). Active l'annulateur d'echo au niveau d'asterisk."
"An FXO interface is thus named because it connects to an Office , where as an FXS interface, connects to a Station. The terms "FXO" and "FXS" have their origins in an old telephone service called Foreign eXchange (FX). The original purpose of an FX circuit was to allow an analog phone at a remote location to be connected to a PBX somewhere else. An FX circuit has two ends (the Station end, where the telephone is, and the Office end, where the PBX is)."
"The older X100P card used a Motorola chipset,and the X101P (which Digium sold before completely switching to the TDM400P) is based on the Ambient/Intel MD3200 chipset. These cards are modems with drivers adapted to utilize the card as a single FXO device (the telephone interface cannot be used as an FXS port). Support for the X101P card has been dropped in favor of the TDM series of cards. Use of these cards (or their clones) is not recommended in production environments."
"Asterisk uses the zapata.conf file to determine the settings and configuration for telephony hardware installed in the system. The zapata.conf file also controls the various features and functionality associated with the hardware channels,such as Caller ID, call waiting, echo cancellation, and a myriad of other options.
When you configure zaptel.conf and load the modules,Asterisk is not aware of anything you’ve configured. The hardware doesn’t have to be used by Asterisk; it could very well be used by another piece of software that interfaces with the Zaptel modules. You tell Asterisk about the hardware and control the associated features via zapata.conf."
STUN (Simple Traversal of UDP over NATs): Used so clients can tell on which ports they're listening behind a NAT firewall. Can be implemented in the firewall itself, or you can build a STUN server (which just echos back this information to the client).
"The Inter-Asterisk eXchange (IAX) protocol is usually used for server-to-server communication; more hard phones are available that talk SIP. However,there are several soft phones that support the IAX protocol,and work is progressing on several fronts for hard phone support in firmware.
The primary difference between the IAX and SIP protocols is the way media (your voice) is passed between endpoints. With SIP,the RTP (media) traffic is passed using different ports than those used by the signaling methods. For example,Asterisk receives the signaling of SIP on port 5060 and the RTP (media) traffic on ports 10,000 through 20,000, by default. The IAX protocol differs in that both the signaling and media traffic are passed via a single port: 4569. An advantage to this approach is that the IAX protocol tends to be better suited to topologies involving NAT."
> I then spent an additional $200(us) for the Wellgate 3701a (1FXS+1FXO) which, although horribly documented is a HUGE improvement over the Grandstream garbage (HT-488).
> So yeah, it gets expensive quickly. It's annoying that so many of the products are marginal or straight up garbage, but I guess we are still in the infancy of the standards based VOIP business, and many of the products are in search of a firmware update, or a decent manual.
modem use (fax and POS), and just hasn't failed in any way.
The Echo can in the Wellgate 3701a is clearly much better then the Grandstream one, but it still takes some number of seconds to train at the beginning of calls, which is kind of funky.
Install a SIP softphone, and dial out through Zap/2
http://www.experts-exchange.com/Networking/VoIP_Voice_over_IP/Q_21820311.html
http://www.asteriskguru.com/tutorials/resolving_hangup_detection_problems_fxo_tdm_voicemail.html
CLI > zap show channels
<lesouvage> joe_acme: it must be something like exten => s,n,DIAL(ZAP/g1/mobilephonenumber,15,r) in the extensions that handles the incoming call. You have to group the two fxo ports into one group to make this work.
ring groups
hunt groups
To see errors produced by the modprobe command, use the command dmesg. Other helpful error related information is avalable in any of the files created in the directory /proc/zaptel. Thiscommand, an these files, can help you diagnose errors in the zaptel configuration process, for example boards tha have not been provided with power or drivers that are loading in the wrong order.
The program ztcfg reads the configuration information in zaptel.conf and configures the drivers.You must run ztcfg each time zaptel driver are loaded, for example after booting the machine.You can run ztcfg after you have made any changes to zaptel.conf to reconfigure the drivers.