0
  • 我们将 Sipjs 用于聊天应用程序。
  • SipJs 可以与 Lollipop、Marshmallow 等更高版本的 Android kitkat 配合使用。但不适用于 kitkat。
  • 实际上是内部调用本机操作系统浏览器的 Kony 浏览器。此应用程序在本机 chrome 浏览器中运行良好。
  • 有人,请帮助我。

    Client1.html
    (function () {
             var queue= [];
             var ipaddress="1111";
             var url=ipaddress+"@sipjs.onsip.com";
            var sysIpaddress="2222"+"@sipjs.onsip.com";
                 var userAgent = new SIP.UA({
            traceSip: true,
            uri: sysIpaddress,
            displayName: ipaddress,
            register:false  
        });
        var aliceInput=document.getElementById('alice-message-input');
        var aliceButton=document.getElementById('alice-message-button');
        aliceButton.addEventListener('click', function () {
          if(userAgent.isConnected()){
            sendMessage();
        }
    }); 
    function sendMessage() {
            var msg = aliceInput.value;
            // Only send a message if the message is non-empty
            if (msg !== '') {
                aliceInput.value = '';
                userAgent.message(url, msg);
            }
      }
    }) ();
    

     Client2.html
    (function () {
      var queue= {
        'queueArray':[]
      }
     var ipaddress="2222";
     var url=ipaddress+"@sipjs.onsip.com";
     var sysIpaddress="1111"+"@sipjs.onsip.com";
        var userAgent = new SIP.UA({
            traceSip: true,
            uri: sysIpaddress,
            displayName: ipaddress,
            register:true 
        });
        var aliceInput=document.getElementById('alice-message-input');
      userAgent.on('message', function (msg) {
        var userAgentreceivertextarea=document.getElementById('alice-message-output');
        userAgentreceivertextarea.value=msg.body;
      });
    }) ();

实际上,它发送但不接收消息。

TraceSip 日志:

 [INFO:CONSOLE(36)] "Mon Oct 03 2016 11:16:58 GMT+0530 (IST) | sip.transport | sending WebSocket message:
 MESSAGE sip:1111@sipjs.onsip.com SIP/2.0
 Via: SIP/2.0/WSS 29pclh5bd8j9.invalid;branch=z9hG4bK3748080
 Max-Forwards: 70
 To: <sip:1111@sipjs.onsip.com>
 From: "1111" <sip:2222@sipjs.onsip.com>;tag=7dsaoa1ptu
 Call-ID: 3cq7v58lhccl09f16c6o
 CSeq: 3235 MESSAGE
 Content-Type: text/plain
 Supported: outbound
 User-Agent: SIP.js/0.7.0
 Content-Length: 3

 Hai
 ", source: file:///android_asset/sip-0.7.0.min.js (36)



 [INFO:CONSOLE(36)] "Mon Oct 03 2016 11:16:58 GMT+0530 (IST) | sip.transport | received WebSocket text message:
 SIP/2.0 404 Not Found
 Via: SIP/2.0/WSS 29pclh5bd8j9.invalid;branch=z9hG4bK3748080
 To: <sip:1111@sipjs.onsip.com>;tag=3e56624696354839164e94cd00148538.7ca4
 From: "1111" <sip:2222@sipjs.onsip.com>;tag=7dsaoa1ptu
 Call-ID: 3cq7v58lhccl09f16c6o
 CSeq: 3235 MESSAGE
 Server: OpenSIPS (1.10.0-notls (x86_64/linux))
 Content-Length: 0

 ", source: file:///android_asset/sip-0.7.0.min.js (36)
4

0 回答 0