gpt4 book ai didi

javascript - 使用基于 sip.js 的 webrtc 应用程序和 asterisk 11.11.0 时,chrome 没有音频。与 Firefox 和 Opera 配合良好

转载 作者:行者123 更新时间:2023-12-03 12:08:19 27 4
gpt4 key购买 nike

我正在使用 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)

Asterisk 配置:

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>

请帮我调试 chrome 浏览器没有音频的问题。

任何帮助将不胜感激。

问候,

拉古文德拉·库马尔

最佳答案

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

谢谢.!!!!!

关于javascript - 使用基于 sip.js 的 webrtc 应用程序和 asterisk 11.11.0 时,chrome 没有音频。与 Firefox 和 Opera 配合良好,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25080451/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com