I have a Sipura SPA3102 (192.168.123.34) (1 FXO + 1 FXS) connected to my asterisk FreePBX (192.168.123.35, hostname paganini).
The SIP port on the Sipura FXO is configured at 5061 and that on the asterisk FreePBX is 5091. RTP Media ports for the asterisk PBX are 10000-10999.
The FXO is configured as a trunk and there is an outbound route configured for 7-digit numbers.
I have a remote extension 3002 on the FreePBX. Port forwarding is done at the firewall/router to forward 5091 and the RTP ports to the asterisk at 192.168.123.35 also.
The external IP address of the site where the PBX is located is 18.104.22.168 on the day of the test.
Extension 3002 is at home (192.168.88.64) and the external IP is 22.214.171.124 at the time of the test.
When I use extension 3002 (X-Lite) to dial a PSTN number, this is the sequence that I captured:
a. 192.168.64:61158 -> 126.96.36.199:5091 INVITE Via: SIP/2.0/UDP 192.168.88.64:61158;branch=… Contact: sip:email@example.com:61158 To: sip:2432196@paganini From: 3002@paganini;tag=d01ce305, SDP in the payload
b. 188.8.131.52:5091 -> 192.168.88.64:61158 401 Unauthorized. Authorization Digest algorithm=MD5 … Headers Via, From & To are repeated from the INVITE.
c. 192.168.88.64:61158 -> 184.108.40.206:5091 ACK Headers From & To are repeated with ;tag=xxxx added to From and To.
d. 192.168.88.64:61158 -> 220.127.116.11:5091 INVITE, same as the first INVITE but added the Authorization encrypted response
e. 18.104.22.168:5091 -> 192.168.88.64:61158 TRYING Contact: sip:firstname.lastname@example.org.[color=#FF0000]30[/color]:5091, From and To are the same as those in the INVITE.
The mysterious thing is why is the Contact not the IP of the Sipura FXO but the IP address of some unrelated computer on the LAN? The call gets dialed. But when it is answered, all the RTP packets go to that unrelated computer.
What should the proper Contact be at the TRYING response? Should it be the PBX or the FXO?