使用SIP.js进行有人值守的转移

时间:2015-12-07 12:49:01

标签: sip sipjs

早上好,我需要使用SIP.js进行有人值守的转移。有人成功完成了这项任务吗? 我现在只能进行盲转,我发现有一篇文章报道在版本0.7.x中支持有人参加转移槽替换命令。

https://www.onsip.com/blog/sipjs-070-adds-fixes-and-support-for-attended-transfer-recommended-upgrade

2 个答案:

答案 0 :(得分:0)

也许为时已晚,但我为未来写了答案。我按照这个步骤做到了:

  • 将当前会话保存在其他变量中,例如var holded_session = session;
  • 在当前会话暂停时调用,session.hold()
  • 拨打新电话ua.invite()
  • make transfer session.refer(holded_session)

文档中没有记录函数hold()unhold(),但是当您将会话输出到控制台时,您会在其中看到它。

答案 1 :(得分:0)

我以这种方式解决了音频问题

    sessionOne.hold();//already exists previously


    var uri = phone + '@' + sip_server;
    var options = {
       media: {
           constraints: {
               audio: true,
               video: false
           },
           render: {
               remote: document.getElementById('audio-output')
           },
           stream: mediaStream
       },
       extraHeaders: [...],
       inviteWithoutSdp: true,
       rel100: SIP.C.supported.SUPPORTED,
       activeAfterTransfer: false //die when the transfer is completed
   };

   sessionTwo = userAgent.invite(uri, options);
   //if yo want handle the transfer at the application level, then implements the handler events as on('refer', function(request) {}) for the session object
   ...
   sessionOne.refer(sessionTwo);//session two already must is accepted (sip server)