Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very slow proxy #99

Open
FerdinandvHagen opened this issue Oct 24, 2015 · 3 comments
Open

Very slow proxy #99

FerdinandvHagen opened this issue Oct 24, 2015 · 3 comments

Comments

@FerdinandvHagen
Copy link

Hey,

I am trying to build a very basic proxy to send Notifications to a phone when someone is trying to call. The problem is that Microsoft doesn't allow an app to run in the background on Windows Phone to wait for a call as you would need for VOIP. You have to send a notification to the phone which launches the app and then you have to do the Register stuff, etc. I know mainly two Apps right now, one of them being Linphone.

I have a basic example working. The only problem I currently have is that there is an extreme delay between the calls. Especially if I try to send a message from my sip.js to the SIP-Server. Everything else like 'INVITE', 'ACK', etc. seems to be delivered nearly instantaneously. But the REGISTER takes about 35 seconds until the packet gets forwarded to the SIP-Server.

My current code:

proxy.start({
    logger: {
        recv: function (m) { console.error('recv PROXY: ' + util.inspect(m, null, null)); },
        send: function (m) { console.error('send PROXY: ' + util.inspect(m, null, null)); },
        error: function (e) { console.error(e.stack); }
    }
}, function (rq) {
    if (rq.method == 'INVITE') {
        util.debug('INVITING: ' + rq.uri);

        var uri = sip.parseUri(rq.uri);
        console.error(util.inspect(uri, null, null));

        if (uri.params['pn-type'] != undefined && uri.params['pn-type'] == 'wp') {
            wns.sendIncomingCallNotification('http://' + uri.params['app-id'] + uri.params['pn-tok'], function (error, response, body) {
                if (error) {
                    console.log(error);
                } else {
                    console.log(response.statusCode, 'Other function');
                }
            });
        }
    }

    if (rq.method == 'REGISTER') {
        proxy.send(sip.makeResponse(rq, 100, 'TRYING'));
    }

    proxy.send(rq);
});

If I leave the 'TRYING' out my phone goes completely into rage mode as it gets no answers.

Any ideas?

Thank you very much

Ferdinand

@FerdinandvHagen
Copy link
Author

OK. Seems that this is related to Issue #94. Just tried and entered the IP-address of sipgate.de into the phone instead of the Name and now it works exactly like I wish it would. Whole 'REGISTER' process only takes a second or two.

Is it possible that every occurrence of sipgate.de in the packet is causing a full SIP-address search?

@kirm
Copy link
Owner

kirm commented Oct 26, 2015

No, sip.js only resolves uri it determined to be address of next hop server. And unfortunately I don't have any means to speed up name resolution.

@FerdinandvHagen
Copy link
Author

Hmm. Ok. I will try to dig a little bit deeper. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants