various dialplans

  •  answer and play a prompt , wait 10 sec then hangup

 

asterisk *.conf files and their meaning

  • acl.conf    :       acl mean access control list ,

Example :

 

question :  I  register 2 sip user on my asterisk server , and after I set  deny=0.0.0.0/0.0.0.0 , this two number can still make call ,  why ?


  • cel.conf   :   cel mean channel event logging

Channel Event Logging is a mechanism to provide fine-grained event information that can be used to generate billing information. Such event information can be recorded to various backend modules.

question :    a)  channel how to define

b) if set to yes , where will the log file exist

c) how to logging USER_DEFINED event

 


  •  conbridge.conf   :    features like “MeetMe”  ,  implement call conference

for detail , ref :  https://www.voip-info.org/asterisk-cmd-confbridge/


  • manager.conf  :       AMI  —     the asterisk manager Interface

after enter cli mode  , type :

can view all manager command

 

for detail explain , see :     https://www.voip-info.org/asterisk-config-managerconf/

 


  • phone.conf

  • adsi.conf       :   no need to change


  • ccss.conf

 

asterisk 13 (compile with pjsip ) all available cli commands

 

 

  • sip set debug on/off                

 

how to use asterisk CLI command to make a call

  • version  :    Asterisk certified/13.18-cert3

  • pre requirement

create user and dial-plan as this page say :     http://176.122.178.37/?p=258

  • enter asterisk cli by type :

 

  • run this command :

this command mean : use pjsip channel , make outgong call to 6001 , using dialplan 6001@from-internel .

 

  •  this will make a outgoing call to 6001

 

  • How to play a prompt and hangup ?

in asterisk 13 , sound files location is :  /var/lib/asterisk/sounds/en 

play prompt function is :

ref article :  https://www.voip-info.org/asterisk-cmd-playback/

 

so we change our dialplan to :

 

then run :

in cli ,  the result is :

you can see is playing .

But in actually , I do not hear anything , why ?           this is softphone problem , install zoipper on windows will solve it ans hear the prompt 


 

Notice :   if any command unknow , you can  use

 

***********************************************************************************************

yes this command can make a outgoing call to 6001 , but on mobile which register as 6001 , it can not see the incoming A number , what was shown is “anonymous”

So , how to let it display anyincoming number ?

One method is create call file  ,  like this :

create it in /tmp ,  and copy to

 

about detail of call file ,  reference from :

https://www.voip-info.org/asterisk-auto-dial-out/

 

 


Very import  

if  create such a dialplan :

 

and in cli ,  type this command :

 

this call will use asterisk local channel

From article :  https://asterisk-java.org/originate-using-asterisk-local-channels-566/


but no matter use local channel or not , still  not solve the problem : How to set calledID from cli command line :   channel originate 

 

 

 

 


 

How to use asterisk.net to exec above cli command in .net application 

 

 

 

 

 

 

 

how to add two sip account in pjsip.conf and configure dialplan in extensions.conf

in extensions , add :

 

after configuration , you can register both 6001 and 7001  on your two mobiles ,use 6001 to call 7001  and talk success

how to decode and encode from .g729 file

how to decode :

 

从 http://downloads.asterisk.org/pub/telephony/sounds/releases/   

下载 .g729 文件


解压后 , 下载 ffmpeg 的最新版本  ffmpeg-20180507-29eb1c5-win64-static , 这个是不用安装的


在 command line 进入 ffmpeg的bin目录, 执行

ffmpeg.exe -i “vm-message.g729” “vm729ToWav.wav”

即可将 g729文件解码为wav 文件, 并可以在 windows media player 播放。

———————————————————————————————–

how to encode :

 

到这个网址 :

https://www.digium.com/products/ivr/audio-converter

按图中选择

 

注意源文件尽量要小, 我是把MP3剪切出1分钟,再用格式工厂转换为rate = 11025 的单声道 , 最终wav文件大小为 1.3 M

点 convert 即可完成编码为 g729

 

 

 

 

 

 

 

 

 

(Copy) install asterisk on centos 6 32bit

Copy From  :

http://asteriskpro.blogspot.com/2017/07/how-to-install-asterisk-13-and- pjsip-on.html

上地址已失效, 现改为

How to Install Asterisk 13 and PJSIP on CentOS 6

Step 1 – Setup the environment

The first step is to install the dependencies required to build the PJSIP libraries and Asterisk 13. Using the CentOS yum package manager we’ll update all currently installed packages to their latest version and then install some of the most common dependencies for Asterisk and PJSIP.
PJSIP 已经取代 SIP 成为默认模块, SIP 转移到 extended support

The kernel-devel package we install next could be slightly ahead of the kernel actually in use on your system. This is why we did a yum update first. If the kernel has been updated, be sure to reboot before moving forward. More information about the kernel-devel packages available for CentOS can be found here. The following command will install several packages that are needed to compile and install PJSIP and Asterisk.

NOTE:If you encounter an issue resolving the dependencies check out the fantastic install_prereq tool shipped with the Asterisk tarball. Located in the contrib/scripts directory of the Asterisk source directory that will be unpacked in step 3.

Step 2 – Install pjproject

Next you will download and install the pjproject sip library directly from pjsip.org. But first we’ll change directories to work in the /usr/src directory.

This will create the pjproject-2.3 directory. Change to this directory and run the following set of commands to build and install the pjproject sip library.

This command must be modified when using a 32-bit operating system. Just remove the --libdir=/usr/lib64option from the command. The other options may be different depending on how you want to use Asterisk. More information about these options can be found on the Asterisk wiki or by running the command ./configure --help. The next four commands will build, install and link the pjsip libraries.

And finally this next command will verify the pjsip libraries have been dynamically linked.

Your output should look something like this:
pjsip-liblink

Step 3 – Install Asterisk 13

Now we’ll download and install the latest Certified-Asterisk 13.1 branch from source. First we’ll change directory up one level to /usr/src.

Then we’ll use the wget command to download the tarball from downloads.asterisk.org.

(注 :in 2018 -5- 8 , 实际可下载的文件已经改为了 
asterisk-certified-13.18-current.tar.gz  , 下文中的 certified-asterisk-13.1-certified  也应该用 
asterisk-certified-13.18-cert3  替代   )
Next the tar command will unpack the Asterisk source code into a new directory named certified-asterisk-13.1-certified. Then we’ll go to the new directory.

The next set of commands will build and install Asterisk. Remember to skip the --libdir=/usr/lib64 option for 32-bit versions of CentOS. In that case just run the command ./configure.

Next you will run the make menuselect command. This step will verify if the pjsip channel driver dependencies have been successfully installed.

Use the arrow keys to navigate to “Resource Modules” in the left column, about halfway down the list. Press the right arrow key and then scroll down until you see the list of modules beginning with “res_pjsip_”. If these modules have “XXX” to the left of their name then the dependencies have not been met. You’ll need to go back to the /usr/src/pjproject directory, run the “make distclean” command and start over carefully looking for any error messages and proceed from there. If you see [*] instead of XXX then the res_pjsip module’s dependencies have been met and you can proceed to the next steps. Your menuselect screen should look like this:
menuselect-pjsip
(注: 因为是 putty 登陆, 图形界面看不到 , 直接运行的 ./configure  ,
发现缺少 jansson 库 , 显示 
asterisk configure: error: *** JSON support not found
去 /usr/src
执行: wget http://www.digip.org/jansson/releases/jansson-2.5.tar.gz
              tar -zxf jansson-2.5.tar.gz
              cd jansson*

          ldconfig

再回到 asterisk 目录下 :    ./configure     )

If you want Asterisk to start at boot time use the following command to setup the Asterisk service.

And finally, run the command “service asterisk start” to immediately begin the Asterisk service without the need to reboot first. Now you’re ready to begin configuring the PJSIP channel driver on your freshly installed instance of Asterisk 13. If you run into an issue with these instructions feel free to leave a comment on this post, check the official Asterisk forums or reach out to the Asterisk community for help.

 


如何看asterisk service 的状态 :

去 /usr/src/asterisk-certified-13.18-cert3 目录下,执行:

不限制目录, 哪里执行都可以

/etc/init.d/asterisk status

重启是 :  /etc/init.d/asterisk restart

启动 /etc/init.d/asterisk start

停止 /etc/init.d/asterisk stop

 


安装后遇到的问题 :

当执行 /etc/init.d/asterisk status 时, 显示:  asterisk dead but subsys locked

如果去 /usr/sbin , 执行 ./asterisk -vvvc , 会显示:

asteriskerror while loading shared librarieslibjansson.so.4: cannot open shared object file: No such file or directory.

 

这是因为 asterisk 找不到 jansson 的 so 文件 。

解决办法是 :  先找 libjansson.so.4 在哪  , 

执行 find / -name “libjansson.so.4

结果是:

/usr/src/jansson-2.5/src/.libs/libjansson.so.4
/usr/local/lib/libjansson.so.4

所以 , 再执行 :

echo /usr/local/lib> /etc/ld.so.conf.d/asterisk.conf

最后 :

Reload shared library; run the below command.

/sbin/ldconfig

 


至此, asterisk 已经可以正常运行

执行 /etc/init.d/asterisk status , 会看到

asterisk (pid 9312) is running…

执行 ps aux | grep asterisk , 看到


root 2245 0.0 0.2 5260 2156 pts/0 S May07 0:02 /bin/sh /usr/sbin/safe_asterisk
root 9312 0.7 2.8 68360 30016 pts/0 Sl 00:25 0:05 /usr/sbin/asterisk -f -vvvg -c
root 9412 0.0 0.1 4480 2068 pts/0 S+ 00:36 0:00 grep asterisk

执行  service –status-all ,  可以看到 asterisk 也在运行 。