简体   繁体   English

sipml5中拨入电话的重写功能

[英]rewriting function for incoming calls in sipml5

Hi guys I want to rewrite incoming call part from official guide sipml5. 嗨,大家好,我想改写官方指南sipml5的来电部分。 I want to create separate function without html elements. 我想创建没有html元素的单独函数。 Below you can find my codes. 您可以在下面找到我的代码。 The button triggers function when the call is coming, but I want to create separate function without html elements and use this function inside of my code. 当调用即将来临时,按钮会触发函数,但是我想创建一个没有html元素的单独函数,并在我的代码中使用此函数。

Here is incoming call case statement: 这是来电案例说明:

 case 'i_new_call':
    {
        if (oSipSessionCall) {
            // do not accept the incoming call if we're already 'in call'
            e.newSession.hangup(); // comment this line for multi-line support
        }
        else {
            oSipSessionCall = e.newSession;
            oSipSessionCall.setConfiguration(oConfigCall);
            uiBtnReceive('Answer');
            startRingTone();

            var sRemoteNumber = (oSipSessionCall.getRemoteFriendlyName() || 'unknown');
            txtCallStatus.innerHTML = "<i>Incoming call from [<b>" + sRemoteNumber + "</b>]</i>";
            showNotifICall(sRemoteNumber);
        }
        break;

And the function is: 函数是:

function uiBtnReceive(m_text) {
    if (m_text == "Answer") {
        btnAccept.value = btnAccept.innerHTML = m_text;
        btnAccept.onclick = function () { sipCall('call-audio'); };
    }
}

My problem here is when I am not using button onclick the function is triggered them-self. 我的问题是,当我不使用按钮onclick时,功能会自行触发。 Any idea how can I do this? 知道我该怎么做吗?

I solved this problem and would like write this maybe will be useful for someone. 我解决了这个问题,想写这篇文章也许对某人有用。 My issue was when I called function without any event, the incoming calls accepted directly without calling function ( My main problem was avoiding from human action). 我的问题是,当我在没有任何事件的情况下调用函数时,传入的调用直接被接受而没有调用函数(我的主要问题是避免人为干预)。 But the problem is that you will get browser error each time if you will not use any event handler here. 但是问题是,如果您在此处不使用任何事件处理程序,则每次都会出现浏览器错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM