Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用基于sip.js的webrtc应用程序和asterisk 11.11.0的chrome没有音频。与firefox和Opera配合良好_Javascript_Google Chrome_Audio_Asterisk_Webrtc - Fatal编程技术网

Javascript 使用基于sip.js的webrtc应用程序和asterisk 11.11.0的chrome没有音频。与firefox和Opera配合良好

Javascript 使用基于sip.js的webrtc应用程序和asterisk 11.11.0的chrome没有音频。与firefox和Opera配合良好,javascript,google-chrome,audio,asterisk,webrtc,Javascript,Google Chrome,Audio,Asterisk,Webrtc,我正在使用sip.js和asterisk开发webrtc。我的webrtc应用程序在firefox 31和opera 22.0.1471.70上运行良好。但当我将webrtc应用程序与chrome(版本37.0.2062.58 beta-m(64位))一起使用时。一切似乎都很好,但没有音频。我还试用了32个版本的最新稳定的chrome浏览器。问题依旧 Setup Details:- 1. Asterisk 32 bit - 11.11.0 2. Sip-0.6.1.js 3. Chrome

我正在使用sip.js和asterisk开发webrtc。我的webrtc应用程序在firefox 31和opera 22.0.1471.70上运行良好。但当我将webrtc应用程序与chrome(版本37.0.2062.58 beta-m(64位))一起使用时。一切似乎都很好,但没有音频。我还试用了32个版本的最新稳定的chrome浏览器。问题依旧

Setup Details:-

1. Asterisk 32 bit - 11.11.0
2. Sip-0.6.1.js 
3. Chrome (Version 37.0.2062.58 beta-m (64-bit)), Firefox 31.0 and opera 22.0.1471.70.
4. Cent O.S 6.5 (32 bit)
星号配置:

http.conf :-

[general]

enabled=yes
bindaddr=0.0.0.0
bindport=8088

sip.conf :-

[1061] ; This will be the legacy SIP client
type=friend
username=1061
host=dynamic
secret=password
context=default


[1090] ; This will be WebRTC client
type=friend
username=1090 ; The Auth user for SIP.js
host=dynamic ; Allows any host to register
secret=testsip ; The SIP Password for SIP.js
encryption=yes ; Tell Asterisk to use encryption for this peer
avpf=yes ; Tell Asterisk to use AVPF for this peer
icesupport=yes ; Tell Asterisk to use ICE for this peer
context=default ; Tell Asterisk which context to use when this peer is dialing
directmedia=no ; Asterisk will relay media for this peer
transport=udp,ws ; Asterisk will allow this peer to register on UDP or WebSockets
force_avp=yes ; Force Asterisk to use avp. Introduced in Asterisk 11.11
dtlsenable=yes ; Tell Asterisk to enable DTLS for this peer
dtlsverify=no ; Tell Asterisk to not verify your DTLS certs
dtlscertfile=/etc/asterisk/keys/asterisk.pem ; Tell Asterisk where your DTLS cert file is
dtlsprivatekey=/etc/asterisk/keys/asterisk.pem ; Tell Asterisk where your DTLS private key is
dtlssetup=actpass ; Tell Asterisk to use actpass SDP parameter when setting up DTLS
nat=no
disallow=all
allow=ulaw

extension.conf 
[default]
exten => 1060,1,Dial(SIP/1060) ; Dialing 1060 will call the SIP client registered to 1060
exten => 1061,1,Dial(SIP/1061) ; Dialing 1061 will call the SIP client registered to 1061
webrtc应用程序代码:-

call.js code:-

( function()
  {
     var session;

     var endButton = document.getElementById('endCall');

     endButton.addEventListener("click", function ()
                                         {
                                            session.bye();
                                            alert ("Call Terminated");
                                         }
                                       , false
                               );


     //Registration and websocket connectivity details for the useragent

     var config = {
                        // Asterisk IP address
                        uri: '1090@192.168.56.129',

                        // Asterisk IP address,
                        // and replace the port with your Asterisk port from the http.conf file
                        wsServers: 'ws://192.168.56.129:8088/ws',

                        // Replace this with the username from your sip.conf file
                        authorizationUser: '1090',

                        // Replace this with the password from your sip.conf file
                        password: 'testsip',

                        // Enable sip traces on js console
                        traceSip: true,


                        stunServers: 'null',
                 };


     //Creates the anonymous user agent so that you can make calls
     var userAgent = new SIP.UA (config);

    //Here you determine whether the call has video and audio
     var options = {

                     media: {
                              constraints: {
                                             audio: true,
                                             video: false,
                                           },
                              render: {
                                        remote: {
                                                   audio: document.getElementById('remoteAudio')
                                                },

                                        local:  {
                                                   audio: document.getElementById('localAudio')
                                                }
                                      }
                           }
    };



    function onAccepted ()
    {
        alert("Call Connected");
    }

    function onDisconnected ()
    {
        alert("Call Terminated");
    }


    //makes the call
    session = userAgent.invite('1000', options);
    session.on('accepted', onAccepted);
    //session.on('disconnected', onDisconnected);

  }

)();


SipCall.htm

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="style.css">
  </head>
  <body>
    <audio  id="remoteAudio"></audio>
    <audio  id="localAudio" muted="muted"></audio>
    <button id="endCall">End Call</button>
    <script src="sip-0.6.1.js"></script>
    <script src="call.js"></script>
  </body>
</html>
call.js代码:-
(功能()
{
var会议;
var endButton=document.getElementById('endCall');
endButton.addEventListener(“单击”),函数()
{
session.bye();
警报(“呼叫终止”);
}
,错
);
//useragent的注册和websocket连接详细信息
变量配置={
//星号IP地址
uri:'1090@192.168.56.129',
//星号IP地址,
//并将该端口替换为http.conf文件中的星号端口
wsServers:'ws://192.168.56.129:8088/ws',
//将其替换为sip.conf文件中的用户名
授权用户:“1090”,
//将其替换为sip.conf文件中的密码
密码:“testsip”,
//在js控制台上启用sip跟踪
特雷西普:没错,
服务器:“null”,
};
//创建匿名用户代理,以便您可以进行呼叫
var userAgent=new SIP.UA(配置);
//在这里,您可以确定通话是否包含视频和音频
变量选项={
媒体:{
限制条件:{
音频:是的,
视频:错,
},
呈现:{
远程:{
音频:document.getElementById('remoteAudio')
},
本地:{
音频:document.getElementById('localAudio')
}
}
}
};
函数onAccepted()
{
警报(“呼叫连接”);
}
函数onDisconnected()
{
警报(“呼叫终止”);
}
//打电话
session=userAgent.invite('1000',选项);
会议日期(‘已接受’,已接受);
//会话.on('disconnected',onDisconnected);
}
)();
SipCall.htm
结束通话
请帮助我调试chrome浏览器的无音频问题

我们将非常感谢您的帮助

问候,


Raghuvendra Kumar

您在asterisk server中启用了vp8编解码器,如果没有,请尝试从sip.conf启用vp8编解码器。如果是,则从浏览器复制控制台日志

谢谢