Skip to content
Snippets Groups Projects
Commit fd7593e4 authored by Yun Liu's avatar Yun Liu
Browse files

Check the availability of port 5060

parent 4e09c9de
No related branches found
No related tags found
No related merge requests found
...@@ -113,8 +113,6 @@ pj_status_t UserAgent::sipInit() { ...@@ -113,8 +113,6 @@ pj_status_t UserAgent::sipInit() {
_debug("UserAgent: Unable to check NAT setting\n"); _debug("UserAgent: Unable to check NAT setting\n");
return false; // hoho we can't use the random sip port too... return false; // hoho we can't use the random sip port too...
} }
} else {
//FIXME! check port number availability
} }
_localPort = port; _localPort = port;
...@@ -123,18 +121,27 @@ pj_status_t UserAgent::sipInit() { ...@@ -123,18 +121,27 @@ pj_status_t UserAgent::sipInit() {
stunServerResolve(); stunServerResolve();
_localExternAddress = Manager::instance().getFirewallAddress(); _localExternAddress = Manager::instance().getFirewallAddress();
_localExternPort = Manager::instance().getFirewallPort(); _localExternPort = Manager::instance().getFirewallPort();
errPjsip = createUDPServer();
if (errPjsip != 0) {
_debug("UserAgent: Could not initialize SIP listener on port %d\n", port);
return errPjsip;
}
} else { } else {
_localExternAddress = _localIPAddress; _localExternAddress = _localIPAddress;
_localExternPort = _localPort; _localExternPort = _localPort;
}
errPjsip = createUDPServer(); errPjsip = createUDPServer();
if (errPjsip != 0) { if (errPjsip != 0) {
_debug("UserAgent: Could not initialize SIP listener on port %d\n", port); _debug("UserAgent: Could not initialize SIP listener on port %d\n", _localExternPort);
port = RANDOM_SIP_PORT; _localExternPort = _localPort = RANDOM_SIP_PORT;
_debug("UserAgent: SIP failed to listen on port %d\n", port); _debug("UserAgent: Try to initialize SIP listener on port %d\n", _localExternPort);
errPjsip = createUDPServer();
if (errPjsip != 0) {
_debug("UserAgent: Fail to initialize SIP listener on port %d\n", _localExternPort);
return errPjsip; return errPjsip;
} }
}
}
_debug("UserAgent: SIP Init -- listening on port %d\n", _localExternPort); _debug("UserAgent: SIP Init -- listening on port %d\n", _localExternPort);
// Initialize transaction layer // Initialize transaction layer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment