当前位置: 首页 > news >正文

Asterisk的sip呼叫测试(转帖)

 

by Jason Liu on 三.08, 2009, under VoIP

系统环境:Linux CentOS 5.0,安装开发工具以及开发库。
           Asterisk源代码包asterisk-1.4.5.tar.gz,版本:1.4.5。
           SIP软电话使用eyebeam版本:1.5.8。        

对于Asterisk,我也不必在这里多做解说了,大家可以去看《Asterisk,未来之路》这本书,非常适合我这样的初学者。而且,看一遍是不够的。并且,本篇中也只是涉及到一个利用SIP协议在Asterisk上实现两个终端的成功通话的实例而已。
一.编译安装Asterisk:
1.解压源代码包
[root@asterisk-test1 ~]# tar -zxvf asterisk-1.4.5.tar.gz 
2.进入包目录
[root@asterisk-test1 ~]# cd asterisk-1.4.5
3.环境检测和预配置
[root@asterisk-test1 asterisk-1.4.5]# ./configure –prefix=/usr/local
(其实这样直接进行configure并非十分规范。应当先使用“./configure –help”命令来查看一些可用的选项和参数,然后根据实际情况才进行定制操作。)当环境预检测和预配置工作做完时,最后会显示以上反馈信息。并且建立好Makefile。
—————————————————————
configure: creating ./config.status
config.status: creating build_tools/menuselect-deps
config.status: creating makeopts
config.status: creating channels/h323/Makefile
config.status: creating include/asterisk/autoconfig.h
               .$$$$$$$$$$$$$$$=..      
            .$7$7..          .7$$7:.    
          .$$:.                 ,$7.7   
        .$7.     7$$$$           .$$77  
     ..$$.       $$$$$            .$$$7 
    ..7$   .?.   $$$$$   .?.       7$$$.
   $.$.   .$$$7. $$$$7 .7$$$.      .$$$.
.777.   .$$$$$$77$$$77$$$$$7.      $$$,
$$$~      .7$$$$$$$$$$$$$7.       .$$$.
.$$7          .7$$$$$$$7:          ?$$$.
$$$          ?7$$$$$$$$$$I        .$$$7 
$$$       .7$$$$$$$$$$$$$$$$      :$$$. 
$$$       $$$$$$7$$$$$$$$$$$$    .$$$.  
$$$        $$$   7$$$7  .$$$    .$$$.   
$$$$             $$$$7         .$$$.    
7$$$7            7$$$$        7$$$      
$$$$$                        $$$       
  $$$$7.                       $$  (TM)     
   $$$$$$$.           .7$$$$$$  $$      
     $$$$$$$$$$$$7$$$$$$$$$.$$$$$$      
       $$$$$$$$$$$$$$$$.                
configure: Package configured for: 
configure: OS type  : linux-gnu
configure: Host CPU : i686
—————————————————————

4.清除陈旧的已编译文件
[root@asterisk-test1 asterisk-1.4.5]# make clean

5.重新编译Asterisk程序
[root@asterisk-test1 asterisk-1.4.5]# make
编译完成后会显示以下反馈提示信息,提示用户进行下一步可选的操作。
—————————————————————
+——— Asterisk Build Complete ———+
+ Asterisk has successfully been built, and +
+ can be installed by running:              +
+                                           +
+               make install                +
+——————————————-+
这里提示用户下一步可以使用“make install”命令,来进行安装了。
—————————————————————

6.安装Asterisk程序
[root@asterisk-test1 asterisk-1.4.5]# make install
当安装完成后就会显示以下反馈提示信息,提示用户进行进一步可选的操作。
—————————————————————
+—- Asterisk Installation Complete ——-+
+                                           +
+    YOU MUST READ THE SECURITY DOCUMENT    +
+                                           +
+ Asterisk has successfully been installed. +
+ If you would like to install the sample   +
+ configuration files (overwriting any      +
+ existing config files), run:              +
+                                           +
+               make samples                +
+                                           +
+—————–  or ———————+
+                                           +
+ You can go ahead and install the asterisk +
+ program documentation now or later run:   +
+                                           +
+              make progdocs                +
+                                           +
+ **Note** This requires that you have      +
+ doxygen installed on your local system    +
+——————————————-+
这里提示用户还能够有2种可选的操作分别是通过“make samples”来安装配置模版,以及通过“make progdocs”来安装一些程序文档。
—————————————————————

7.安装配置模版:
[root@asterisk-test1 asterisk-1.4.5]# make samples
通过这个命令会安装Asterisk的配置文件模版,当然不会有强大的现成的配置,但确实是相当有帮助的,是配置过程中的重要参考。

8.还可以安装网页语音信箱:(这里暂时没有用到)
[root@asterisk-test1 asterisk-1.4.5]# make webvmail
安装页面语音信箱,会试图和Apache这种网站服务进行配合,当然还需要许多定制配置。这里暂时不会用到,但还是觉得应该提一下。
—————————————————————
+——— Asterisk Web Voicemail ———-+
+                                           +
+ Asterisk Web Voicemail is installed in    +
+ your cgi-bin directory:                   +
+ /var/www/cgi-bin
+ IT USES A SETUID ROOT PERL SCRIPT, SO     +
+ IF YOU DON’T LIKE THAT, UNINSTALL IT!     +
+                                           +
+ Other static items have been stored in:   +
+ /var/www/html
+                                           +
+ If these paths do not match your httpd    +
+ installation, correct the definitions     +
+ in your Makefile of HTTP_CGIDIR and       +
+ HTTP_DOCSDIR                              +
+                                           +
+——————————————-+
—————————————————————
二.编辑Asterisk的配置文件:
Asterisk的体系比较巨大,目前只是稍微的了解一下,所以只是做了最最最简单的测试配置,为了通过SIP协议使两个终端注册上来并互相呼叫通话而已,因此配置相当有限,仅仅是为了初步的测试而已。还有一个地方要注意的是在Asterisk配置文件中的注释符是采用“;”分号的,而不是其他符号。

1.编辑Asterisk的主配置文件:
[root@asterisk-test1 ~]# vi /etc/asterisk/asterisk.conf 
主配置文件是Asterisk的关键部分,这个主配置文件大多数都是为Asterisk指定了环境、调用的路径。一般情况下不需要去改动它,这里贴出来先看看。
—————————————————————
[directories]
小节directories主要记录Asterisk的几个重要调用路径
astetcdir => /etc/asterisk
指定了配置文件路径。
astmoddir => /usr/local/asterisk/lib/asterisk/modules
指定了模块调用路径。
astvarlibdir => /var/lib/asterisk
astdatadir => /var/lib/asterisk
指定了本地数据库以及一些重要相关部件的路径。
astagidir => /var/lib/asterisk/agi-bin
指定了AGI程序的调用路径。
astspooldir => /var/spool/asterisk
指定了呼叫信息记录存放的路径。
astrundir => /var/run
指定了PID文件路径。
astlogdir => /var/log/asterisk
指定了日志路径。

;[options]
;internal_timing = yes
;systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues
; Changing the following lines may compromise your security.
;[files]
;astctlpermissions = 0660
;astctlowner = root
;astctlgroup = apache
;astctl = asterisk.ctl
小节options中记录的都是Asterisk一些可选的设置信息,务必要根据实际情况修改,这里我就先不做变动了。
—————————————————————

2.配置SIP对象配置文件:
[root@asterisk-test1 ~]# vi /etc/asterisk/sip.conf
—————————————————————
;
; SIP Configuration example for Asterisk
;
; Syntax for specifying a SIP device in extensions.conf is
; SIP/devicename where devicename is defined in a section below.
;
; You may also use
; SIP/username@domain to call any SIP user on the Internet
; (Don’t forget to enable DNS SRV records if you want to use this)
;
; If you define a SIP proxy as a peer below, you may call
; SIP/proxyhostname/user or SIP/user@proxyhostname
; where the proxyhostname is defined in a section below
;
; Useful CLI commands to check peers/users:
; 这里注释的部分中还提供一些关于SIP部分的调试命令。用户将可以在Asterisk控制台当中使用。
;
;   sip show peers              Show all SIP peers (including friends)
    显示所有的SIP对端,包括友端。
;   sip show users              Show all SIP users (including friends)
    显示所有的SIP用户端,包括友端。
;   sip show registry           Show status of hosts we register with
    显示所有注册主机的信息。
;   sip debug                    Show all SIP messages
    显示所有SIP消息。    
;
;   reload chan_sip.so          Reload configuration file
                                Active SIP peers will not be reconfigured
    重新载入SIP的配置文件(也可以通过“sip reload”来实现),而已在线的活动用户将不会受到影响。
以下就是SIP配置文件中的定义小节了,每个小节都由[小节名]带起来一段。一个小节就可以是一套独立的配置信息,多个小节可以使得Asterisk同时拥有并且运行好几套配置,为不同的需求和对象组进行服务。这里我已经删去很多默认的配置,只留下一些清洗简短地条目做做说明。

[general]
这段默认的小节名就是“general”。直到下一个小节名出线,这些都是“general”小节的配置内容。与其他不同的是“general”小节是sip.conf配置文件中的“全局配置”段,也就是说其他的小节没有明确定义的、缺省的属性及配置项都将继承参考该段内的配置。
context=default                 ; Default context for incoming calls
此项指定该配置段将在拨号规则文件当中(extensions.conf)使用的哪一套拨号规则。如这里的“default”就是对应指定了extensions.conf文件中的[default]段的拨号规则。extension.conf拨号配置文件中也可以同时定义不同的段。
allowguest=yes                  ; Allow or reject guest calls (default is yes)
allowoverlap=yes                ; Disable overlap dialing support. (Default is yes)

bindport=5060                   ; UDP Port to bind to (SIP standard port is 5060)
                                      ; bindport is the local UDP port that Asterisk will listen on
指定了Asterisk对SIP协议的监听端口,默认为标准的5060,并且这个端口是UDP端口。
bindaddr=0.0.0.0                ; IP address to bind to (0.0.0.0 binds to all)
指定了Asterisk监听SIP协议的网络接口,这里设定为系统上全部的网络接口。
srvlookup=yes                   ; Enable DNS SRV lookups on outbound calls
设定启用域名检索功能。在针对一些IP不确定但是域名确定的对象时候,可以在配置当中直接写入对象的域名,然后Asterisk遇到这种情况就会去DNS解析。否则,将不会解析。
以下为设定编解码部分了

disallow=all                    ; First disallow all codecs
首先关闭掉所有编解码。

allow=g729
然后启用G.729的编解码。先全部关闭再开启指定编解码的原因是要明确指定Asterisk使用的编解码。这里也可以允许多个编解码,然后在呼叫过程中终端就会进行编解码协商,这里我先指定好就是用G.729的编解码。
用户定义小节:以下就是我自定义的SIP配置段了。
[sip](!)
首先我定义了名字为“sip”的小节,但是后面却跟上了“(!)”,这样做是为将“sip”小节作为一个“抽象类” 来定义。抽象类自己不是实体,但是它可以包含一系列属性。然后凡是需要继承这些属性作为“公共属性”的实体对象就可以引用这个类。当遇到多个包含有相同属性的对象要进行定义的时候,就不需要在每个对象上反复加上相同的属性,而是只要引用这个“抽象类”,然后就可以获得想要的“公共属性了”。
allow=g729
指定编解码为G.729。
type=friend
指定类型为Friend“友端”,即可以对Asterisk进行呼叫也可以被Asterisk呼叫的这种双向类型终端。
其他的还有Peer“对端”,即只能作为被Asterisk呼叫的类型终端。
以及的还有User“用户端”,即只能作为呼叫Asterisk的类型终端。
host=dynamic
指定终端主机位置。这里可以取2种值:
static“静态”表示服务的终端对象的IP是固定已知的;
dynamic“动态”表示服务的终端对象IP是动态的不确定的,每次要联系Asterisk的话就必须要注册上来。
nat=yes
指定终端对象是否会在NAT之下。如果对象是散户的话这里普遍都是Yes吧,如果对象是公网上的对接系统的话就no咯。
canreinvite=no
设定是否允许终端发起重新邀请。大体上来讲,终端从开始呼叫直到切断,当中第一次邀请对方进行呼叫请求之后的任何请求动作都视为“重新邀请”,一般都对这种行为做到严格控制而设定为no。
context=demo
指定该段内的对象所使用的拨号规则,全部对应extensions.conf文件中的[demo]小节内定义的规则。

[9901](sip)
这里定义了名字为“9901”的小节,后面却跟“(sip)”,这表示该段定义的对象将继承[sip]定义段内的属性。
username=9901
指定该对象的用户名。
secret=123456
指定该对象的密码。

[9902](sip)
username=9902
secret=123456
同样,对象9902也继承sip抽象类中的公共属性。
—————————————————————

3.配置拨号规则配置文件
[root@asterisk-test1 ~]# vi /etc/asterisk/extensions.conf
—————————————————————
配置方式也是同样,通过定义每一个小节,再在每一个小节中定义详细的属性。
这里比较重要的是“general”和“globals”这两个默认就有的小节,也是起到“全局属性”的作用,请根据实际情况确定,但请不要删除这两个小节。其他的小节都是可以订制、删除修改的。
[general]
static=yes
writeprotect=no
autofallthrough=no
clearglobalvars=no
priorityjumping=no
[globals]
CONSOLE=Console/dsp                             ; Console interface for demo
IAXINFO=guest                                   ; IAXtel username/password
TRUNK=Zap/g2                                    ; Trunk interface
TRUNKMSD=1                                      ; MSD digits to strip (usually 1 or 0)

其他的不重要的小节我都删除了,这里我自定义一个简单的拨号规则。小节取名为“demo”,与sip.conf里面的context项中指定的规则小节名对应。
[demo]
exten => _99.,1,Dial(SIP/${EXTEN},20,r)
说明:
(1)规则就一条,使得9901和9902可以互相拨打。当中的格式简要讲述一下。更多的请参考Asterisk的手册,这里不详细展开。
(2)开头部分“exten =>”表示,也可以用“exten =”表示。并且在一个小节内可以定义多条exten语句。
(3)之后的“_99.”表示匹配上所有“99”开头的拨号,“.”表示不限制长度的任意字符。
(4)然后的“1”表示优先级,我喜欢称作为“执行次序”。“1”表示第一步执行的意思,如果后续还需要执行其他动作的话,可以继续写多条exten语句,并且用递增执行次序依次设计下去。
(5)接着的“Dail()”表示“执行动作”,这里是表示拨号的执行动作。更规范的说,这个是APP应用程序。
(6)括号当中又分成3个部分。第一个SIP表示拨号动作中拨向的通道是SIP协议的通道。${EXTEN}则一个变量,其值就是用户实际拨打的号码。如果你拨打9901那么${EXTEN}的值就是9901。
(7)括号内的“20”,表示等待时间单位秒,如果有多个执行次序,即一组拨号规则的话,如果过了20秒,就跳跃执行次序(跳跃的幅度是101个优先级)。
(8)最后的“r”表示强行播放振铃。在拨打对方等待对方接通的时候,就能听到回振铃音。
—————————————————————
三.对Asterisk服务的操作:
1.手动启动Asterisk
[root@asterisk-test1 ~]# /usr/local/asterisk/sbin/safe_asterisk 
注意,启动脚本是“safe_asterisk”,当启动起来后察看进程也能看到这个名字的进程。

2.察看Asterisk进程
[root@asterisk-test1 ~]# ps -A|grep asterisk
—————————————————————
2454 pts/1    00:00:00 safe_asterisk
2459 pts/1    00:00:14 asterisk
—————————————————————
当Asterisk正常启动后,应该可以看到这两个进程。

3.关闭Asterisk进程
这种方式比较土,比较不建议采用。
[root@asterisk-test1 ~]# killall safe_asterisk
[root@asterisk-test1 ~]# killall asterisk

4.也可以通过/etc/init.d/的方式对服务进行操作
[root@asterisk-test1 init.d]# service asterisk stop
Shutting down asterisk: Asterisk ended with exit status 0
Asterisk shutdown normally.
                                                                [  OK  ]
[root@asterisk-test1 init.d]# service asterisk start
Starting asterisk:                                         [  OK  ]
默认情况下1.4.5版本的Asterisk会自动安装启动脚本,但是请务必确认Asterisk执行路径。如之前我不能使用service脚本命令就是因为路径不对:
[root@asterisk-test1 init.d]# service asterisk stop
ERROR: /usr/sbin/asterisk not found
请确认Asterisk执行路径
[root@asterisk-test1 ~]# vi /etc/init.d/asterisk 
—————————————————————
# Use this option to specify a different configuration directory
AST_CONFIG=/etc/asterisk
指定Asterisk程序对配置文件连接的路径。
# Installation directory
AST_SBIN=/usr/local/asterisk/sbin
这里就是指定Asterisk程序的执行路径。
# Uncomment the following and set them to the user/groups that you
# want to run Asterisk as. NOTE: this requires substantial work to
# be sure that Asterisk’s environment has permission to write the
# files required  for  its  operation, including logs, its comm
# socket, the asterisk database, etc.
#AST_USER=”asterisk”
#AST_GROUP=”asterisk”
这里就是指定Aseterisk的运行用户。为了让系统更加的安全,自己添加Asterisk运行用户和组,并让Asterisk指定它。
—————————————————————
四.控制台操作:
1.进入Asterisk监控台
[root@asterisk-test1 ~]# /usr/local/asterisk/sbin/asterisk -crvvvvvvv
控制台是对Asterisk进行调试的重要工具,在里面可以看到重要的信息,已经可以对Asterisk采取必要的操作。
—————————————————————
Asterisk 1.4.5, Copyright (C) 1999 - 2007 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
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.
=========================================================================
  == Parsing ’/etc/asterisk/asterisk.conf’: Found
  == Parsing ’/etc/asterisk/extconfig.conf’: Found
Connected to Asterisk 1.4.5 currently running on asterisk-test1 (pid = 2459)
Verbosity is at least 14
    – Remote UNIX connection
asterisk-test1*CLI> 
这个就是控制台的命令提示符。
—————————————————————

2.察看Asterisk命令的用法
[root@asterisk-test1 ~]# /usr/local/asterisk/sbin/asterisk -help
—————————————————————
Asterisk 1.4.5, Copyright (C) 1999 - 2007, Digium, Inc. and others.
Usage: asterisk [OPTIONS]
语法: asterisk [选项]
Valid Options:
可用选项(这里只交代一些常用的)
   -V              Display version number and exit
                   显示版本号以及各种数据信息,可以跟加多个v参数以显示更加详细信息。
   -C <configfile> Use an alternate configuration file
                   连接指定配置文件。注意这个C是大写的。   
   -c              Provide console CLI
                   提供命令行接口。进控制台当然要使用命令行,所以这个参数是必要的。注意这个c是小写的。
   -r              Connect to Asterisk on this machine
                   连接服务器本地的Asterisk。
   -R              Connect to Asterisk, and attempt to reconnect if disconnected
                   连接到Asterisk,并且在断开连接的时候尝试重新连接。
   -x <cmd>        Execute command <cmd> (only valid with -r)
                   与-r参数连用,后面跟上命令名称,可以执行命令。比如asterisk -rx ”restart now”。
—————————————————————

3.一些控制台经常使用的命令:
—————————————————————
sip reload                  重新载入sip.conf配置文件。
extensions reload       重新载入extensions.conf配置文件。
sip show peers          察看SIP对端,友端对象信息。
sip show users          察看SIP用户端,友端对象信息。
等等…还有很多,这里就不详细讲了。
—————————————————————
五.测试:
使用eyebeam注册9901和9902这两个SIP用户到Asterisk上去,并且使其互相呼叫并通话。
1.首次注册成功
—————————————————————
[Oct 25 10:39:47] NOTICE[2490]: chan_sip.c:14586 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 9902
这里表示接收到SIP用户9902的注册信息。
[Oct 25 10:40:26] NOTICE[2490]: chan_sip.c:14586 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 9902
[Oct 25 10:41:35] NOTICE[2490]: chan_sip.c:14586 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 9901
这里表示接收到SIP用户9901的注册信息。
[Oct 25 10:41:44] NOTICE[2490]: chan_sip.c:14586 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 9902
[Oct 25 10:43:32] NOTICE[2490]: chan_sip.c:14586 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 9901
—————————————————————

2.检查注册状况:
asterisk-test1*CLI> sip show peers
—————————————————————
Name/username              Host            Dyn Nat ACL Port     Status               
9902/9902                  192.168.0.20     D   N      17900    Unmonitored 
用户9902已经注册上来,并且主机地址为192.168.0.20,发起端口是17900,非监视。
9901/9901                  192.168.0.199    D   N      35028    Unmonitored
用户9901已经注册上来,并且主机地址为192.168.0.199,发起端口是35028,非监视。
2 sip peers [Monitored: 0 online, 0 offline Unmonitored: 2 online, 0 offline]
提示2个SIP对端在线,处于非监视状态。
asterisk-test1*CLI> 
—————————————————————

3.从控制台中察看该2个用户的正常注册信息:
—————————————————————
[Oct 25 11:13:50] NOTICE[2490]: chan_sip.c:14586 handle_request_subscribe: 
    – Unregistered SIP ’9901′
    – Registered SIP ’9901′ at 192.168.0.199 port 57090 expires 60
       用户9901从地址192.168.0.199端口57090登入,超时时间为60秒。

    – Saved useragent ”eyeBeam release 1004p stamp 31962″ for peer 9901
       用户代理程序是eyeBeam。
    – Unregistered SIP ’9902′
    – Registered SIP ’9902′ at 192.168.0.20 port 59236 expires 60
       用户9902从地址192.168.0.20端口59236登入,超时时间为60秒。

    – Saved useragent ”eyeBeam release 1004p stamp 31962″ for peer 9902
       用户代理程序是eyeBeam。
—————————————————————

4.成功呼叫接通:
从9901呼叫9902,并且我这里做一些简单的信息分析。
—————————————————————
    – Executing [9902@demo:1] Dial(”SIP/9901-09a56000″, ”SIP/9902|20|r”) in new stack
        执行呼叫,拨打9902。

    – Called 9902
        被叫方9902。

    – SIP/9902-09a17100 is ringing
        通过SIP通道呼叫9902,并且正在震铃。
    – SIP/9902-09a17100 answered SIP/9901-09a56000
        SIP的9902终端应答了SIP的9901终端。

    – Packet2Packet bridging SIP/9901-09a56000 and SIP/9902-09a17100
        在SIP9901和SIP9902之间建立了P2P通道。

  == Spawn extension (demo, 9902, 1) exited non-zero on ’SIP/9901-09a56000′
        9901挂断。
—————————————————————

从9902呼叫9901,并且我这里做就不重复做相同的分析了。
—————————————————————
    – Executing [9901@demo:1] Dial(”SIP/9902-09a54548″, ”SIP/9901|20|r”) in new stack
    – Called 9901
    – SIP/9901-09a56000 is ringing
    – SIP/9901-09a56000 answered SIP/9902-09a54548
    – Packet2Packet bridging SIP/9902-09a54548 and SIP/9901-09a56000
  == Spawn extension (demo, 9901, 1) exited non-zero on ’SIP/9902-09a54548′
       9901挂断。
—————————————————————
五.遇到的问题:
问题1:呼叫失败。提示为在extension中没有“Dail”这个应用程序。
原因:在extensions.conf中“Dial”误写成“Dail”。
—————————————————————
[Oct 25 10:21:01] WARNING[3363]: pbx.c:1797 pbx_extension_helper: No application ’Dail’ for extension (demo, 9902, 1)
  == Spawn extension (demo, 9902, 1) exited non-zero on ’SIP/9901-09a547d0′
—————————————————————

问题2:呼叫失败(但是反向呼叫却可以成功。)
原因:用户9901和9902的编码不统一,在sip.conf中强行指定使用相同编解码后呼叫以及通话功能正常。
—————————————————————
    – Executing [9902@demo:1] Dial(”SIP/9901-09a17100″, ”SIP/9902|20|r”) in new stack
    – Called 9902> 
    – SIP/9902-09a56000 is circuit-busy
  == Everyone is busy/congested at this time (1:0/1/0)
[Oct 25 11:25:10] WARNING[2490]: chan_sip.c:12428 handle_response: Remote host can’t match request BYE to call ’768cfe882651862a21c804946cb8dc43@192.168.0.148′. Giving up.
—————————————————————

问题3:电话单向打通,并且提示使用未知编码。
原因:用户9901和9902的编码不统一,在sip.conf中强行指定使用相同编解码后呼叫以及通话功能正常。
—————————————————————
    – Executing [9901@demo:1] Dial(”SIP/9902-09a17100″, ”SIP/9901|20|r”) in new stack
    – Called 9901> 
    – SIP/9901-09a56000 is ringing
[Oct 25 11:22:25] WARNING[2490]: channel.c:2947 set_format: Unable to find a codec translation path from g729 to gsm
                                                                           关键提示:找不到一个能够将G.729转成GSM的编解码途径。

[Oct 25 11:22:25] WARNING[2490]: channel.c:2947 set_format: Unable to find a codec translation path from g729 to gsm
    – SIP/9901-09a56000 answered SIP/9902-09a17100
    – Packet2Packet bridging SIP/9902-09a17100 and SIP/9901-09a56000
    – Started music on hold, class ’default’, on SIP/9901-09a56000
[Oct 25 11:22:35] WARNING[3892]: channel.c:2947 set_format: Unable to find a codec translation path from g729 to slin
[Oct 25 11:22:35] WARNING[3892]: res_musiconhold.c:247 ast_moh_files_next: Unable to open file ’/var/lib/asterisk/moh/fpm-calm-river’: No such file or directory
    – Stopped music on hold on SIP/9901-09a56000
[Oct 25 11:22:43] NOTICE[3892]: rtp.c:1274 ast_rtp_read: Unknown RTP codec 126 received from ’192.168.0.20′
                                                                    关键提示:从192.168.0.20上收到未知的RTP编码。

[Oct 25 11:22:50] NOTICE[3892]: rtp.c:1274 ast_rtp_read: Unknown RTP codec 126 received from ’192.168.0.20′
Internal RTCP NTP clock skew detected: lsr=2324207771, now=2324324243, dlsr=176881 (2:698ms), diff=60409
Internal RTCP NTP clock skew detected: lsr=2324207771, now=2324534751, dlsr=401014 (6:118ms), diff=74034
Internal RTCP NTP clock skew detected: lsr=2324535463, now=2324702191, dlsr=223805 (3:414ms), diff=57077
—————————————————————
根据关键提示,很明显,是和编解码有关的问题。

初次的试验比较顺利,虽然它很简单并且在过程中也遇到了些问题,但是自己都可以解决。

转载于:https://www.cnblogs.com/pipelone/archive/2009/05/13/1455971.html

相关文章:

  • 网站收集
  • sql语句说明
  • [转]数据库操作,内外联查询,分组查询,嵌套查询,交叉查询,多表查询,语句小结。...
  • 照着这些做,生活自然很开心
  • 后缀表达式相关内容
  • 《论语》原文及其全文翻译 学而篇9
  • discuz 论坛的详细介绍(转载)
  • C#通过shell32来控制本地连接
  • 未能加载文件或程序集 XXX 或它的某一个依赖项
  • Jeffrey Richter开始写CLR Via C#第三版了
  • 每一份生存的背后都是汗水
  • N×N矩阵螺旋打印输出的OO算法
  • lucene.net应用大全
  • 他们在创新,我们在做什么?
  • [翻译]XNA 3.0 Game Programming Recipes之twenty-two
  • [Vue CLI 3] 配置解析之 css.extract
  • 【162天】黑马程序员27天视频学习笔记【Day02-上】
  • axios 和 cookie 的那些事
  • canvas 五子棋游戏
  • CentOS7 安装JDK
  • HTML5新特性总结
  • JS专题之继承
  • mongodb--安装和初步使用教程
  • mongo索引构建
  • PAT A1050
  • PHP 使用 Swoole - TaskWorker 实现异步操作 Mysql
  • rc-form之最单纯情况
  • v-if和v-for连用出现的问题
  • Vue全家桶实现一个Web App
  • 从0实现一个tiny react(三)生命周期
  • - 概述 - 《设计模式(极简c++版)》
  • 将 Measurements 和 Units 应用到物理学
  • 开年巨制!千人千面回放技术让你“看到”Flutter用户侧问题
  • 看完九篇字体系列的文章,你还觉得我是在说字体?
  • 那些年我们用过的显示性能指标
  • 前端
  • 浅谈Golang中select的用法
  • 一道面试题引发的“血案”
  • 一份游戏开发学习路线
  • FaaS 的简单实践
  • Java总结 - String - 这篇请使劲喷我
  • Spark2.4.0源码分析之WorldCount 默认shuffling并行度为200(九) ...
  • ###STL(标准模板库)
  • #define用法
  • (1)STL算法之遍历容器
  • (2)STL算法之元素计数
  • (DenseNet)Densely Connected Convolutional Networks--Gao Huang
  • (转)EXC_BREAKPOINT僵尸错误
  • .mkp勒索病毒解密方法|勒索病毒解决|勒索病毒恢复|数据库修复
  • .NET 设计模式—简单工厂(Simple Factory Pattern)
  • .NET开发人员必知的八个网站
  • .php结尾的域名,【php】php正则截取url中域名后的内容
  • @EnableConfigurationProperties注解使用
  • @hook扩展分析
  • @RequestMapping-占位符映射