Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
zh-cn:doc:howto:voip.asterisk [2015/01/20 06:01] – [说明] leangjiazh-cn:doc:howto:voip.asterisk [2015/01/20 06:07] – [Configuration] leangjia
Line 1: Line 1:
 +====== Asterisk ======
  
 +===== 说明 =====
 +[[wp>Asterisk (PBX)]]
 +
 +
 +**''敬告1:''** All packages here depend on the package ''asterisk18''!\\
 +**''友示2:''** All packages have Version 1.8.4.4-1.\\
 +
 +
 +^  Asterisk Version 1.8.4.4-1  ^^^^
 +^ 名称        ^ 依赖  ^  大小  ^ 描述  ^
 +| asterisk18  |  libopenssl, libncurses,\\ libpopt, libpthread, zlib  |  997477 | Asterisk is a complete [[wp>Private branch exchange|PBX]] in software. It provides all of the features you would expect from a PBX and more. Asterisk does [[wp>Voice over Internet Protocol|VoIP]] in three protocols, and can inter-operate with almost all standards-based telephony equipment using relatively inexpensive hardware. |
 +| ||||
 +| asterisk18-format-g726  |    3780 | Support for headerless G.726 16/24/32/40kbps data format in Asterisk.  |
 +| asterisk18-format-g729  |    3571 | Support for raw headerless G729 data in Asterisk.  |
 +| ||||
 +| asterisk18-codec-g722      6407 | A high bit rate 48/56/64Kbps ITU standard CODEC in Asterisk.  |
 +| asterisk18-codec-g726      5012 | Translation between signed linear and ITU G.726-32kbps codecs in Asterisk.|
 +| asterisk18-codec-a-mu      2934 | Translation between alaw and ulaw codecs in Asterisk.  |
 +| asterisk18-codec-ulaw      3150 | Translation between signed linear and ulaw codecs in Asterisk.  |
 +| asterisk18-codec-alaw      3069 | Translation between signed linear and alaw codecs in Asterisk.  |
 +| ||||
 +| asterisk18-chan-local      11586 | An implementation of local proxy channel in Asterisk.  |
 +| asterisk18-chan-agent      22519 | An implementation of agents proxy channel in Asterisk.  |
 +| asterisk18-chan-gtalk    libiksemel  |  58144 | This package provides the channel chan_gtalk and res_jabber for GTalk support to Asterisk.  |
 +| asterisk18-chan-iax2    |  asterisk18-res-crypto  |  133735 | This package provides IAX support to Asterisk.  |
 +| asterisk18-chan-skinny  |    52033 | This package provides the channel chan_skinny support to Asterisk.  |
 +| asterisk18-chan-mobile  |  bluez-libs  |  30089 | This package provides the channel chan_mobile support to Asterisk.  |
 +| asterisk18-chan-mgcp    |    42959 | This package provides the channel chan_mgcp support to Asterisk.  |
 +| ||||
 +| asterisk18-pbx-spool    |    9034 | outgoing call spool support in Asterisk.  |
 +| asterisk18-pbx-ael      |    4012 | support for symbolic Asterisk Extension Logic in Asterisk.  |
 +| ||||
 +| asterisk18-voicemail    |    595818 | This package contains voicemail related modules for Asterisk.  |
 +| asterisk18-mysql        |     libmysqlclient  |  36817 | This package provides MySQL support to Asterisk.  |
 +| asterisk18-curl             libcurl  |  8447 | This package provides CURL support to Asterisk.  |
 +| asterisk18-cdr          |    36202 | This package provides Call Detail Record support to Asterisk.  |
 +| asterisk18-sounds          1058667 | This package contains sound files for Asterisk.  |
 +| ||||
 +| asterisk18-app-sms  |    16204 | SMS support (ETSI ES 201 912 protocol 1) in Asterisk.  |
 +| asterisk18-app-authenticate  |    3938 | support for executing arbitrary authenticate commands in Asterisk.  |
 +| asterisk18-app-exec  |    3892 | support for application execution in Asterisk.  |
 +| asterisk18-app-while  |    4851 | a while loop implementation in Asterisk.  |
 +| asterisk18-app-waituntil  |    3104 | support sleeping until the given epoch in Asterisk.  |
 +| asterisk18-app-stack  |     asterisk18-res-agi  |  7980 | stack applications Gosub Return etc. in Asterisk.  |
 +| asterisk18-app-sayunixtime  |    2890 | an application to say Unix time in Asterisk.  |
 +| asterisk18-app-read  |    4359 | a trivial application to read a variable in Asterisk.  |
 +| asterisk18-app-directed-pickup  |    5365 | support for directed call pickup in Asterisk.  |
 +| asterisk18-app-setcallerid  |    2795 | support for setting callerid in Asterisk.  |
 +| asterisk18-app-originate  |    3857 | originating an outbound call and connecting it to a specified extension or application in Asterisk.  |
 +| asterisk18-app-system  |    3312 | support for executing system commands in Asterisk.  |
 +| asterisk18-app-talkdetect  |    4662 | for file playback with audio detect in Asterisk.  |
 +| asterisk18-app-readexten  |    4668 | a trivial application to read an extension into a variable in Asterisk.  |
 +| asterisk18-app-verbose  |    3388 | Verbose logging application in Asterisk.  |
 +| asterisk18-app-alarmreceiver  |    7605 | Central Station Alarm receiver for Ademco Contact ID in Asterisk.  |
 +| asterisk18-app-chanspy  |    9776 | support for listening in on any channel in Asterisk.  |
 +| asterisk18-app-chanisavail  |    3572 | support for checking if a channel is available in Asterisk.  |
 +| asterisk18-app-minivm  |    27656 | a voicemail system in small building blocks working together based on the Comedian Mail voicemail system in Asterisk.  |
 +| ||||
 +| asterisk18-func-uri        |    2769 | Encodes and decodes URI-safe strings in Asterisk.  |
 +| asterisk18-func-global        4536 | global variable dialplan functions in Asterisk.  |
 +| asterisk18-func-blacklist  |    2960 | looking up the callerid number and see if it is blacklisted in Asterisk.  |
 +| asterisk18-func-channel    |    7116 | Channel info dialplan function in Asterisk.  |
 +| asterisk18-func-db            3504 | functions for interaction with the database in Asterisk.  |
 +| asterisk18-func-extstate      2947 | retrieving the state of a hinted extension for dialplan control in Asterisk.  |
 +| asterisk18-func-shell      |    2860 | support for shell execution in Asterisk.  |
 +| asterisk18-func-devstate      4632 | functions for manually controlled blinky lights in Asterisk.  |
 +| asterisk18-func-vmcount    |    2787 | a vmcount dialplan function in Asterisk.  |
 +| ||||
 +| asterisk18-format-sln16  |    3471 | support for Raw slinear 16 format in Asterisk.  |
 +| asterisk18-format-sln    |    3459 | support for raw slinear format in Asterisk.  |
 +| ||||
 +| asterisk18-res-musiconhold  |    17432 | This package provides Music On Hold support to Asterisk.  |
 +| asterisk18-res-agi          |    26069 | support for the Asterisk Gateway Interface extension in Asterisk.  |
 +| asterisk18-res-crypto          7785 | Cryptographic Signature capability in Asterisk.  |
 +| asterisk18-res-ael-share    |    42733 | support for shareable AEL code mainly between internal and external modules in Asterisk.  |
 +
 +^ 依赖包  ^^^^^
 +| libopenssl      |  1.0.0d-1  | zlib    |  592118 | The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a full-strength general purpose cryptography library. This package contains the OpenSSL shared libraries, needed by other programs.  |
 +| libncurses      |  5.7-5  | terminfo    109113 | Terminal handling library  |
 +| libpopt          1.7-5               13796 | A command line option parsing library  |
 +| libpthread      |  0.9.32-81  |        |   30505 | POSIX thread library  |
 +| zlib            |  1.2.5-1  |          |   40519 | Library implementing the deflate compression method  |
 +| terminfo        |  5.7-5  |            |    6056 | Terminal Info Database (ncurses)  |
 +
 +===== 安装命令如下 =====
 +<code>
 +opkg update
 +opkg install asterisk18
 +</code>
 +
 +注意: certain **timezone** related functions in asterisk assume a valid ///etc/localtime// file. This normally doesn't exist on OpenWRT, so you may want to set it up yourself to point to the TZ file describing the timezone you need. You can either just copy it from a Linux install from ///usr/share/zoneinfo/// or install a limited //opkg install zoneinfo-core// OpenWRT package.
 +
 +  * **安装前** 检查空间能装得下么?是否有充足空余磁盘空间:<code>root@openwrt:/etc$ df
 +Filesystem           1K-blocks      Used Available 已用% Mounted on
 +/dev/mtdblock3            5248      1344      3904  26% /overlay
 +overlayfs:/overlay        5248      1344      3904  26% /</code>
 +
 +  * **安装后** 原来已用26%,现在已用61%,对比一下:<code>Filesystem           1K-blocks      Used Available 已用% Mounted on
 +/dev/mtdblock3            5248      3192      2056  61% /overlay
 +overlayfs:/overlay        5248      3192      2056  61% /</code>
 +
 +===== 配置 =====
 +There is no UCI configuration file for the asterisk package, but there is a [[https://forum.openwrt.org/viewtopic.php?id=32154|LuCI based front-end for Asterisk]].
 +
 +| ''/etc/init.d/asterisk''  |
 +| ''/etc/default/asterisk''  |
 +| ''/etc/asterisk/asterisk.conf''  |
 +| ''/etc/asterisk/features.conf''  |
 +| ''/etc/asterisk/modules.conf''  |
 +| ''/etc/asterisk/extensions.conf''  |
 +| ''/etc/asterisk/manager.conf''  |
 +| ''/etc/asterisk/logger.conf''  |
 +| ''/etc/asterisk/rtp.conf''  |
 +| ''/etc/asterisk/indications.conf''  |
 +| ''/etc/asterisk/sip_notify.conf''  |
 +| ''/etc/asterisk/sip.conf''  |
 +
 +If you are using SIP, most of the configuration is done in sip.conf and the dialplan in extensions.conf.
 +If you do not have a SIP phone, you can also use a soft client on your PC.
 +
 +VoIP traffic is very time dependant, so make sure your internet connection has a delay below 100ms. You may also want to configure
 +QoS (diffserv) to prioritize your SIP and RTP packets, especially if you are heavy using it together with other services.
 +
 +Most people recommended to setup port forwarding (SIP UDP and RTP UDP) when NAT is used, but i have found it is not always needed.
 +
 +Here is a very short, basic and tested example for one sip phone and a sip peer. 
 +
 +Example Working Tested Config\\
 +Jan 1, 2014\\
 +NETGEAR WNDR3800\\
 +Firmware Version OpenWrt Attitude Adjustment 12.09 / LuCI 0.11.1 Release (0.11.1)\\
 +Asterisk1.8\\
 +SIP Provider Les.net for DID\\
 +Notes:\\
 +**Use the following command to start asterisk:  asterisk -gvvc\\
 +NPANXXXXXX is your actual DID\\
 +184XXXXXXX is the actual trunk reg from Les.net\\
 +XXXXX is the actual pwd/secret from Les.net**
 +<code>
 +extensions.conf
 +[others]
 +[my-phones]
 +exten => 301, 1, Dial(SIP/301, 20)
 +exten => 301, 2, VoiceMail(301,u)
 +exten => 302, 1, Dial(SIP/302, 20)
 +exten => 303, 1, Dial(SIP/303, 20)
 +exten => 304, 1, Dial(SIP/304, 20)
 +esten => 305, 1, Dial(SIP/305, 20)
 +exten => _1NXXXXXXXXX,1,Dial(SIP/184XXXXXXX/${EXTEN})
 +exten => *97, 1, VoiceMailMain(${CALLERID(NUM)},s)
 +exten => *97, 2, Hangup
 +[from-voip-provider]
 +exten => NPANXXXXXX, 1, Dial(SIP/301, 20)
 +exten =>NPANXXXXXX, 2, VoiceMail(301,u)
 +
 +sip.conf
 +[general]
 +srvlookup=no
 +bindport = 5060
 +bindaddr = 0.0.0.0
 +videosupport=yes
 +context = others
 +register => 184XXXXXXX:XXXXX@did.voip.les.net/301
 +[301]
 +type=friend
 +context=my-phones
 +secret=301
 +qualify=yes
 +port=5060
 +nat=yes
 +host=dynamic
 +dtmfmode=rfc2833
 +callerid=device <301>
 +dial=SIP/301
 +canreinvite=no
 +disallow=all
 +allow=ulaw
 +allow=gsm
 +allow=h261
 +allow=h263
 +
 +[184XXXXXXX]
 +type=friend
 +context=from-voip-provider
 +secret=XXXXX
 +host=did.voip.les.net
 +qualify=yes
 +insecure=invite
 +nat=yes
 +dtmfmode=auto
 +disallow=all
 +allow=ulaw
 +</code>
 +
 +===== Troubleshooting =====
 +
 +  * CLI
 +
 +The Asterisk command line interface can help you a lot when doing troubleshooting.
 +
 +To see whats going on, start CLI with ''asterisk -r'' and enter ''core set verbose 3''.
 +SIP debugging can be enabled with ''sip set debug on'' but this kind of much to read, so 
 +you may pipe this to a text file instead: ''asterisk -vvvr > dump.log''.
 +
 +To show a specific dialplan context: ''dialplan show yourcontext''
 +When you change your dialplan you need to reload it with: ''dialplan reload''
 +For changes in other files you need to restart your asterisk.
 +
 +Check if you peers are responsive and online: ''sip show peers''
 +
 +===== Notes =====
 +  * [[http://www.asterisk.org/|Project Homepage]]
 +  * linux-magazin.de: Workshop: Die eigene Asterisk-Anlage:
 +    * [[http://www.linux-magazin.de/Heft-Abo/Ausgaben/2008/01/Zeit-fuer-was-Neues|Teil 1]]
 +    * [[http://www.linux-magazin.de/Heft-Abo/Ausgaben/2008/02/Erweiterte-Gespraechskultur|Teil 2]]
 +    * [[http://www.linux-magazin.de/Heft-Abo/Ausgaben/2008/03/Analog-digital-ganz-egal|Teil 3]]
 +    * [[http://www.linux-magazin.de/Heft-Abo/Ausgaben/2008/04/Gemeinschaft-an-der-Strippe|Teil 4]]
  • Last modified: 2022/12/26 11:51
  • by heybrowhatsup