asterisk简单实用

一、hello wold:

1、启动dadhi、asterisk后,输入下面命令可以进入asterisk的命令行

# asterisk -vvgc
Asterisk already running on /var/run/asterisk/asterisk.ctl.  Use 'asterisk -r' to connect.
# asterisk -r
Asterisk 14.7.6, Copyright (C) 1999 - 2016, Digium, Inc. and others.
Created by Mark Spencer 
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 14.7.6 currently running on mbd-toutiao-worker-online109-shgq (pid = 8742)
mbd-toutiao-worker-online109-shgq*CLI> 
补充:启动dadhi可以用service dadhi start

2、配置asterisk

1)extensions.conf文件:

cd /etc/asterisk
mv extensions.conf extensions.sample
vim extensions.conf

[from-internal]
exten = 100,1,Answer()
same = n,Wait(1)
same = n,Playback(hello-world)
same = n,Hangup()

2)sip.conf

备份sip.conf,然后

[general]
context=default

[6001]
type=friend
context=from-internal
host=dynamic
secret=unsecurepassword
disallow=all
allow=ulaw
3)重启asterisk

4)查看用户

mbd-toutiao-worker-online109-shgq*CLI> sip show users
Username                   Secret           Accountcode      Def.Context      ACL  Forcerport
6001                       unsecurepasswor                   from-internal    No   No   

每次修改sip.conf后可以使用下面命令重新加载

mbd-toutiao-worker-online109-shgq*CLI> sip reload
mbd-toutiao-worker-online109-shgq*CLI>

每次修改extension.conf文件后可以使用下面命令重新加载

mbd-toutiao-worker-online109-shgq*CLI> dialplan reload
Dialplan reloaded.

3、下载客户端测试

1)在Windows上下载eyeBeam

2)配置eyeBeam:

右键,然后选择sip

asterisk简单实用_第1张图片

3)添加配置

asterisk简单实用_第2张图片

4)保存后,根据extension.conf设置的拨号规则,直接拨打100,就会有反应。

asterisk简单实用_第3张图片
参考:

https://wiki.asterisk.org/wiki/display/AST/Hello+World

http://blog.csdn.net/u010148712/article/details/53241700

https://my.oschina.net/u/2404183/blog/709215

https://danielfree.net/archives/1081/

https://hello.lanbing.org/post/2013142.html

https://www.zybuluo.com/Lee2011/note/32706

http://blog.duxin.info/sip-setup/

http://blog.csdn.net/brandon2015/article/details/51811914

你可能感兴趣的:(#,运维)