我无法注册FreeSwitch服务器&无法使用 SIPml5 SIP客户端呼叫SIP客户端(XLite)。
以下是我的HTML5代码:
<!DOCTYPE html>
<html>
<head>
<meta content="charset=utf-8"/>
<script type="text/javascript" src="SIPml-api.js"></script>
<title>SIP Client 1</title>
<script type="text/javascript">
window.onload = function()
{
var readyCallback = function(e){
createSipStack(); // see next section
};
var errorCallback = function(e){
console.error('Failed to initialize the engine: ' + e.message);
}
SIPml.init(readyCallback, errorCallback);
console.info("WINDOW ONLOAD");
}
var sipStack;
function createSipStack()
{
var eventsListener = function(e)
{
if(e.type == 'started')
{
login();
}
else if(e.type == 'i_new_message')
{
acceptMessage(e);
}
else if(e.type == 'i_new_call')
{
acceptCall(e);
}
}
sipStack = new SIPml.Stack(
{
realm: '192.168.1.33', // mandatory: domain name
impi: '1001', // mandatory: authorization name (IMS Private Identity)
impu: 'sip:1001@192.168.1.33', // mandatory: valid SIP Uri (IMS Public Identity)
password: '1234',
display_name: 'Osama', // optional
enable_rtcweb_breaker: true,
events_listener: { events: '*', listener: eventsListener } // optional: '*' means all events
});
sipStack.start();
console.info("CREATE SIP STACK");
}
var registerSession;
var eventsListener = function(e){
console.info('session event = ' + e.type);
if(e.type == 'connected' && e.session == registerSession){
makeCall();
}
}
function login(){
registerSession = sipStack.newSession('register', {
events_listener: { events: '*', listener: eventsListener } // optional: '*' means all events
});
registerSession.register();
console.info("LOGIN");
}
var callSession;
function makeCall()
{
var eventsListener = function(e)
{
console.info('session event = ' + e.type);
}
callSession = sipStack.newSession('call-audiovideo', {
video_local: document.getElementById('video_local'),
video_remote: document.getElementById('video_remote'),
audio_remote: document.getElementById('audio_remote'),
events_listener: { events: '*', listener: eventsListener } // optional: '*' means all events
});
callSession.call('1002');
console.info("MAKE CALL");
}
function acceptCall(e){
e.newSession.accept(); // e.newSession.reject() to reject the call
}
</script>
</head>
<body>
<form method="post" style="height: 197px">
<input name="Button1" type="button" value="Call" onclick="makeCall()">
<input name="Button2" type="button" value="Accept" onclick="acceptCall"><video class="video" id="video_remote" autoplay="autoplay" style="width: 184px; height: 188px"></video>
<audio id="audio_remote" autoplay="autoplay" />
</audio><video class="video" width="88px" height="72px" id="video_local" autoplay="autoplay"></video><span></span></form>
</body>
</html>
以下是我的Chrome控制台输出:
SIPML5 API version = 1.3.203 SIPml-api.js:1
User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36 SIPml-api.js:1
WebSocket supported = yes SIPml-api.js:1
Navigator friendly name = chrome SIPml-api.js:1
OS friendly name = windows SIPml-api.js:1
Have WebRTC = yes SIPml-api.js:1
Have GUM = yes SIPml-api.js:1
Engine initialized SIPml-api.js:1
s_websocket_server_url=(null) SIPml-api.js:1
s_sip_outboundproxy_url=(null) SIPml-api.js:1
b_rtcweb_breaker_enabled=yes SIPml-api.js:1
b_click2call_enabled=no SIPml-api.js:1
b_early_ims=yes SIPml-api.js:1
b_enable_media_stream_cache=no SIPml-api.js:1
o_bandwidth={} SIPml-api.js:1
o_video_size={} SIPml-api.js:1
SIP stack start: proxy='ns313841.ovh.net:10062', realm='<sip:192.168.1.33>', impi='1001', impu='"Osama"<sip:1001@192.168.1.33>' SIPml-api.js:1
Connecting to 'wss://ns313841.ovh.net:10062' SIPml-api.js:1
CREATE SIP STACK default.html:52
WINDOW ONLOAD default.html:21
__tsip_transport_ws_onopen SIPml-api.js:1
State machine: tsip_dialog_register_Started_2_InProgress_X_oRegister SIPml-api.js:1
SEND: REGISTER sip:192.168.1.33 SIP/2.0
Via: SIP/2.0/WSS df7jal23ls0d.invalid;branch=z9hG4bKpMrcuIswwvJBNixNUiHLuVPJA7tXxnrN;rport
From: "Osama"<sip:1001@192.168.1.33>;tag=UAy54NJ9TiBQ4J8hWEn8
To: "Osama"<sip:1001@192.168.1.33>
Contact: "Osama"<sips:1001@df7jal23ls0d.invalid;rtcweb-breaker=yes;transport=wss>;expires=1800;click2call=no
Call-ID: 690d263e-325b-1fc8-5bf7-bc5a545940f1
CSeq: 2210 REGISTER
Content-Length: 0
Max-Forwards: 70
Supported: path
SIPml-api.js:1
LOGIN default.html:68
session event = connecting default.html:58
session event = sent_request default.html:58
State machine: tsip_dialog_register_Any_2_Terminated_X_transportError SIPml-api.js:1
=== REGISTER Dialog terminated === SIPml-api.js:1
session event = transport_error default.html:58
session event = terminated default.html:58
The FSM is in the final state
我遵循了developer guide。 我不知道哪里出错了。我甚至按照here启用了RTCWEB断路器。 请帮我注册FreeSwitch服务器&amp;使用SIPml5客户端呼叫SIP客户端。 XLite注册FreeSwitch&amp;处于准备状态。
答案 0 :(得分:1)
你也设置了ws(web socket): websocket_proxy_url:'ws://192.168.200.10:8088 / ws'
答案 1 :(得分:1)
您需要安装webrtc2sip才能使用网络客户端。我也面临同样的问题,即传输错误,但安装webrtc2sip后,这个问题已经解决。我能够成功连接到FreeSwitch,尽管现在还有其他问题。
安装它转到此链接 - http://code.google.com/p/webrtc2sip/wiki/Building_Source_v2_0
它看起来很冗长,但直截了当。也不要忘记阅读technical guide here.
成功安装后,在终端
中运行此命令sudo netstat -nlpa | grep webrtc
找到webrtc2sip服务器的套接字地址,看起来应该像“192.168.1.2:10060” 并将此地址放在websocket地址前面的代码中。 ws://192.168.1.2:10060 。
答案 2 :(得分:0)
我查看了sipml
源代码,似乎传输实现期望在realm
变量中接收域,但是您直接设置了IP地址。你试图将领域设置为“freeswitch.org”吗?