gpt4 book ai didi

javascript - Asterisk sip.js 远程调用

转载 作者:行者123 更新时间:2023-11-29 19:35:56 24 4
gpt4 key购买 nike

我正在使用 Asterisk 12 和 sip.js。我正在尝试从 zoiper(安卓手机)调用 chrome 浏览器

我的梨子是

[6004]
context=default
secret=6004
type=friend
host=dynamic


[1060] ; This will be WebRTC client
type=friend
username=1060 ; The Auth user for SIP.js
host=dynamic ; Allows any host to register
secret=1060 ; 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
videosupport=no
nat=force_rport,comedia

我的 JS 代码是

   var session;
var mediaStream;
var audio = new Audio('ring.mp3');
var config = {
// Replace this IP address with your Asterisk IP address
uri: 'sip:1060@XXX:9091',
// Replace this IP address with your Asterisk IP address,
// and replace the port with your Asterisk port from the http.conf file
ws_servers: 'ws://XXX:9092/ws',
// Replace this with the username from your sip.conf file
authorizationUser: '1060',
// Replace this with the password from your sip.conf file
password: '1060',
// HackIpInContact for Asterisk
hackIpInContact: true
};

var ua = new SIP.UA(config);

ua.on('invite', function(incomingSession) {
session = incomingSession;
audio.play();
prepareToanswer();
});

我可以收到邀请,但是当我接受邀请时,我无法获得音频流。谁能帮帮我?

最佳答案

听起来您的 DTLS 证书可能未正确设置。

    mkdir /etc/asterisk/keys
cd /usr/local/src/asterisk*/contrib/scripts.
./ast_tls_cert -C pbx.mycompany.com -O "My Super Company" -d /etc/asterisk/keys.

将 pbx.mycompany.com 替换为你的 Asterisk 盒子的 ip 地址。

来源:http://sipjs.com/guides/server-configuration/asterisk/

关于javascript - Asterisk sip.js 远程调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25104179/

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