Enswitch installation on AWS: Difference between revisions

From Integrics Wiki
Jump to navigation Jump to search
Content deleted Content added
Vlasis (talk | contribs)
No edit summary
Vlasis (talk | contribs)
No edit summary
Line 5: Line 5:
* Under the global configuration, create two machines, one for the internal IP address and FQDN and the other for the external IP and FQDN. Set only the internal address machine to accept calls as an Asterisk server.
* Under the global configuration, create two machines, one for the internal IP address and FQDN and the other for the external IP and FQDN. Set only the internal address machine to accept calls as an Asterisk server.
* Under the global configuration, create domains for the internal IP address, the internal FQDN, the external IP and the external FQDN.
* Under the global configuration, create domains for the internal IP address, the internal FQDN, the external IP and the external FQDN.
* Under the global configuration, set the "Message daemon IP address" to be the internal IP address.
* Edit /etc/kamailio/kamailio.cfg as below:
* Edit /etc/kamailio/kamailio.cfg as below:
<pre>
<pre>

Revision as of 22:49, 22 April 2025

How to set up Enswitch on a single machine cluster on AWS

This set up has been tested successfully on an Enswitch 4.0 single machine cluster with Kamailio 5.8.2 and Asterisk 13.38.3:

  • Under the global configuration, create two machines, one for the internal IP address and FQDN and the other for the external IP and FQDN. Set only the internal address machine to accept calls as an Asterisk server.
  • Under the global configuration, create domains for the internal IP address, the internal FQDN, the external IP and the external FQDN.
  • Under the global configuration, set the "Message daemon IP address" to be the internal IP address.
  • Edit /etc/kamailio/kamailio.cfg as below:
listen = udp:<internal IP>:5060 advertise <external IP>:5060
listen = tcp:<internal IP>:5060 advertise <external IP>:5060

# AWS
#!define AWS_INTERNAL_IP <internal IP>
#!define AWS_EXTERNAL_IP "<external IP>"
  • Edit /opt/enswitch/current/etc/kamailio/kamailio_58.cfg as below:
Index: etc/kamailio/kamailio_58.cfg
===================================================================
--- etc/kamailio/kamailio_58.cfg	(revision 21219)
+++ etc/kamailio/kamailio_58.cfg	(working copy)
@@ -334,6 +334,11 @@
 		}
 	}
 	if ( is_method( "INVITE" ) ) {
+		# AWS start
+		if ( src_ip == AWS_INTERNAL_IP ) {
+		        fix_nated_sdp("3",AWS_EXTERNAL_IP);
+		}
+		# AWS end
 		$var(pai_count) = 0;
 		while( defined $(hdr(P-Asserted-Identity)[$var(pai_count)]) ) {
 			$var(pai_count) = $var(pai_count) + 1;
@@ -359,6 +364,12 @@
 	if ( is_method( "BYE" ) ) {
 		t_on_branch( "BRANCH" );
 	}
+
+	# AWS start
+	if ( is_method( "SUBSCRIBE" ) ) {
+		set_advertised_address( AWS_INTERNAL_IP );
+	}
+
 	if ( ! t_relay() ) {
 		sl_reply_error();
 	}
@@ -368,6 +379,11 @@
 onreply_route[ REPLY ] {
 	if ( sdp_content() ) {
 		$avp(ENSWITCH-CIPHERS-SAFE) = $rb;
+		# AWS start
+		if ( src_ip == AWS_INTERNAL_IP ) {
+		        fix_nated_sdp("3",AWS_EXTERNAL_IP);
+		}
+		# AWS end
 	}
 
 	force_rport();
@@ -494,6 +510,10 @@
 		# enforce routing to sipd
 		rewritehostporttrans("127.0.0.1:5080;transport=udp");
 		remove_hf( "Route" );
+		# AWS start
+		set_advertised_address( AWS_INTERNAL_IP );
+		# AWS end
+
 		route( FORWARD );
 		exit;
 	}
  • - In /etc/asterisk/sip.conf add a local-public, a local-private, a public IP and a private IP stanza, eg:
[enswitch-local-public]
host = <external IP>
fromdomain = <external IP>
type = friend
insecure = port,invite
context = from-internal
canreinvite = no
nat = yes
t38pt_udptl = yes

[enswitch-local-private]
host = <internal IP>
fromdomain = <internal IP>
type = friend
insecure = port,invite
context = from-internal
canreinvite = no
nat = yes
t38pt_udptl = yes

[<external IP>]
host = <external IP>
fromdomain = <external IP>
type = friend
insecure = port,invite
context = from-internal
canreinvite = no
nat = yes
t38pt_udptl = yes

[<internal IP>]
host = <internal IP>
fromdomain = <internal IP>
type = friend
insecure = port,invite
context = from-internal
canreinvite = no
nat = yes
t38pt_udptl = yes