7

I want to use FreeSWITCH instead of Asterisk because of it's performance compared to Asterisk. I know that FreeSWITCH can be a full PBX or just run parts (modules) to do only the things I want it to.. But I am not sure where OpenSIPS fits into the equation. Lets say I had 5 FreeSWITCH servers to handle voice calls (inbound and outbound) and voicemail for my users. Could I have all of the extensions in the OpenSIPS router and use it to authenticate calls, then hand them off to FreeSWITCH?

If so, do I have to put any Extension information in FreeSWITCH at all for my users? I am trying to avoid having 5 FreeSWITCH servers with duplicate extensions in each!

jmort253
  • 449
  • 6
  • 12

2 Answers2

5

Opensips is used for creating highly scalable SIP signaling routers. So yes, use OpenSIPS with the Carrier Route module to authenticate peers and route calls to the FreeSWITCH boxes.

Essobi
  • 901
  • 6
  • 9
0

To avoid duplicating extensions in multiple FreeSWITCH servers, you can use OpenSIPS as a SIP proxy to handle call routing and distribution. OpenSIPS can be configured to load balance traffic to multiple FreeSWITCH servers and route calls based on specific criteria.

Here's an example configuration using OpenSIPS and FreeSWITCH:

OpenSIPS configuration:

# Define the FreeSWITCH servers
# Replace 192.168.1.10 and 192.168.1.11 with the IP addresses of your FreeSWITCH servers
dynamic_route("freeswitch", "load_balance") {
    if (uri == "sip:extension@192.168.1.10") {
        seturi("sip:extension@192.168.1.10");
        t_on_failure("1");
    } else if (uri == "sip:extension@192.168.1.11") {
        seturi("sip:extension@192.168.1.11");
        t_on_failure("1");
    }
}

# Define the load balancing algorithm
load_balance {
    # Replace 192.168.1.10 and 192.168.1.11 with the IP addresses of your FreeSWITCH servers
    group("freeswitch", "hash");
    # Define the hashing algorithm (e.g. "source", "destination", "random")
    hash_load_factor("1");
}

FreeSWITCH Configuration:

# Define the extension
<extension name="extension">
    <condition field="destination_number" expression="extension">
        <action application="bridge" data="sofia/gateway/OpenSIPS/extension"/>
    </condition>
</extension>

# Define the SIP gateway
<gateway name="OpenSIPS">
    <param name="username" value="username"/>
    <param name="password" value="password"/>
    <param name="realm" value="opensips.example.com"/>
    <param name="from-user" value="freeswitch"/>
    <param name="from-domain" value="freeswitch.example.com"/>
    <param name="expire-seconds" value="300"/>
    <param name="retry-seconds" value="60"/>
    <param name="register" value="true"/>
    <param name="register-transport" value="udp"/>
    <param name="register-proxy" value="opensips.example.com"/>
    <param name="caller-id-in-from" value="true"/>
</gateway>

In this configuration, OpenSIPS is configured to load balance traffic to two FreeSWITCH servers with IP addresses 192.168.1.10 and 192.168.1.11. The load balancing algorithm uses a hashing algorithm to evenly distribute traffic between the servers.

The FreeSWITCH configuration defines an extension that bridges the call to the OpenSIPS gateway using the SIP URI "sofia/gateway/OpenSIPS/extension". The OpenSIPS gateway is configured with the necessary SIP credentials and registration information.

With this configuration, you can define extensions in the FreeSWITCH configuration without having to duplicate them across multiple FreeSWITCH servers. OpenSIPS handles call routing and distribution, ensuring that calls are routed to the appropriate server based on the load balancing algorithm.

tripleee
  • 1,416
  • 3
  • 15
  • 24