@@ -75,14 +75,14 @@ rmiRemoteObjectPort=2001
7575externalPort=5060 
7676# The SIP TLS port used where clients should connect 
7777externalSecurePort=5061 
78-   
78+ 
7979# The SIP port from where servers will receive messages 
8080# delete if you want to use only one port for both inbound and outbound) 
8181# if you like to activate the integrated HTTP load balancer, this is the entry point 
8282internalPort=5065 
8383# The SIP TLS port from where servers will receive messages 
8484internalSecurePort=5066 
85-   
85+ 
8686# The HTTP port for HTTP forwarding 
8787httpPort=2080 
8888# The HTTPS port for HTTPS forwarding 
@@ -100,7 +100,7 @@ externalTransport=UDP
100100#externalIpLoadBalancerAddress=127.0.0.1 
101101#externalIpLoadBalancerPort=111 
102102#externalSecureIpLoadBalancerPort=112 
103-   
103+ 
104104# Requests initited from the App Servers can route to this address (if you are using 2 IP load balancers for bidirectional SIP LB) 
105105# For TLS put internalSecureIpLoadBalancerPort 
106106#internalIpLoadBalancerAddress=127.0.0.1 
@@ -123,17 +123,17 @@ algorithmClass=org.mobicents.tools.telestaxproxy.TelestaxProxyAlgorithm
123123#sipHeaderAffinityKey=Call-ID 
124124#specify the GET HTTP parameter to be used as hash key 
125125#httpAffinityKey=appsession 
126-   
126+ 
127127# Uncomment to enable the persistent consistent hash based on Call-ID algorithm. 
128128#algorithmClass=org.mobicents.tools.sip.balancer.PersistentConsistentHashBalancerAlgorithm 
129129# This property is not required, it defaults to Call-ID if not set 
130130#sipHeaderAffinityKey=Call-ID 
131131#specify the GET HTTP parameter to be used as hash key 
132132#httpAffinityKey=appsession 
133-   
133+ 
134134#This is the JBoss Cache 3.1 configuration file (with jgroups), if not specified it will use default 
135135#persistentConsistentHashCacheConfiguration=/home/config.xml 
136-   
136+ 
137137# Call-ID affinity algortihm settings. This algorithm is the default. No need to uncomment it. 
138138#algorithmClass=org.mobicents.tools.sip.balancer.CallIDAffinityBalancerAlgorithm 
139139# This property specifies how much time to keep an association before being evitcted. 
@@ -153,7 +153,7 @@ algorithmClass=org.mobicents.tools.telestaxproxy.TelestaxProxyAlgorithm
153153#sipHeaderAffinityKey=Call-ID 
154154#specify the GET HTTP parameter to be used as hash key 
155155#httpAffinityKey=appsession 
156-   
156+ 
157157#This is the JBoss Cache 3.1 configuration file (with jgroups), if not specified it will use default 
158158#persistentConsistentHashCacheConfiguration=/home/config.xml 
159159
@@ -173,7 +173,7 @@ gov.nist.javax.sip.SERVER_LOG = logs/sipbalancerforwarder.xml
173173gov.nist.javax.sip.THREAD_POOL_SIZE = 64 
174174gov.nist.javax.sip.REENTRANT_LISTENER = true 
175175gov.nist.javax.sip.AGGRESSIVE_CLEANUP=true 
176- #this property we set statically "gov.nist.javax.sip.stack.LoadBalancerNioMessageProcessorFactory"   
176+ #this property we set statically "gov.nist.javax.sip.stack.LoadBalancerNioMessageProcessorFactory" 
177177#for statistic correct working 
178178#gov.nist.javax.sip.MESSAGE_PROCESSOR_FACTORY=gov.nist.javax.sip.stack.NioMessageProcessorFactory 
179179
@@ -195,9 +195,9 @@ remoteServers = 127.0.0.1:10021,127.0.0.1:10022,127.0.0.1:10023
195195# it is recommended that at any time there were no more than 
196196#10 (ten) SMPP messages are outstanding 
197197maxConnectionSize = 10 
198- # Is NIO enabled   
198+ # Is NIO enabled 
199199nonBlockingSocketsEnabled = true 
200- # Is default session counters enabled   
200+ # Is default session counters enabled 
201201defaultSessionCountersEnabled = true 
202202# Response timeout for load balancer in milliseconds 
203203timeoutResponse = 10000 
@@ -214,7 +214,7 @@ timeoutConnectionCheckServerSide = 1000
214214
215215# SSL configuration 
216216#points to the keystore file we generated before 
217- javax.net.ssl.keyStore=/home/konstantinnosach/tmp/keystore   
217+ javax.net.ssl.keyStore=/home/konstantinnosach/tmp/keystore 
218218#provides the password we used when we generated the keystore 
219219javax.net.ssl.keyStorePassword=123456 
220220#points to the truststore file we generated before 
@@ -229,7 +229,7 @@ gov.nist.javax.sip.TLS_CLIENT_PROTOCOLS=TLSv1
229229#if Disabled or DisabledAll does not use authentication 
230230gov.nist.javax.sip.TLS_CLIENT_AUTH_TYPE=Disabled 
231231#ssl will provide some extra debugging information for the SSL if uncomment it 
232- #javax.net.debug=ssl   
232+ #javax.net.debug=ssl 
233233# should smpp and http use secured connection towards servers or regular 
234234isRemoteServerSsl = true 
235235
@@ -675,12 +675,12 @@ With consistent hash and `jvmRoute` -based balancer algorithms it doesn't matter
675675With consistent hash algorithms there is no state to be preserved in the SIP/HTTP balancers.
676676
677677.Example deployment: IP load balancers serving both directions forincoming/outgoing requests in a cluster 
678- image::images/bidirectional-distributed-sip-lb.gif []
678+ image::images/WSS_Failover_Goal.png []
679679
680680[[_sslb_sip_load_balancer_implementation]]
681681== Implementation of the {this-platform}  Load Balancer
682682
683- Each individual {this-platform} SIP Server in the cluster is responsible for contacting the Restcomm Load Balancer and relaying its health status and regular "heartbeats".  
683+ Each individual {this-platform} SIP Server in the cluster is responsible for contacting the Restcomm Load Balancer and relaying its health status and regular "heartbeats".
684684
685685From these health status reports and heartbeats, the Restcomm Load Balancer creates and maintains a list of all available and healthy nodes in the cluster.
686686The Load Balancer forwards SIP requests between these cluster nodes, providing that the provisioning algorithm reports that each node is healthy and is still sending heartbeats.
@@ -738,7 +738,7 @@ Additionally, Restcomm Load Balancer will add two custom header containing the i
738738Application can use these two headers to have the correct location of the sip client that sent the REGISTER request.
739739
740740In advanced configurations, it is possible to run more than one Restcomm Load Balancer.
741- Simply edit the balancers connection string in your SIP Server - the list is separated with semi-colon.  
741+ Simply edit the balancers connection string in your SIP Server - the list is separated with semi-colon.
742742
743743<<_figure_mss_basic_ip_and_port_cluster_configuration>>    describes a basic IP and Port Cluster Configuration.
744744In the diagram, the Restcomm Load Balancer is the server with the IP address of `192.168.1.1` .
@@ -876,3 +876,257 @@ You can get next data:
876876[loweralpha]
877877.. Recent CPU usage for the Java Virtual Machine process;
878878.. Amount of used memory of the heap in bytes.
879+ 
880+ == Configuring Load-balancer and two Restcomm servers on the one local machine
881+ 
882+ .Load balancer and Restcomm servers diagram 
883+ image::images/Restcomm_servers-LB.png[]
884+ 
885+ This chapter will show you how to configure two Restcomm instances and Load Balancer instance on one machine with OS Ubuntu.
886+ 
887+ .Step 0: Create three sub interfaces 
888+ Example for Ubuntu:
889+ 
890+ Restcomm-server1
891+ 
892+ root@ubuntu:~# ifconfig lo:1 127.0.0.2 netmask 255.255.255.0
893+ 
894+ Restcomm-server2
895+ 
896+ root@ubuntu:~# ifconfig lo:2 127.0.0.3 netmask 255.255.255.0
897+ 
898+ Load balancer
899+ 
900+ root@ubuntu:~# ifconfig lo:3 127.0.0.4 netmask 255.255.255.0
901+ 
902+ .Step 1: Install Mysql 
903+ 
904+ Example for Ubuntu: https://www.linode.com/docs/databases/mysql/install-mysql-on-ubuntu-14-04
905+ 
906+ .Step 2: Download the latest version of Restcomm 
907+ 
908+ . Download the latest version of Restcomm zip file from:
909+ https://mobicents.ci.cloudbees.com/job/RestComm/lastSuccessfulBuild/artifact/
910+ 
911+ . Unzip the binary to a local directory. It should be similar to this Mobicents-Restcomm-JBoss-AS7-<version-number>.
912+ We shall refer to this above Restcomm directory as the $RESTCOMM_HOME.
913+ 
914+ .Step 3: Configuring the mybatis.xml file to use Mysql 
915+ 
916+ . Edit the file $RESTCOMM_HOME/standalone/deployments/restcomm.war/WEB-INF/conf/mybatis.xml
917+ . Change the <environments default="production"> to  <environments default="mariadb">
918+ . Add the MariaDB configuration environment tag as shown below
919+ 
920+     <environment id="mariadb">
921+       <transactionManager type="JDBC"/>
922+       <dataSource type="POOLED">
923+         <property name="driver" value="com.mysql.jdbc.Driver"/>
924+         <property name="url" value="jdbc:mysql://127.0.0.1:3306/restcomm"/>
925+         <property name="username" value="SQL_Login"/>
926+         <property name="password" value="SQL_Password"/>
927+       </dataSource>
928+     </environment>
929+ 
930+ . Save and exit the mybatis.xml file
931+ 
932+ .Step 4: Start Mysql and Create the restcomm Database 
933+ 
934+ . Start mysql service if it is not already started  – sudo /etc/init.d/mysql start
935+ . Go to the directory $RESTCOMM_HOME/standalone/deployments/restcomm.war/WEB-INF/scripts/mariadb
936+ . There will be an init.sql file and an sql directory
937+ . Create the restcomm database from the init.sql as follows:
938+ 
939+   mysql -u root -p < init.sql
940+ 
941+ . Log into mysql and make sure the restcomm database is created :  show databases
942+ 
943+ .Step 5: Edit the restcomm.xml file to point the DAO to mysql 
944+ 
945+ . Edit the file $RESTCOMM_HOME/standalone/deployments/restcomm.war/WEB-INF/conf/restcomm.xml
946+ . Find the dao-manager tag and change the sql-files path to mariadb as shown below
947+ 
948+   <dao-manager class="org.mobicents.servlet.restcomm.dao.mybatis.MybatisDaoManager">
949+     <configuration-file>${restcomm:home}/WEB-INF/conf/mybatis.xml</configuration-file>
950+     <data-files></data-files>
951+     <sql-files>${restcomm:home}/WEB-INF/scripts/mariadb/sql</sql-files>
952+   </dao-manager>
953+ 
954+ .Step 6: Download Mysql Java Client Driver 
955+ . Download the latest mysql java connector client driver jar file from http://mvnrepository.com/artifact/mysql/mysql-connector-java.
956+ . Put jar file in $RESTCOMM_HOME/standalone/deployments/restcomm.war/WEB-INF/lib/
957+ 
958+ .Step 7: Download key store file for SSL 
959+ 
960+ You can download file from
961+ https://github.com/RestComm/load-balancer/blob/master/config-examples/keystore
962+ (password 123456) or create independently and put this file
963+ in package $RESTCOMM_HOME/standalone/configuration/
964+ 
965+ .Step 8: Edit mss-sip-stack.properties file 
966+ 
967+ . Edit the file $RESTCOMM_HOME/standalone/configuration/mss-sip-stack.properties
968+ . Add next lines to file
969+ 
970+   org.mobicents.ha.javax.sip.BALANCERS=127.0.0.4:5082
971+   org.mobicents.ha.javax.sip.LOCAL_HTTP_PORT=8080
972+   org.mobicents.ha.javax.sip.LOCAL_SSL_PORT=8443
973+   org.mobicents.ha.javax.sip.REACHABLE_CHECK=false
974+   gov.nist.javax.sip.TLS_CLIENT_AUTH_TYPE=Disabled
975+   javax.net.ssl.keyStore=/absolutePathToKeystore/keystore
976+   javax.net.ssl.keyStorePassword=123456
977+   javax.net.ssl.trustStorePassword=123456
978+   javax.net.ssl.trustStore=/absolutePathToKeystore/keystore
979+   javax.net.ssl.keyStoreType=JKS
980+ 
981+ .Step 9: Configure Restcomm IP information and Text-to-speech 
982+ 
983+ . Go to the directory $RESTCOMM_HOME/bin/restcomm
984+ . Open the file restcomm.conf
985+ . Go to the section # Network configuration
986+ 
987+ . Configure the following variables with the network configuration details of your first server.
988+ 
989+   #Network configuration
990+   NET_INTERFACE='lo:1'
991+   PRIVATE_IP='127.0.0.2'
992+   SUBNET_MASK='255.255.255.0'
993+   NETWORK='127.0.0.0'
994+   BROADCAST_ADDRESS='127.0.0.255'
995+ 
996+ . Add next parameters for enabling https connector (password and alias for file from github example)
997+ 
998+   #HTTPS Settings
999+   #File should be located at $RESTCOMM_HOME/standalone/configuration folder.
1000+   #Provide just the name of the trustore file. Leave it blank to disable HTTPS
1001+   TRUSTSTORE_FILE='keystore'
1002+   #Password for the trustore file
1003+   TRUSTSTORE_PASSWORD='123456'
1004+   #The certificate alias
1005+   TRUSTSTORE_ALIAS='smpp'
1006+   #Control whether or not Restcomm will accept self-signed certificates.
1007+   #Values allowall=allow #self-signed certificates,
1008+   #strict=don't allow self signed certificates
1009+   SSL_MODE='allowall'
1010+ 
1011+ . Add your VoiceRSS API key to the variable
1012+ 
1013+   VOICERSS_KEY=‘f4840af6675b4d20a8d96dea8466296b‘
1014+ 
1015+ . Also edit next lines
1016+ 
1017+   ACTIVATE_LB='TRUE'
1018+   LB_ADDRESS='127.0.0.4'
1019+   LB_INTERNAL_PORT='5082'
1020+   LB_SIP_PORT_UDP='5080'
1021+   LB_SIP_PORT_TCP='5080'
1022+   LB_SIP_PORT_TLS='5081'
1023+   LB_SIP_PORT_WS='5082'
1024+   LB_SIP_PORT_WSS='5083'
1025+ 
1026+ . Save and exit the restcomm.conf file
1027+ 
1028+ .Step 10: Configure proxy.conf file 
1029+ 
1030+ Change in $RESTCOMM_HOME/bin/restcomm/proxy.conf file next lines
1031+ 
1032+   ACTIVE_PROXY='true'
1033+   PROXY_IP='172.21.0.104'
1034+   PROXY_PRIVATE_IP='127.0.0.4'
1035+ 
1036+ .Step 11: Configuration second Restcomm server 
1037+ 
1038+ . Copy $RESTCOMM_HOME folder to separate folder and change next files there:
1039+ .. $RESTCOMM_HOME/bin/restcomm/restcomm.conf
1040+ 
1041+   NET_INTERFACE='lo:2'
1042+   PRIVATE_IP='127.0.0.3'
1043+ 
1044+ .. $RESTCOMM_HOME/bin/restcomm/start-restcomm.sh
1045+ 
1046+ Because we are going to start second Restcomm server on same machine,
1047+ we should change name of screen session "restcomm" to "restcomm2"
1048+ or something like that and name of screen session "mms" to "mms2".
1049+ Also we should add property -bmanagement=$bind_address, as shown below:
1050+ 
1051+   if screen -list | grep -q 'restcomm2'; then
1052+   echo 'TelScale RestComm is already running on screen session "restcomm2"!'
1053+   ....
1054+   echo 'TelScale RestComm started running on standalone mode. Screen session: restcomm2.'
1055+   ....
1056+   $RESTCOMM_HOME/bin/standalone.sh -b $bind_address -bmanagement=$bind_address
1057+   else
1058+   screen -dmS 'restcomm2' $RESTCOMM_HOME/bin/standalone.sh -b $bind_address -bmanagement=$bind_address
1059+   ....
1060+   screen -dmS 'restcomm2' $RESTCOMM_HOME/bin/domain.sh -b $bind_address -bmanagement=$bind_address
1061+   echo 'TelScale RestComm started running on domain mode. Screen session: restcomm2.'
1062+   ....
1063+   screen -dmS 'restcomm2' $RESTCOMM_HOME/bin/standalone.sh -b $bind_address -bmanagement=$bind_address
1064+   echo 'TelScale RestComm started running on standalone mode. Screen session: restcomm2.'
1065+   ....
1066+   if screen -ls | grep -q 'mms2'; then
1067+   echo '...Mobicents Media Server is already running on screen session "mms2"!'
1068+   else
1069+   chmod +x $MMS_HOME/bin/run.sh
1070+   screen -dmS 'mms2'  $MMS_HOME/bin/run.sh
1071+   echo '...Mobicents Media Server started running on screen "mms2"!'
1072+ 
1073+ .. $RESTCOMM_HOME/bin/restcomm/stop-restcomm.sh
1074+ 
1075+   if screen -ls | grep -q 'mms2'; then
1076+   screen -S 'mms2' -p 0 -X 'quit'
1077+   echo '...stopped Mobicents Media Server instance running on screen session "mms2"...'
1078+   ....
1079+   if screen -list | grep -q 'restcomm2'; then
1080+   screen -S 'restcomm2' -p 0 -X 'quit'
1081+   echo '...stopped RestComm instance running on screen session "restcomm2"!'
1082+ 
1083+ .Step 12: Start Restcomm servers and Open the Admin GUI 
1084+ 
1085+ . Go to the directory Restcomm by running the $RESTCOMM_HOME/bin/restcomm/
1086+ . Run the command below to start Restcomm and the media server:
1087+ 
1088+   ./start-restcomm.sh
1089+ 
1090+ . Open your web browser and go to the url – http://127.0.0.2:8080/
1091+ . Log in with the 
[email protected]  and the password=RestComm
1092+ You will be prompted to change the default password.
1093+ . For stopping Restcomm run the command:
1094+ 
1095+   ./stop-restcomm.sh
1096+ 
1097+ .Step 13: Download and configuring of Load Balancer 
1098+ 
1099+ . Download last version of load balancer jar file from https://mobicents.ci.cloudbees.com/job/Restcomm-LoadBalancer/lastSuccessfulBuild/artifact/jar/target/sip-balancer-jar-x.x.xx-jar-with-dependencies.jar.
1100+ Where <x.x.xx> is the release version number
1101+ . Download configuration file for load balancer from https://mobicents.ci.cloudbees.com/job/Restcomm-LoadBalancer/ws/lb-configuration.properties
1102+ . Download log4g file for load balancer from https://mobicents.ci.cloudbees.com/job/Restcomm-LoadBalancer/ws/lb-log4j.xml
1103+ . Put this files in one folder
1104+ . Modify lb-configuration.properties file for correct work. Comment #host= line, and uncomment end set up next lines:
1105+ 
1106+   externalHost=172.21.0.104
1107+   externalPort=5090
1108+   internalHost=127.0.0.4
1109+   internalPort=5082
1110+ 
1111+ . If you need the transport UDP,TCP,TLS the property isTransportWs must be "false", if UDP, WS, WSS this propery must be "true" and set up next lines:
1112+ 
1113+   externalSecurePort=5091
1114+   internalSecurePort=5083
1115+ 
1116+ .Step 14: Use Olympus with Restcomm for WS and WSS 
1117+ 
1118+ For adding certificate of Load balancer to your browser you should connect to it:
1119+ 
1120+ https://127.21.0.104:5091
1121+ 
1122+ and confirm certificate.
1123+ 
1124+ For WS:
1125+ 
1126+ Login to Restcomm server http://127.0.0.2:8080/olympus/
1127+ Fill in form: Load Balancer's ip adress (externalHost) 172.21.0.104 and port(externalPort) 5090
1128+ 
1129+ For WSS:
1130+ 
1131+ Login to Restcomm server https://127.0.0.2:8443/olympus/
1132+ Fill in form: Load Balancer's ip adress (externalHost) 172.21.0.104 and port (externalSecurePort) 5091
0 commit comments