OpenSIPS is open-source software that suits well for medium and large businesses to handle all the above-mentioned scenarios. It supports common database access like MySQL and Postgres but still very well supports the carrier-grade deployments. OpenSIPS is a multi-purpose signaling SIP server. It can act as SIP Router, SIP Switch, SIP Registrar, Application Server, Redirect Server, Load Balancer, Dispatcher, Back-to-Back User Agent, Session Border Controller, SIP Front-End, NAT traversal Server, IP Gateway (SMS, XMPP) among others.

Installing and Configuring OpenSIPS in Fedora

1. Install OpenSIPS

  1. Download OpenSIPS source file from http://opensips.org
  2. Extract it and place it in /usr/src
  3. Then compile the source file with the option of DB module for the support of database handling in Opensips

    2. Change the configurations file to install opensips database

  4. First of all go to the /usr/local/etc/opensips
  5. Then open opensipsctlr and find the sip domain option and change it as per your need, find DB engine option and uncomment it to tell opensips to use database engine.
  6. When these changes are done, save the configuration file and go to the terminal and run the command opensips dbctl create and answered the questions by pressing y.
  7. Go to the opensips folder and open the opensips.cfg file in gedit. Then remove the comments to the module DB and also uncomment the parameters related to the DB module.
  8. Start the opensips by run the command opensipsctl start

    3. Add Users to check Opensips working

  9. create the aliases by using this command opensipsctl add "alias name" password
  10. After that register users to your softphone and made the call between users.

    4. Asterisk Installation

  11. Download Asterisk from asterisk.org.
  12. Compile the asterisk in the src directory.
  13. Run the asterisk.

    5. ODBC Configuration

  14. Install ODBC Support.
  15. change the Odbc.ini file to have connected to asterisk.
  16. test the changes by running this command on terminal isql odbc parameter name
  17. Go to the Asterisk folder.
  18. Change the res_odbc configuration file and text config configuration files as per your needs to connect opensips and asterisk.
  19. To check the configuration in asterisk Cli run this command show odbc
  20. If odbc does not show then install the asterisk-odbc from the terminal.

    6. Opensips.cfg for asterisk Integration

  21. To Connect opensips to asterisk when the user call from one destination to another destination. We should change the code where opensips route the call after authentication.
  22. change the code in route with the asterisk IP and port where opensips transfer the calls to asterisk
  23. rewritehostport("asterisk ip:asterisk port")

    7. Test the integration

  24. add two aliases on the same domain name.
  25. register one alias in zoiper and remain unregistered the second alias and made the call from one alias to another alias that is unregistered.
  26. If the call made successfully then you are done with your asterisk and opensips configuration.

    8. Call forward by using the AVPOPS module

  27. To call forwarding from AVP we need first to load the avpops module.
  28. After that define the parameters of avops module in the parameters define the AVP table as AVP preferences where you can pick the alternate alias with the attribute.
  29. For call blind you need to set the alias in the AVP preferences module by using this commands on terminal ./opensipsctl AVP add -T usr_preferences client name call fwd 0 client name
  30. after that use the function and forward it to the route.
  31. For busy and unanswered calls you need to need to call the AVP attribute for busy and unanswered calls and call the function rewritehostport("asterisk IP: asterisk port") to forward the call to asterisk and play the busy and unanswered call messages.

    9. Nat Traversing

  32. First Install the RTPproxy server to support the SDP in nat traversing.
  33. To install RTPproxy download the source code and compile it.
  34. After that set the RTPproxy by using this command in terminal ./rtpproxy -l your IP -s UDP:yourip:7890 -F
  35. After that load the nat helper module and set the appropriate parameters according to your need.
  36. After that go to the opensips.cfg file and change the routing logic.

First, check that if the request is registered and put the code

rtpproxy_answer();
if (nat_uac_test("18"))
{
if(method=="REGISTER") {
fix_nated_register();
}
else {
fix_nated_contact();
}
setflag(5);
}

After that go to the route 1 context and put the code

if (subst_uri('/(sip:.);nat=yes/\1/'))
{
setbflag(6);
};
if (isflagset(5)||isbflagset(6))
{
route(6);
};
if (isflagset(5))
{
search_append('Contact:.
sip:[^>[:cntrl:]]*', ';nat=yes');
}

After that handled the on reply route by put the code

rtpproxy_answer();
append_hf("P-hint: onreply_route|rtpproxy_answer \r\n");
}
if (isbflagset(6))
{
search_append('contact:.sip:[^>[:cntrl:]]',';nat=yes');
append_hf("P-hint: Onreply-route - fixcontact \r\n");
fix_nated_contact();
}

After that in route 6 put the following code.

{
if(is_method("BYE|CANCEL"))
{
unforce_rtp_proxy();
}
else if (is_method("INVITE"))
{
rtpproxy_answer();
t_on_failure("1");
};
}

Got to the failure route and put the following code.

if (isflagset(5)||isbflagset(6))
{
unforce_rtp_proxy();
}