Sorry i forgot to include config files for load balancer and sip server. Here it is:

Config for Load balancer:  http://pastebin.com/dnanQa1e

Config for Sip server: http://pastebin.com/iYbTHsCC

Steve Nguyen,
---------------------------------------
Cell phone: (84)909585104
Mobile app developer
Phan Thi Company
Sai Gon, VietNam




Begin forwarded message:

From: huan nguyen duy <huancomputer@gmail.com>
Subject: help configure dispatcher in Amazon ec2
Date: December 26, 2016 at 5:33:36 PM GMT+7
To: sr-users@lists.sip-router.org


Hi,
I’m very appreciated if someone can figure out this problem for me.
My aim is to setup HA Kamailio using Dispatcher module in Amazon EC2, system like this:

soft phone 1(Linphone)  —————>  | Load balancer  —————>  | Sip Server 
huancomputer  |  private IP: 172.31.11.35 | 172.31.13.113
soft phone 2(Linphone)  —————>   | public IP:   35.166.179.244 | 35.166.152.104
huannguyen  | |



The dispatcher.lst config file in /usr/local/etc/kamailio as below:

# gatewayss

User records subscriber table:
———————————————————————————————————————————————————
id | username | domain
———————————————————————————————————————————————————


Location records from location table:
———————————————————————————————————————————————————
username | domain | contact
———————————————————————————————————————————————————
huancomputer | NULL | sip: huancomputer@14.161.41.70:64166;transport=udp
nguyenhuan | NULL | sip: nguyenhuan@14.161.41.70:33267;transport=udp


But soft phone 1 cannot make a call to soft phone 2, below is data is extracted from wireshark:

Load balancer:
--------------------------------
No.     Time           Source                Destination           Protocol Length Info
    177 4.463129       14.161.41.70          172.31.11.35          SIP/SDP  1433   Request: INVITE sip:nguyenhuan@ec2-35-166-179-244.us-west-2.compute.amazonaws.com | 

No.     Time           Source                Destination           Protocol Length Info
    179 4.463367       172.31.11.35          14.161.41.70          SIP      452    Status: 100 trying -- your call is important to us | 

No.     Time           Source                Destination           Protocol Length Info
    180 4.463421       172.31.11.35          172.31.13.113         SIP/SDP  1589   Request: INVITE sip:nguyenhuan@ec2-35-166-179-244.us-west-2.compute.amazonaws.com | 

No.     Time           Source                Destination           Protocol Length Info
   1215 32.552942      14.161.41.70          172.31.11.35          SIP      1105   Request: REGISTER sip:ec2-35-166-179-244.us-west-2.compute.amazonaws.com  (1 binding) | 


No.     Time           Source                Destination           Protocol Length Info
   1216 32.553170      172.31.11.35          172.31.13.113         SIP      1261   Request: REGISTER sip:ec2-35-166-179-244.us-west-2.compute.amazonaws.com  (1 binding) | 


No.     Time           Source                Destination           Protocol Length Info
   1219 32.555588      172.31.13.113         172.31.11.35          SIP      743    Status: 200 OK  (1 binding) | 


No.     Time           Source                Destination           Protocol Length Info
   1220 32.555706      172.31.11.35          14.161.41.70          SIP      593    Status: 200 OK  (1 binding) | 

No.     Time           Source                Destination           Protocol Length Info
   1609 42.603150      14.161.41.70          172.31.11.35          SIP      1113   Request: REGISTER sip:ec2-35-166-179-244.us-west-2.compute.amazonaws.com  (1 binding) | 


No.     Time           Source                Destination           Protocol Length Info
   1610 42.603364      172.31.11.35          172.31.13.113         SIP      1269   Request: REGISTER sip:ec2-35-166-179-244.us-west-2.compute.amazonaws.com  (1 binding) | 


No.     Time           Source                Destination           Protocol Length Info
   1613 42.605800      172.31.13.113         172.31.11.35          SIP      749    Status: 200 OK  (1 binding) | 

No.     Time           Source                Destination           Protocol Length Info
   1614 42.605932      172.31.11.35          14.161.41.70          SIP      599    Status: 200 OK  (1 binding) | 


No.     Time           Source                Destination           Protocol Length Info
   1688 44.425237      172.31.11.35          14.161.41.70          SIP      471    Status: 408 Request Timeout | 


No.     Time           Source                Destination           Protocol Length Info
   1689 44.425285      172.31.11.35          172.31.13.113         SIP      491    Request: CANCEL sip:nguyenhuan@ec2-35-166-179-244.us-west-2.compute.amazonaws.com | 


No.     Time           Source                Destination           Protocol Length Info
   1691 44.426018      172.31.13.113         172.31.11.35          SIP      519    Status: 200 canceling | 


Data from Sip Server:
-------------------------------
No.     Time           Source                Destination           Protocol Length Info
    237 6.242928       172.31.11.35          172.31.13.113         SIP/SDP  1589   Request: INVITE sip:nguyenhuan@ec2-35-166-179-244.us-west-2.compute.amazonaws.com | 


No.     Time           Source                Destination           Protocol Length Info
    243 6.244409       172.31.13.113         172.31.11.35          SIP      602    Status: 100 trying -- your call is important to us | 

No.     Time           Source                Destination           Protocol Length Info
    244 6.244541       172.31.13.113         14.161.41.70          SIP/SDP  1720   Request: INVITE sip:nguyenhuan@14.161.41.70:33267;transport=udp | 


No.     Time           Source                Destination           Protocol Length Info
    288 6.710414       172.31.13.113         14.161.41.70          SIP/SDP  1720   Request: INVITE sip:nguyenhuan@14.161.41.70:33267;transport=udp | 


No.     Time           Source                Destination           Protocol Length Info
    328 7.710454       172.31.13.113         14.161.41.70          SIP/SDP  1720   Request: INVITE sip:nguyenhuan@14.161.41.70:33267;transport=udp | 



No.     Time           Source                Destination           Protocol Length Info
    396 9.710411       172.31.13.113         14.161.41.70          SIP/SDP  1720   Request: INVITE sip:nguyenhuan@14.161.41.70:33267;transport=udp | 


No.     Time           Source                Destination           Protocol Length Info
    547 13.710407      172.31.13.113         14.161.41.70          SIP/SDP  1720   Request: INVITE sip:nguyenhuan@14.161.41.70:33267;transport=udp | 


No.     Time           Source                Destination           Protocol Length Info
    688 17.710406      172.31.13.113         14.161.41.70          SIP/SDP  1720   Request: INVITE sip:nguyenhuan@14.161.41.70:33267;transport=udp | 


No.     Time           Source                Destination           Protocol Length Info
    835 21.710381      172.31.13.113         14.161.41.70          SIP/SDP  1720   Request: INVITE sip:nguyenhuan@14.161.41.70:33267;transport=udp | 



No.     Time           Source                Destination           Protocol Length Info
    985 25.710385      172.31.13.113         14.161.41.70          SIP/SDP  1720   Request: INVITE sip:nguyenhuan@14.161.41.70:33267;transport=udp | 


No.     Time           Source                Destination           Protocol Length Info
   1130 29.710407      172.31.13.113         14.161.41.70          SIP/SDP  1720   Request: INVITE sip:nguyenhuan@14.161.41.70:33267;transport=udp | 


No.     Time           Source                Destination           Protocol Length Info
   1279 33.710400      172.31.13.113         14.161.41.70          SIP/SDP  1720   Request: INVITE sip:nguyenhuan@14.161.41.70:33267;transport=udp | 


No.     Time           Source                Destination           Protocol Length Info
   1303 34.332395      172.31.11.35          172.31.13.113         SIP      1261   Request: REGISTER sip:ec2-35-166-179-244.us-west-2.compute.amazonaws.com  (1 binding) | 


No.     Time           Source                Destination           Protocol Length Info
   1312 34.334415      172.31.13.113         172.31.11.35          SIP      743    Status: 200 OK  (1 binding) | 


No.     Time           Source                Destination           Protocol Length Info
   1459 37.710402      172.31.13.113         14.161.41.70          SIP/SDP  1720   Request: INVITE sip:nguyenhuan@14.161.41.70:33267;transport=udp | 


No.     Time           Source                Destination           Protocol Length Info
   1609 41.710395      172.31.13.113         14.161.41.70          SIP/SDP  1720   Request: INVITE sip:nguyenhuan@14.161.41.70:33267;transport=udp | 



Huan Nguyen,
---------------------------------------

Mobile app developer
Phan Thi Company
Sai Gon, VietNam
Steve Nguyen,
---------------------------------------
Cell phone: (84)909585104
Mobile app developer
Phan Thi Company
Sai Gon, VietNam