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
- Download OpenSIPS source file from http://opensips.org
- Extract it and place it in /usr/src
- 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
- First of all go to the /usr/local/etc/opensips
- 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.
- 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.
- 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.
- Start the opensips by run the command opensipsctl start
3. Add Users to check Opensips working
- create the aliases by using this command opensipsctl add "alias name" password
- After that register users to your softphone and made the call between users.
4. Asterisk Installation
- Download Asterisk from asterisk.org.
- Compile the asterisk in the src directory.
- Run the asterisk.
5. ODBC Configuration
- Install ODBC Support.
- change the Odbc.ini file to have connected to asterisk.
- test the changes by running this command on terminal isql odbc parameter name
- Go to the Asterisk folder.
- Change the res_odbc configuration file and text config configuration files as per your needs to connect opensips and asterisk.
- To check the configuration in asterisk Cli run this command show odbc
- If odbc does not show then install the asterisk-odbc from the terminal.
6. Opensips.cfg for asterisk Integration
- 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.
- change the code in route with the asterisk IP and port where opensips transfer the calls to asterisk
- rewritehostport("asterisk ip:asterisk port")
7. Test the integration
- add two aliases on the same domain name.
- register one alias in zoiper and remain unregistered the second alias and made the call from one alias to another alias that is unregistered.
- If the call made successfully then you are done with your asterisk and opensips configuration.
8. Call forward by using the AVPOPS module
- To call forwarding from AVP we need first to load the avpops module.
- 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.
- 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
- after that use the function and forward it to the route.
- 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
- First Install the RTPproxy server to support the SDP in nat traversing.
- To install RTPproxy download the source code and compile it.
- After that set the RTPproxy by using this command in terminal ./rtpproxy -l your IP -s UDP:yourip:7890 -F
- After that load the nat helper module and set the appropriate parameters according to your need.
- 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
After that go to the route 1 context and put the code
After that handled the on reply route by put the code
append_hf("P-hint: onreply_route|rtpproxy_answer \r\n");
append_hf("P-hint: Onreply-route - fixcontact \r\n");
After that in route 6 put the following code.
else if (is_method("INVITE"))
Got to the failure route and put the following code.