DDWRT router NAT setup for FXO

Hi guys, I am trying to place my HT813 FXO behind my ddwrt firmware router. Now, I am facing a issue that seems something is dropped because of router. The FXO shows registered but freepbx shows down status for trunk. I tried to place my FXO IP into DMZ, but in vein. Directly connection with Public IP on FXO is fine. I tried to turn on keep alive on FXO, but also in vein. Could guys let me know if there is anything else I missed?

The network part setup almost like below guide

Thanks all

In the HT FXO page, set Register Expiration to 2 (minutes). Also check that in FreePBX, Qualify Frequency for the trunk is set to 60 (the default but it may have been changed).

If you still have trouble with registration, post what appears in the Asterisk log when the device first tries to register, e.g., when it is rebooted. Also post what appears when registration is lost.

I don’t agree with some of the Futur-Tech settings, but none of them should affect registration.

Hi @Stewart1 , I tried follow your suggested setting and checked the log. The ip1 which is fine and directly connect with internet and ip2 is behind the ddwrt router and has issue.

When I directly plug to internet, the trunk is up on both side and log shows at below

NOTICE[1586] res_pjsip/pjsip_transport_events.c: Transport ‘0.0.0.0-tls’ to remote ‘ip1’ - The certificate is untrusted
NOTICE[1586] res_pjsip/pjsip_transport_events.c: Transport ‘0.0.0.0-tls’ to remote ‘ip1’ - The server identity does not match to any identities specified in the certificate

When FXO plug to my router, only FXO shows registered and the log shows at below.

image

WARNING[137351] res_pjsip_registrar.c: Registration attempt from endpoint ‘0123456789’ (ip2:39113) to AOR ‘0123456789’ will exceed max contacts of 1

Please let me know if you want more details. Thank you.

Set Max Contacts for the trunk to 4 and post new logs.

Also. I suggest you test with UDP transport, so we don’t confuse TLS and SIP issues.

maybe silly question, but are you passing port 5060 in both directions ? for example, on pfSense, it randomizes outbound ports, so even though i state 5060 on the device, i still have to set a static 5060 on the outbound NAT

Sure, but in this case, the PBX should should accept any source port. If it changes on each re-registration, that could be a problem, but the TCP connection should stay up between registrations so there should be no change.

May I know where I can setup for max contact for trunk? on /etc/asterisk/pjsip_custom.conf and add below value?

[0123456789]
max_contacts=4

On second thought, set remove_existing to true, instead of messing with max_contacts:

in /etc/asterisk/pjsip_custom_post.conf put

[0123456789](+type=aor)
remove_existing=true

After fwconsole restart, confirm that this took by typing at the Asterisk command line:
pjsip show aor 0123456789
then retest.
If you still have trouble, test using UDP transport to determine whether this is related to TLS.

After that, I see the sip register with internal ip. So, I setup stun and everything works now. Thank you!