Search code examples
freeswitch

Freeswitch - How to force new TCP/TLS connection for every new outgoing call?


I am making outgoing calls to a load-balanced SBC which has two nodes. Since freeswitch is reusing the same open TCP/TLS socket to the SBC for every outgoing call, the load is not getting distributed across the two nodes of the SBC. All the calls are going to the same node.

If I can force each new call to use a different TCP connection, the load will get distributed evenly. Is there any configuration that makes this possible?

I looked into relevant conf file settings, nothing looks promising.


Solution

  • I eventually found the answer and didn't remember I had posted the question here. The answer is not very useful though.

    Freeswitch will use a new connection every time by using the "reuse-connections" field in the gateway definition under sip_profiles.

    <gateway name="{{unique_gw_name}}">
        <param name="username" value="test"/>
        <param name="password" value="test"/>
        <param name="proxy" value="{{ip_address}};transport=tcp"/>
        <param name="realm" value="*"/>
        <param name="register" value="false" />
        <param name="reuse-connections" value="false"/>
        <param name="auth-calls" value="false"/>
        <param name="caller-id-in-from" value="true"/>
    </gateway>
    

    However, this will achieve very little. The SIP call will contain at least two SIP dialogs, one for INVITE and another for BYE. If different connections are used, the INVITE might go to one SBC and the BYE may go to another SBC. So the whole thing will fail. This is not the right way to achieve load balancing.