• Installing and configuring Asterisk telephony in Linux Ubuntu. IP telephony from scratch. Installing AsteriskNOW

    Asterisk is the solution for computer telephony open source that supports VoIP, SIP and PJSIP protocols for the Linux operating system. If you connect the appropriate equipment to your computer, then using Asterisk you can create full-fledged station ATC. Among the main features of the program are voice mail, conferences, interactive voice menu and call distribution.

    In this article we will look at how to install Asterisk 13 on Ubuntu 16.04. The newest version of the program is not in the official repositories, since it is not used by ordinary users so often, so we will have to build it from source.

    Installing Asterisk on Ubuntu 16.04

    To build from sources, we will need to perform most of the actions on behalf of the superuser, so we will immediately get full rights in the system:

    Please note that if you log into your server via ssh as root, you will still have to connect as regular user, and only then switch to the root console. Next you need to install dependencies for the program to work:

    apt-get install build-essential wget libssl-dev libncurses5-dev libnewt-dev libxml2-dev linux-headers-$(uname -r) libsqlite3-dev uuid-dev git subversion

    cd /usr/src
    $ wget downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz

    To unpack the sources, type:

    tar zxvf asterisk-13-current.tar.gz

    Before compiling the program, we need to build and install pjproject. First, download the sources:

    git clone git://github.com/asterisk/pjproject pjproject
    $ cd pjproject
    $ ./configure --prefix=/usr --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr CFLAGS="-O2 -DNDEBUG"
    $ make dep make && make install
    $ldconfig
    $ ldconfig -p|grep pj

    Finally, we are now ready to build and install Asterisk on Ubuntu 16.04:

    cd .. contrib/scripts/get_mp3_source.sh
    $ contrib/scripts/install_prereq install

    These commands will allow you to install some dependencies for playing mp3. It may take some time to complete and you will also need to enter a country code. Next we begin the assembly:

    ./configure && make menuselect && make && make install

    When the installation is complete, run the following command to avoid creating hundreds of configuration files manually:

    To install init scripts that will allow asterisk to start automatically, run:

    make config ldconfig

    Now you can start the asterisk server and make sure that everything really works:

    service asterisk start

    And look at the information about the utility through the terminal:

    If everything was done correctly and the installation of Asterisk on Ubuntu 16.04 was successful, then everything will work.

    Setting up Asterisk on Ubuntu 16.04

    The program runs as superuser. But we need it to be able to run as the asterisk user, so we need to do a few more settings. This way your system will be more secure. First you need to stop the running service:

    groupadd asterisk
    $ useradd -d /var/lib/asterisk -g asterisk asterisk

    Next we need to change the initialization script so that the program is launched as the desired user. We can edit the /etc/default/asterisk file manually, but it is easier to use the following commands:

    sed -i "s/#AST_USER="asterisk"/AST_USER="asterisk"/g" /etc/default/asterisk
    $ sed -i "s/#AST_GROUP="asterisk"/AST_GROUP="asterisk"/g" /etc/default/asterisk

    In order for everything to work correctly, the asterisk user needs to be given access to all program directories:

    chown -R asterisk:asterisk /var/spool/asterisk /var/run/asterisk /etc/asterisk /var/(lib,log,spool)/asterisk /usr/lib/asterisk

    We will also indicate correct settings user for the runuser and rungroup fields in the asterisk.conf file:

    sed -i "s/;runuser = asterisk/runuser = asterisk/g" /etc/asterisk/asterisk.conf

    $ sed -i "s/;rungroup = asterisk/rungroup = asterisk/g" /etc/asterisk/asterisk.conf

    When everything is ready, start the previously stopped service or reboot if you haven’t stopped it:

    sudo service asterisk start

    Then we check:

    If the user and group are asterisk, then we did everything right.

    Conclusions

    That's all. Installation of Asterisk 13 on Ubuntu 16.04 is complete. Now you can proceed to further network setup to make calls between your subscribers directly via the Internet. As client software, you can use any program that supports the required protocols, for example Jitsi or Linphone.

    About the author

    Founder and administrator of the site, I am passionate about open software and the Linux operating system. I currently use Ubuntu as my main OS. In addition to Linux, I am interested in everything related to information technology and modern science.

    What needs to be done before installation Refer to the section if you need to install a PBX that must cope with a heavy load, and you are not sure whether your software and hardware will handle it. Operating systems: the Asterisk server works great on Linux systems, this has also been done great job members of the project to port Asterisk server to BSD platforms, including FreeBSD, OpenBSD and Mac OS X. However, the zaptel driver and ISDN channel drivers may not be supported on these platforms. Refer to the Operating Systems for Asterisk Server section for operating system-specific information. Alternatively, you can use the methods described on the pages below: Asterisk Install CDROM Asterisk Bootable CDROM Quick Installation Instructions Read the 10-Minute Overview of Asterisk Server , if you want to know what the Asterisk server can do. Otherwise, you can skip this section. Read the section Step-by-step instructions for installing Asterisk, where you will find information from setting up Linux to the first phone call to worm your Asterisk. http://www.automated.it/guidetoasterisk.htm http://asterisk.net.au/ Installation guide for Asterisk server from the guru of this matter System requirements You do not need any specific equipment to install and run the Asterisk server. Need for sound card no. You need to install the following software packages before compiling Asterisk: Kernel sources.h files for your kernel (kernel headers) bison (needed to process expressions in the file) Packages: openssl and openssl-dev or libssl-devlibnewt: required for the astman management interface to work. It is not required for the Asterisk server, but without this package you will not have the astman application, which is a separate program. You no longer need to install the "readline" and "readline-devel" packages for Asterisk. The server comes with its own implementation of the "readline" package, called "editline". If you plan to use add-ons to work with the mysql database, install the packages for mysql, mysql_devel & mysql server. If you plan to use interface cards from Digium, then you will need to install the module kernels to support the Zaptel device driver before you can use them in Asterisk. However, you may want to first download and install Asterisk - test the operation of SIP and IAX phones - and only after that add support for your Digium cards. Installation See the section "Operating systems on which the Asterisk server runs" for additional instructions, which depend on the operating system used. How to get an Asterisk server Asterisk timer: needed for the MeetMe conference and for IAX2 trunks. Preparing third-party utilities Pay attention to the utilities section third-party developers on the main dedicated page for information about the following applications:
    Music-on-hold: Using mpg123voicemail: This requires sendmail to send email notifications. call detail recording: The Asterisk server can record this information in CSV files, in a PostgreSQL database, or in SQLite. Pay attention to the asterisk_addons package from SVN .odbc: for storing and retrieving data from other databases (other than MySQL). speex codec: installation of additional libraries is required. Speech synthesizer: Festival Speech recognition: integration with the Sphinx application.

    Good afternoon, in this article I will tell you how to install the most popular server VoIP telephony Asterisk. By using of this server You can organize telephony in the office, at home, or implement automatic notification, but I will talk about this in other articles. And so let's start installing asterisk on the ubuntu server.

    Installing Asterisk on Ubuntu Server is extremely simple, you only need one command:


    sudo apt-get install asterisk

    The first thing after installing Asterisk is to disable the ability to receive calls anonymously. To do this, open the sip.conf file and uncomment the line allowguest=no, since by default it is Yes. By the way, to search for a given line in nano, you can press Ctrl+W and enter the desired part of the line and press Enter; if there are several such words in the text, then to continue the search, press Ctrl+W and Enter.


    sudo nano /etc/asterisk/sip.conf

    In the same file we can indicate VoIP providers and our internal subscribers. I use the operator it-sekret, since it has cheap calls it-sekret.ru. To do this, add at the end of the file

    For the operator:

    Type=peer context=it-sekret host=xxx.it-sekret.ru username=USERNAME secret=PASSWORD fromuser=USERNAME nat=force_rport insecure=port,invite

    If the operator needs constant registration, for example for incoming calls, then you need to write this line

    Register => userID: [email protected]/userID

    Where userID is the username issued by the operator and PASSWORD is the password, xxx.it-sekret.ru the server address issued by the operator.

    Create an internal subscriber:

    Type=friend context=internal host=dynamic username=1001 secret=1234

    After adding these entries, save the file and exit. In order to apply the settings, you must either restart the server or tell it to re-read the settings. This method is better, because if your server is active, then the calls that are currently in progress will not be interrupted.


    sudo asterisk -r
    reload
    Setting up a phone or softphone

    Now let's set up the phone or softphone. I'm using X-lite softphones quite a lot, you can use it to your taste. Configure X-lite settings as shown in the screenshot.

    To check the correctness of the settings in the Asterisk CLI (hereinafter simply CLI), run the sip show peers command

    Setting up Asterisk dialing rules (Dial plan)

    First of all, let's make a copy of the original extension.conf file


    sudo mv /etc/asterisk/extensions.conf
    /etc/asterisk/extensions.conf.bak

    Now in extension.conf we will write a rule for an outgoing call.


    sudo nano /etc/asterisk/extensions.conf exten => _X.,1,Dial(SIP/it-sekret/$(EXTEN))

    In the CLI, run the reload command to apply the settings. And now let's try to make a call.

    The call went through, now we need to set it up incoming call. To do this, you need to write a dialing rule.


    sudo nano /etc/asterisk/extensions.conf exten => s,1,Dial(SIP/1001)

    On this easy setup ends, in the following articles I will tell you how to record conversations, set up IVR, make a CallBack from the site and much more.

    23.02.2012 15:56

    An article that allows novice programmers to perform basic asterisk setup

    Asterisk is one of the most common IP telephony servers, along with systems such as Switchwox and 3CX. This system has gained great popularity with the spread of high-quality Internet in our country, as well as many telephone providers providing telephone numbers in SIP format or so-called SIP numbers. One of such companies is Datagroup, which has established itself as one of the leaders in the communication services market. With SIP numbers becoming cheaper, it makes sense to use modern telephone systems IP telephony instead of the old analogue mini-PBX. This is due to the wide functionality call centers based on Asterisk. At the same time, the cost of equipment and setting up Asterisk is practically not inferior in monetary costs.

    Installing asterisk is done by downloading and then compiling the freely distributed source code developed by Digium. asterisk sources exist only for unix-compatible operating systems, the most common of which are Linux and FreeBSD. Installing asterisk under Windows is only possible by implementing a virtual machine. You can download the latest versions of asterisk from the following link. At the moment, 4 versions of this server are being developed. The versions asterisk 1.4 and asterisk 1.6 have the greatest stability of all modules. On the other hand, in terms of functionality, version asterisk 1.8 compares favorably, which has support for many new modules and functions, including support for the SRTP protocol, work with IPv6 and improved performance when working with SIP and ISDN.

    This article will discuss installing asterisk v 1.6.22 on Linux Fedora Core.

    To start the installation, download the asterisk sources. To do this, run the commands in the server console:

    # wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.6.2.22.tar.gz

    # tar -xzvf asterisk-1.6.2.22.tar.gz

    Before compiling the sources, let’s install all the necessary accompanying modules and utilities:

    # yum install gcc

    # yum install gcc-c++

    # yum install make

    # yum install libxml2-devel

    # yum install ncurses-devel

    After all additional utilities are installed, we install asterisk itself:

    # cd asterisk-1.6.2.22

    After successful installation, in the /etc/asterisk directory you will find the asterisk"a configuration files. Asterisk is configured by editing configuration files that have a very specific structure and operators. The basis for the configuration when configuring asterisk is the sip.conf and extensions.conf files. Having studied and edited these files can be achieved proper operation server.

    The sip.conf file includes the settings of all SIP devices registered on the server, which subsequently interact with each other by connecting two or more SIP channels, thereby initiating a telephone connection - that is, a call.

    Example sip.conf file:


    qualify=yes
    nat=no


    defaultexpiry=3600
    disallow=all
    allow=alaw
    allow=ulaw
    fromuser=044XXXXXXX
    host=80.91.169.2
    insecure=invite,port
    secret=xxxxxxxxxxxx
    type=peer
    username=044XXXXXXX
    context=incoming
    language=en
    qualify=yes
    dtmfmode=auto


    type=friend
    host=dynamic
    insecure=invite,port
    username=fxo
    secret=xxxxxxxx
    context=incoming
    qualify=yes
    nat=no
    canreinvite=no
    allowtransfer=no
    dtmfmode=auto
    disallow=all
    allow=alaw
    allow=ulaw


    type=friend
    regexten=101
    secret=xxxxxxxxxxxxx
    context=internal
    host=dynamic
    callerid="101"
    disallow=all
    allow=alaw
    allow=ulaw
    language=en
    callgroup=1
    pickupgroup=1
    qualify=yes
    canreinvite=yes
    call-limit=4
    nat=no

    This example shows simple list sip devices. It is easy to notice that the configuration contains blocks enclosed in square brackets. It is these blocks that describe the configuration of any devices (peers) when setting up Asterisk. Let's briefly go through the blocks and the most basic parameters.

    The block is required. It includes settings and options that apply to all blocks by default. In other words, if a parameter is not specified when describing a device, then Asterisk reads it from this block.

    The next three blocks directly describe SIP devices. For clarity, all three devices have different purposes. The block describes the parameters for the sip number of the Datagroup company, the block describes the parameters for connecting to a VOIP gateway, and the block describes the parameters of a regular internal sip device that can be used by a software or hardware IP phone.

    Let's go over the main parameters of SIP devices. The context parameter determines which action algorithm to apply to a particular device. Callerid defines the peer number and name, which will be displayed when an outgoing call is made from it. The disallow and allow options determine which codecs to use for communication. The secret option is the password for registering this peer. It is advisable to make passwords sufficiently complex to avoid hacking by ill-wishers.

    The extensions.conf file describes the interactions between contexts and communication channels, of which there can be a large number. In fact, this file is the main one when configuring asterisk.

    Example extensions.conf file:


    exten => _XXX,1,Dial(SIP/$(EXTEN),120,tT)
    exten => _XXX,n,Hangup

    Exten => _X.,1,Dial(SIP/datagroup/$(EXTEN),120,tT)
    exten => _X.,n,Hangup


    exten => _X.,1,Dial(SIP/101,60,tT)
    exten => _X.,2,Hangup

    Exten => h,1,Hangup

    In this simplest example, we have two algorithms of actions (context) - internal and incoming. Let us recall that binding to contexts is carried out when creating peers in the sip.conf file and is subsequently assigned in extensions.conf when attempting to initiate communication with a peer.

    Let us describe the two contexts in more detail. Just by their names it becomes clear that they are used for algorithms for internal subscribers and incoming calls. A generalized example, which can be expressed in the following line, will help you understand the design of this file:

    Exten => _XXX,n,Command(Options)

    These options are deciphered as follows:

    Exten => _XXX is a service prefix with which almost all lines in this file begin. It describes the representation of the incoming context. In other words, if this context was contacted by peer number 101, then the algorithm for it should begin with the construction exten => 101. The prefix supports regular expressions and can be specified in a general way. For example, exten => _XXX indicates that under this algorithm all peers that consist of three digits are included.

    N - line number of the algorithm. In any program code there is a sequence of statements that are executed in turn. In the same way, there is such a sequence in the asterisk settings. The only difference is that the commands executed by asterisk are numbered. It is mandatory to indicate the first line explicitly. As you may have noticed, all contexts begin with the lines:

    Exten => _XXX,1,…..
    exten => _X.,1,…..
    exten => h,1,……

    But further lines can be numbered implicitly, that is, like this:

    Exten => _XXX,n,…..
    exten => _X.,n,…..
    exten => h,n,……

    When the line number is implicitly specified, asterisk executes them sequentially from top to bottom, as it does with any other code.

    Command - a command executed by asterisk. There aren't that many basic commands. For basic setup, it is enough to know the syntax of the Dial command, using which we will look at the remaining options as an example.

    For example:
    exten => _X.,1,Dial(SIP/101,60,tT) - asterisk will dial extension 101 and try to reach the subscriber within 60 seconds with the possibility of intercepting the call from the calling and receiving peers (tT options)
    exten => _X.,1,Dial(SIP/datagroup/$(EXTEN),120,tT) asterisk will dial the number that is passed in the $(EXTEN) variable using the datagroup peer previously specified in sip.conf

    The first example was used in the incoming context. This means that all incoming calls coming to this context are redirected to the internal subscriber who answers these calls. The second example, in turn, shows how outgoing call passing the dialed number in the service variable $(EXTEN).

    Example files can be directly copied from this article and pasted into your sip.conf and extensions.conf and edited some options (logins, peer names, passwords, etc.). After setting up asterisk, we start the server with a simple command:

    Further actions can be performed from the asterisk command line, which is launched with the command:

    # asterisk -rvvvvd

    Once in the console, you can check the operation of your server. It will display all the actions it performs.

    P.S. If you were unable to configure the server, or you need a more complex configuration, we will be happy to help you configure asterisk. Our contacts.


    Configuration file for channels in , both for incoming and outgoing calls.

    Each SIP client or server is defined in this file as a text block, similar to the one below:


    type=yyy
    parameter1=value
    parameter2=value

    Where xxx is the name associated with the SIP client, or it can be an arbitrary SIP device name that can be referenced from other configuration files. Typically, if a SIP phone has an extension number of 123, then the corresponding settings in this file begin with the line . Please note that in order to be able to call this extension 123, you must describe it in your dial plan. could be: "user", "peer" or "friend".

    The Asterisk server determines whether an incoming call matches a device name, for clients with type=user, based on the From: username header (ignoring the SIP domain). Another way to process incoming SIP requests is to determine if they match a section in this file, using the IP address of the incoming request to determine who the request came from, and looking for the appropriate Host= parameter value in the user section. If this parameter is set to Host=dynamic, then there will be no matching matches until the SIP client registers with the server.

    Asterisk as a SIP client In the configuration file in the section, add the register definition:

    Format:
    register => user [:secret[:authuser]] @host [:port]

    Example:
    ; Register 2345 with the sip provider, like number 1234 on our side.
    register => 2345: [email protected]/1234

    user - user ID used for the SIP server (for example, 2345) authuser - optional user name for authorization on the SIP server secret - user password host - domain or host name of the SIP server. This SIP server must be defined in its own section of the sip.conf file, where its parameters must be specified (mysipprovider.com). port - to which port number to send requests for registration on the host server. By default - 5060 /1234 - extension number for receiving calls in your Asterisk. 1234 - inserted into the SIP header contact, SIP registration request. This extension is used by a remote SIP server when it needs to make a call to your Asterisk. See the examples below. By default, the contextual "s" is used.
    This, of course, is all well and good, but using unencrypted passwords in a text file is not a good idea, but what else can you do now?
    You only need to register if: a) it must be possible to call you, and b) one of the parties has a dynamic IP address. You can check whether your server has successfully registered using the CLI command: "SIP SHOW REGISTRY", similarly, you can get a list of clients registered on your server using the command: "SIP SHOW PEERS". You can view more detailed information about a registered client using the command: "SIP SHOW PEER". Run the "HELP SIP" command in the CLI console to get a list of additional commands.

    The server definition for making outgoing calls should be something like this:


    type=peer
    secret=password
    username=2345
    host=sipserver.mysipprovider.com
    fromuser=2345
    fromdomain=fwd.pulver.com
    nat=yes
    context=from-mysipprovider ; this contest must be defined in extensions.conf

    In the extensions.conf file, to make outgoing calls, you must have a dialing rule that looks something like this:

    Exten => _9.,1,Dial(SIP/$(EXTEN:1)@mysipprovider-out,30,r)

    Please note that the $(EXTEN:1) construct retrieves the entire contents of the variable that contains the extension being called (matching the pattern), except for the first digit, in this case: 9 + a set of digits. Refer to the section on working with substrings in the description for more detailed information.


    exten => 1234,1,Answer; 1234 - extension from contact information, default - "s"
    exten => 1234,2,Dial(SIP/111,25,Ttr) ; incoming call redirect to SIP phone number 111
    exten => 1234.3,Hangup

    SIP configuration - general section The section of the sip.conf file includes the following variables:

    = : Allowed codecs, the order in which the codec is selected is determined by the order in which they are described in this command (First use: DISALLOW=ALL, before allowing any specific codecs) allowtransfer= yes | no: Appeared starting from version 1.4.0. When set to "no" - prohibits all types of call transfers. (except for those permitted in the user settings description). =all:Disables the use of all codecs (global setting) allowguest = yes (default) | no: Allow or disable guest calls (default - yes, you can specify the "osp" parameter as the value if asterisk is built with OSP support) = yes | no: If enabled, anyone can use the server as a peer (without checking for access; can be convenient when working with SER SIP proxy). bindaddr = 0.0.0.0:IP address to which Asterisk will receive IP packets of SIP calls bindport=5060:port number to which Asterisk will receive IP packets of SIP calls callerid = : Information for Caller*Id, used when there is none of those , which could be used as this value. The default is "asterisk". (The ability to override the default value is available in Asterisk 1.0.9. I'm not entirely sure about other versions.) = update | yes | no (global setting). For some reason, the default value is "Yes", be careful... context = : This is the default, which is used when the client does not have its own defined. This client-specific is used to route calls from that client to the desired destination. The content is described in the dial plan file - extensions.conf. defaultexpirey=120: Duration of the incoming or outgoing registration period. : inband | info | rfc2833 (global setting) = domains: Comma separated list of domains that the Asterisk server is responsible for. (appeared in Asterisk 1.2.x) = 200.201.202.203: IP address that will be used in SIP messages if our server is behind NAT. externhost = hostname.tld: ( new parameter in Asterisk 1.2.x) externrefresh = xxx: With this parameter we determine how often the DNS entry will be looked up for the hostname defined in the "externhost" parameter (new parameter in Asterisk 1.2.x) = 192.168.1.0/255.255.255.0: definition local network and her masks. fromdomain= : Setting the default domain in the From: field of SIP messages when working as a SIP ua (client). maxexpirey=3600: Maximum allowed registration duration. mineexpiry=60: (Variable introduced since Asterisk 1.4.0) Minimum allowed registration duration. = yes | no (setting for connections with peers) Please note that in Asterisk 1.0.x, the nat parameter can take the following values: no | never | route | yes. notifymimetype=text/plain:Allows you to override the mime type in MWI NOTIFY messages used in messages that are sent by the system. pedantic = yes|no: Enable slow, pedantic checking of Call-ID fields and all lines in the multi-line SIP message header and URI-encoded headers port = : Default SIP port. (this is not the port on which your Asterisk listens for IP packets. See parameter: bindport) promiscredir=yes | no: Enable support for 302 Redirects messages; (No - will forward everything to the local extension that is received in the Contact field, and not to the extension that is specified in the call destination field.) realm = realm (This setting can change the realm for authorization, from the default value - Asterisk, to any selected by you. Works starting from Asterisk version 1.x) register => @ / : Register on the SIP provider’s server. = yes|no: Enable search for tos= calls: This parameter removed starting from Asterisk 1.4.0. Setting IP QoS parameters for outgoing media streams. t1min= : (Variable introduced since Asterisk 1.4.0) The minimum delay for messages to travel to and from the host (roundtrip time) for which the state is being monitored (monitored host). The default value is 100 ms. = : (Variable appeared starting from Asterisk version 1.4.0) Setting IP QoS parameters for SIP packets. = : (Variable appeared starting from Asterisk version 1.4.0) Setting IP QoS parameters for packets transmitting audio data via the RTP protocol. = : (Variable appeared starting from Asterisk version 1.4.0) Setting IP QoS parameters for packets transmitting video data via the RTP protocol.
    videosupport=yes|no: Enables SIP video support: The parameter allows you to change the value of the SIP header "User-Agent". = yes|no: If enabled, the resulting Remote-Party-ID value can be trusted.

    SIP configuration - clients and peers The following variables can be set in the description of each SIP client:

    : The user can be associated with a certain access code (accountcode). Used for . : Allowed and prohibited codecs. : Category for CDR records. You can choose: default, omit, billing, documentation. See: .allowoverlap: Since version 1.4.x. Values: yes/no, default: yes. Setting to "no" disables support for "overlap dialing".allowsubscribe: Since version 1.4.x. Values: yes/no, default: no. Setting to "no" prohibits tracking the status (subscriptions) of this client. allowtransfer: Starting from version 1.4.x. Allow (yes) or deny (no) call transfer for this user.auth: Since version 1.4.x. Link to a record from a section (peer type only).autoframing: Since version 1.4.x. Enable (yes) or disable (no) autoframing"a.buggymwi: Since version 1.4.x. Values: yes/no, default: no. Cisco SIP firmware does not fully support RFC for indicating the presence of a new voicemail (MWI). Set this parameter to "yes" to avoid receiving error messages when sending MWI to phones with this problem: Defines the call group for calls through this device.callingpres: Since version 1.4.x CallerId publishing mode. , see the values ​​in the file doc/callingpres.txt from the distribution asterisk.call-limit: Starting from version 1.4.x__. Limit on the number of calls for the user. For the type "peer" - for outgoing, for "user" - for incoming. .: Enable only if the client supports the function: .cid_number: Since version 1.4.x. Number part of the CallerID.context field: The dial plan context in which calls coming from this client fall: The default IP address of the client when. host= is defined as DYNAMIC. Used if the client has not yet registered, if it is necessary to call it. : How the client handles DMTF signaling. : Specify the username for the "from" field when a call is made using this entry. = : Sets the default domain in the From: field of SIP messages when a call is made using this entry.fullname: Since version 1.4.x. Name part, fields CallerID.g726nonstandard: Since version 1.4.x. Values: yes/no, default: no. If the client is going to “agree” to use the G726-32 audio codec for a communication session, using AAL2 compression, instead of RFC3551 (which is required for devices from Sipura and gateways from Grandstream, and maybe others). This is contrary to the RFC3551 specification, the client _must_ "agree" to use AAL2-G726-32 instead:-(host: How do we find our client - IP address or hostname. If you need the phone to register itself, use the dynamic value instead of the IP address or hostname. : Limit on the number of simultaneous connections with our SIP client. These parameters are obsolete and are not used in version 1.4.x. : very|yes|no|invite|port: Defines how to handle connections to peers. The default value is "no" (authentication is enabled for all connections). (invite and port added in version 1.2.x). : Language code, which are defined in the indications.conf file - where the greeting language and country-specific phone tone settings are defined. : Voice mailbox extension (for the new messages indicator) maxcallbitrate: Starting from version 1.4.x. Maximum bitrate for video in kbit/s. Default: 384 kbit/s.mohsuggest: Since version 1.4.x. See sip.conf for the purpose. : MD5-Hash strings: " :asterisk: " (can be used instead of the secret parameter).musiconhold: Sets the musiconhold class for calls from this SIP phone. For calls that come to this phone, setting this class must be done with a command that is higher in priority (lower priority in the dial plan) than the Dial command in the dial plan. The MusicOnHold parameter is set for calls made, not for phones, and if the command is used to handle a call for an extension, it will override the value specified by this parameter for that call. : This variable changes how the Asterisk server behaves to clients behind a NAT firewall. But this parameter does not solve the problem if Asterisk itself is behind such a firewall, and the client is outside (in internet networks with a normal IP address).outboundproxy: Proxy server address for outgoing calls (peer type only).permit, deny: Restrictions on IP address and IP network for the client. Note: in version 1.4.x the mask parameter is no longer used. : Group for “pickup” calls to your colleagues using the combination “*8” and the Pickup() application to work with the extension *8.port: SIP port of the client.progressinband: Starting from version 1.4.x. Values: yes/no/never, default: never. Should asterisk generate its own ringing tone for caller(in-band ringing). Use the value "never" to never generate this signal, even if some strange devices cannot generate it themselves.promiscredir: Since version 1.4.x. Values: yes/no, default: no. If set to "yes", then we allow SIP messages with code 302 or call forwarding messages to be sent to SIP clients with non-local IP addresses. It is worth noting that the behavior of promiscredir when forwarding a call that is made in local system , can lead to a call loop, because Asterisk cannot handle hairpin calls. : Periodically check client availability. restrictcid: (yes/no) This option is not used, use callingpres instead. rfc2833compensate: Since version 1.4.x. Values: yes/no, default: no. Enabling compensation for the transmission of DTMF signals from other asterisk servers versions up to 1.4.*. In these cases, you must enable this feature or DTMF signal reception will not work properly. : Terminate the call if there is no RTP media stream activity for more than x seconds and if the line is not in hold mode. : Abort the call if there is no RTP media stream activity for more than x seconds, in hold mode (the value must be greater than rtptimeout)secret: If Asterisk acts as a SIP server, then this SIP client must be authorized with this password ( shared secret). If Asterisk acts as a SIP client working with a remote SIP server that requires authorization for "SIP INVITE" requests, then this field will be used for authorization in the "SIP INVITE" messages that our Asterisk will send to the remote SIP server.sendrpid : Whether or not to send the Remote-Party-Id header to this SIP client. Values: yes/no, default: yes.setvar: Since version 1.4.x. The value specifies the "variable=value" pair for the channel variable when calling from this device.subscribecontext: Starting from version 1.4.x. Specifies the name of the context in which SIP requests will be processed SUBSCRIBE.subscribemwi: Starting from version 1.4.x. The values ​​are "yes" and "no". Purpose see sip.conf.t38pt_udptl: Starting from version 1.4.x. Values: yes/no, default: no. Enable/disable T.38 support for this client. : Values: yes/no, default: no. Set to "yes" if you can trust the Remote-Party-ID received from the SIP client. : Client type - outgoing calls only, incoming calls only, or both? useclientcode: Since version 1.4.x. Values: yes/no, default: no.usereqphone: Since version 1.4.x. The values ​​are "yes" and "no". Whether or not to add ";user=phone" to the URI that contains the normal calling number. : If Asterisk is acting as a SIP client working with a remote SIP server that requires authorization for "SIP INVITE" requests, then this field will be used for authorization in the "SIP INVITE" messages that our Asterisk will send to the remote SIP server. And also, for peers that register on our Asterisk server, if this username is used in INVITE messages, as long as it is registered on the server.videosupport: Values: yes/no, default: yes. Option to enable SIP video support. You may need to enable video support for a specific SIP client if, for example, it is disabled in the global part of the configuration, and you want to selectively enable it only for specific users. vmexten: Starting from version 1.4.x. For purpose, see sip.conf (peer type only).

    Please note Asterisk does not (yet) support SIP over TCP transport. Only supported via UDP protocol. For Grandstream phones: set the parameter dtmfmode=info, and for GXP2000 dtmfmode=inband Asterisk uses the incoming stream as a timing source for sending the outgoing stream. If the incoming stream is interrupted due to the silence suppression function, then the musiconhold quality will be very poor. As a result, you cannot use the silence suppression function. Be sure to ensure that ALL SIP phones have silence suppression disabled. Examples Each SIP client that needs to work with Asterisk must be defined in the SIP.CONF file. Below are a few examples:


    type=friend ; could be: "friend" (this is: peer+user), "peer" or "user"
    context=from-sip
    username=grandstream1 ; usually, this parameter coincides with the section name -
    fromuser=grandstream1 ; reassigns callerid, for example,
    ; may be necessary for forward calls - FWD
    callerid=John Doe
    host=192.168.0.23 ; We use a static but intranet IP address
    nat=no ; There is no IP address translation (NAT) between our phone and Asterisk
    canreinvite=yes ; forces all RTP voice traffic to go through Asterisk
    dtmfmode=info ; can be both INBAND and INFO, for example, for BudgeTone phones
    mailbox=1234@default ; client has voicebox 1234 in voicebox context: "default"
    disallow=all ; you must set disallow=al before using the allow= parameter
    allow=ulaw ; Please note: in the client sections, the order in which the codec is selected
    ; described in the allow= parameter has no meaning!
    ;allow=alaw
    ;allow=g723.1 ; Asterisk supports the g723.1 codec only in pass-thru mode!
    ;allow=g729 ; Only in Pass-thru mode, if you do not have a license to use the g729 codec


    Turn off the silence suppression function in the X-Lite client ("Transmit Silence"=YES)!
    ;Note that Xlite itself sends NAT keep-alive packets, so there is no need for qualify=yes.
    type=friend
    username=xlite1
    callerid="Jane Smith"
    host=dynamic
    nat=yes ; the X-Lite client is located behind a router with IP address translation (NAT)
    canreinvite=no ; Typically set to "NO" if the client is behind NAT
    disallow=all
    allow=gsm ; The GSM codec requires much less bandwidth, so ulaw.
    allow=ulaw
    allow=alaw


    type=friend
    secret=blah
    host=dynamic
    dtmfmode=inband ; You can choose from: inband, rfc2833, or info
    defaultip=192.168.0.59
    mailbox=1234,2345 ; Voice box for the "new messages received" indicator
    disallow=all
    allow=ulaw ; if the mode for dtmf is set to "inband",
    allow=alaw ; then we should use only g.711 codec


    type=friend
    username=user2_pingtel
    secret=blah
    host=dynamic
    qualify=1000 ; We consider the client as non-working,
    ; if the response from him takes more than 1 second.
    callgroup=1,3-4 ; The client is a member of call groups: 1, 3 and 4
    pickupgroup=1,3-4 ; We can make "pick-up" calls by pressing *8,
    ; for calls from groups 1, 3 and 4
    defaultip=192.168.0.60
    disallow=all
    allow=ulaw
    allow=alaw
    allow=g729

    Type=friend
    username=user3_cisco
    secret=blah
    nat=yes ; This phone is behind a router with NAT
    host=dynamic
    canreinvite=no ; Cisco devices sometimes freeze
    ; after a certain number of reinvite requests
    qualify=200 ; We consider the feast as non-working,
    ; if the response from it comes longer than 200ms
    defaultip=192.168.0.4
    disallow=all
    allow=ulaw
    allow=alaw
    allow=g729


    type=friend

    Username=user4_cisco
    fromuser=markster ; Define the username to be placed in the "from" field instead of callerid
    secret=blah
    defaultip=192.168.0.4 ; use either host=dynamic or defaultip=...
    amaflags=default ; Could be: default, omit, billing, documentation
    accountcode=markster ; The user is associated with an accountcode to simplify billing.
    disallow=all
    allow=ulaw
    allow=alaw
    allow=g729
    allow=g723.1

    The description below is taken from the Digium Asterisk handbook.

    After you define these SIP accounts for your clients in the SIP.conf file, then these clients have the opportunity to register on the asterisk server and make outgoing calls. In order for them to be able to receive calls, you need to describe extensions for them in your dial plan file. Example:

    Exten => 1010,1, Dial(SIP/user3_cisco,10,t)

    If someone makes a call to 1010, then an attempt will be made to call the SIP client registered as user3_cisco.

    Remarks The $(VXML_URL) variable can be used to add an additional element in the SIP "To:" message header. The value of this variable will be added, separated by semicolons, to the end of the "To:" header of the SIP message. Please note that the previous description of using this feature was incorrect; using this variable has no effect when downloading messages to a Cisco 7960 phone (something currently disabled in the SIP firmware of Cisco phones). This problem is described in: author's e-mail The $(ALERT_INFO) variable can be used to create a new header called "Alert-Info:" that can be used to specify a specific ring type on Cisco SIP phones running firmware version 6.0 or higher. For phones, the ALERT_INFO variable can take the following values ​​to set a specific built-in ringing tone: - Bellcore-BusyVerify
    - Bellcore-Stutter
    - Bellcore-MsgWaiting
    - Bellcore-dr1
    - Bellcore-dr2
    - Bellcore-dr3
    - Bellcore-dr4
    - Bellcore-dr5
    At the moment, there is no way to define another call; you can only select options for playing a call. You have to listen very carefully to tell that the call tones are really different in any way. There is a bug report to Cisco: Cisco bug ID CSCec42938, in which it is proposed to complete the ability to select call signals. Example 1 John Todd, loligo.com: http://www.loligo.com/asterisk/current/sip.conf Connecting to Free World Dialup (without using NAT) [general]
    disallow=all
    allow=gsm
    allow=ulaw
    allow=alaw
    context=from-sip
    maxexpirey=180
    defaultexpirey=160
    tos=reliability
    register => : @fwd.pulver.com/CONTACT

    [fwd.pulver.com]
    type=friend
    secret=
    username=
    host=fwd.pulver.com
    insecure=very ; required to support incoming FWD calls

    Now let's go to the file description and see how we can configure contexts in terms of dialing.

    Example 2 Using Asterisk in conjunction with SIP proxy SER [general]
    context=OUTGOING
    autocreatepeer=yes

    [Provider]
    type=friend
    username=XXXXX
    secret=XXXXX
    host=xxxxx.FakeProvider.com

    So now when Asterisk receives a call with SER, it performs the "autocreatepeer" action and allows the call to be processed in the OUTGOING context.

    Managing sip.conf from external sources: using the RealTime mechanism for SIP channels. Just like in other .conf files, the #include directive can be used to include another file in the sip.conf configuration. Notes for different versions: Additional features, added since version 0.7.2 2004-01-23: Added CLI command "sip reload" to reboot the sip channel so that the changes made to the sip.conf file take effect, without rebooting the Asterisk server. 2004-01-25: Support for storing SIP peer definitions in the database. Storing the configuration in the database was not fully implemented at this time, but it works. See: 2004-06: Support for storing SIP user definitions in a database.