[sip-comm-dev] Media ports for calls using SIP are limited between Port 5000 and 6000


#1

Hello everyone,

I encountered a problem using SIP Communicator establishing many calls.
SIP Communicator fails with error message "An error occured while
sending invite request" after establishing many connections. The cause
of this problem is the fixed number of ports to use for connections. The
range is per default from port 5000 to port 6000. This is defined in
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler with
static variables "minMediaPort" and "maxMediaPort". The current used
port is stored in static variable "nextMediaPortToTry".
Every time establishing a call the "nextMediaPortToTry" variable will be
increased but the variable never will be decreased.
For each call 4 ports will be allocated and therefore the number of
possible calls is limited to 250.

I used the latest version from SVN on Ubuntu 9.10 using Sun JDK 1.6.0.16.

Problem in Source Code:
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.initializePortNumbers():1665
--> uses ports 5000-6000 as min and max ports

net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createStreamConnector():1568
    --> "nextMediaPortToTry" will be used as preferred port.

    //make sure that next time we don't try to bind on occupied ports
    nextMediaPortToTry = rtpSocket.getLocalPort() + 1;
    --> use next free socket for "nextMediaPortToTry".

Logged Exception:
12:31:38.977 SCHWERWIEGEND:
impl.protocol.sip.CallPeerMediaHandler.throwOperationFailedException().2516
Failed to allocate the network ports necessary for the call.
java.lang.IllegalArgumentException: preferredPort (6001) must be between
minPort (5000) and maxPort (6000)
    at
net.java.sip.communicator.impl.netaddr.NetworkAddressManagerServiceImpl.createDatagramSocket(NetworkAddressManagerServiceImpl.java:775)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createStreamConnector(CallPeerMediaHandler.java:1420)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.getStreamConnector(CallPeerMediaHandler.java:1505)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createMediaDescriptions(CallPeerMediaHandler.java:662)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createFirstOffer(CallPeerMediaHandler.java:617)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createOffer(CallPeerMediaHandler.java:598)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerSipImpl.invite(CallPeerSipImpl.java:1359)
    at
net.java.sip.communicator.impl.protocol.sip.CallSipImpl.invite(CallSipImpl.java:392)
    at
net.java.sip.communicator.impl.protocol.sip.OperationSetBasicTelephonySipImpl.createOutgoingCall(OperationSetBasicTelephonySipImpl.java:187)
    at
net.java.sip.communicator.impl.protocol.sip.OperationSetBasicTelephonySipImpl.createCall(OperationSetBasicTelephonySipImpl.java:110)
    at
net.java.sip.communicator.impl.gui.main.call.CallManager$CreateCallThread.run(CallManager.java:393)

12:31:38.979 SCHWERWIEGEND:
impl.protocol.sip.CallPeerSipImpl.throwOperationFailedException().2516
An error occurred while sending invite request
net.java.sip.communicator.service.protocol.OperationFailedException:
Failed to allocate the network ports necessary for the call.
    at
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderServiceSipImpl.throwOperationFailedException(ProtocolProviderServiceSipImpl.java:2521)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createStreamConnector(CallPeerMediaHandler.java:1425)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.getStreamConnector(CallPeerMediaHandler.java:1505)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createMediaDescriptions(CallPeerMediaHandler.java:662)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createFirstOffer(CallPeerMediaHandler.java:617)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createOffer(CallPeerMediaHandler.java:598)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerSipImpl.invite(CallPeerSipImpl.java:1359)
    at
net.java.sip.communicator.impl.protocol.sip.CallSipImpl.invite(CallSipImpl.java:392)
    at
net.java.sip.communicator.impl.protocol.sip.OperationSetBasicTelephonySipImpl.createOutgoingCall(OperationSetBasicTelephonySipImpl.java:187)
    at
net.java.sip.communicator.impl.protocol.sip.OperationSetBasicTelephonySipImpl.createCall(OperationSetBasicTelephonySipImpl.java:110)
    at
net.java.sip.communicator.impl.gui.main.call.CallManager$CreateCallThread.run(CallManager.java:393)
Caused by: java.lang.IllegalArgumentException: preferredPort (6001) must
be between minPort (5000) and maxPort (6000)
    at
net.java.sip.communicator.impl.netaddr.NetworkAddressManagerServiceImpl.createDatagramSocket(NetworkAddressManagerServiceImpl.java:775)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createStreamConnector(CallPeerMediaHandler.java:1420)
    ... 9 more
12:31:39.004 SCHWERWIEGEND: impl.gui.main.call.CallManager.run().405 The
call could not be created:
net.java.sip.communicator.service.protocol.OperationFailedException: An
error occurred while sending invite request

If ok I can submit a bug to the issues tracker.

Regards
Christian

···

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#2

Hey Christian,

Good catch! I've committed a fix with r6992. Should be available in
build 2547.

Thanks!
Emil

На 14.04.10 17:17, Christian Schanes написа:

···

Hello everyone,

I encountered a problem using SIP Communicator establishing many calls.
SIP Communicator fails with error message "An error occured while
sending invite request" after establishing many connections. The cause
of this problem is the fixed number of ports to use for connections. The
range is per default from port 5000 to port 6000. This is defined in
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler with
static variables "minMediaPort" and "maxMediaPort". The current used
port is stored in static variable "nextMediaPortToTry".
Every time establishing a call the "nextMediaPortToTry" variable will be
increased but the variable never will be decreased.
For each call 4 ports will be allocated and therefore the number of
possible calls is limited to 250.

I used the latest version from SVN on Ubuntu 9.10 using Sun JDK 1.6.0.16.

Problem in Source Code:
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.initializePortNumbers():1665
--> uses ports 5000-6000 as min and max ports

net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createStreamConnector():1568
    --> "nextMediaPortToTry" will be used as preferred port.

    //make sure that next time we don't try to bind on occupied ports
    nextMediaPortToTry = rtpSocket.getLocalPort() + 1;
    --> use next free socket for "nextMediaPortToTry".

Logged Exception:
12:31:38.977 SCHWERWIEGEND:
impl.protocol.sip.CallPeerMediaHandler.throwOperationFailedException().2516
Failed to allocate the network ports necessary for the call.
java.lang.IllegalArgumentException: preferredPort (6001) must be between
minPort (5000) and maxPort (6000)
    at
net.java.sip.communicator.impl.netaddr.NetworkAddressManagerServiceImpl.createDatagramSocket(NetworkAddressManagerServiceImpl.java:775)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createStreamConnector(CallPeerMediaHandler.java:1420)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.getStreamConnector(CallPeerMediaHandler.java:1505)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createMediaDescriptions(CallPeerMediaHandler.java:662)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createFirstOffer(CallPeerMediaHandler.java:617)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createOffer(CallPeerMediaHandler.java:598)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerSipImpl.invite(CallPeerSipImpl.java:1359)
    at
net.java.sip.communicator.impl.protocol.sip.CallSipImpl.invite(CallSipImpl.java:392)
    at
net.java.sip.communicator.impl.protocol.sip.OperationSetBasicTelephonySipImpl.createOutgoingCall(OperationSetBasicTelephonySipImpl.java:187)
    at
net.java.sip.communicator.impl.protocol.sip.OperationSetBasicTelephonySipImpl.createCall(OperationSetBasicTelephonySipImpl.java:110)
    at
net.java.sip.communicator.impl.gui.main.call.CallManager$CreateCallThread.run(CallManager.java:393)

12:31:38.979 SCHWERWIEGEND:
impl.protocol.sip.CallPeerSipImpl.throwOperationFailedException().2516
An error occurred while sending invite request
net.java.sip.communicator.service.protocol.OperationFailedException:
Failed to allocate the network ports necessary for the call.
    at
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderServiceSipImpl.throwOperationFailedException(ProtocolProviderServiceSipImpl.java:2521)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createStreamConnector(CallPeerMediaHandler.java:1425)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.getStreamConnector(CallPeerMediaHandler.java:1505)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createMediaDescriptions(CallPeerMediaHandler.java:662)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createFirstOffer(CallPeerMediaHandler.java:617)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createOffer(CallPeerMediaHandler.java:598)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerSipImpl.invite(CallPeerSipImpl.java:1359)
    at
net.java.sip.communicator.impl.protocol.sip.CallSipImpl.invite(CallSipImpl.java:392)
    at
net.java.sip.communicator.impl.protocol.sip.OperationSetBasicTelephonySipImpl.createOutgoingCall(OperationSetBasicTelephonySipImpl.java:187)
    at
net.java.sip.communicator.impl.protocol.sip.OperationSetBasicTelephonySipImpl.createCall(OperationSetBasicTelephonySipImpl.java:110)
    at
net.java.sip.communicator.impl.gui.main.call.CallManager$CreateCallThread.run(CallManager.java:393)
Caused by: java.lang.IllegalArgumentException: preferredPort (6001) must
be between minPort (5000) and maxPort (6000)
    at
net.java.sip.communicator.impl.netaddr.NetworkAddressManagerServiceImpl.createDatagramSocket(NetworkAddressManagerServiceImpl.java:775)
    at
net.java.sip.communicator.impl.protocol.sip.CallPeerMediaHandler.createStreamConnector(CallPeerMediaHandler.java:1420)
    ... 9 more
12:31:39.004 SCHWERWIEGEND: impl.gui.main.call.CallManager.run().405 The
call could not be created:
net.java.sip.communicator.service.protocol.OperationFailedException: An
error occurred while sending invite request

If ok I can submit a bug to the issues tracker.

Regards
Christian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

--
Emil Ivov, Ph.D. 67000 Strasbourg,
Project Lead France
SIP Communicator
emcho@sip-communicator.org PHONE: +33.1.77.62.43.30
http://sip-communicator.org FAX: +33.1.77.62.47.31

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net