Asterisk + VoIP Gateway and always got Request 408 error

First, I want to use voip softphone calling PTSN.

In asterisk, My sip.conf and extension.conf had set like below:



exten => _0XXXXXXXXX,1,Dial(SIP/${EXTEN}@voip_gateway)
exten => _0XXXXXXXXX,n,Hangup()

I can’t find the real problem what I missed if VoIP gateway has some promblems.

You don’t have a sip.conf entry for the VoIP gateway.

You appear to have a SIP phone outside of NAT but you have no way of telling Asterisk its public address.

Best practice is type=peer.

allow without disallow has no effect, as everything is allowed.

canreinvite is deprecated, use directmedia.

nat=yes is deprecated, use the specific sub-options you actually need.

You really really want allowguest=no (although the default may have been changed to that).

Thanks david551 for your advice!
My access point used port forwarding to tell Sip server where the user can communicate to server.
I have a small test that used two clients one is sip softphone ,the other is voip gateway FXS phone.
They can talk to each other. But I set voip gateway rule is VoIP coming output to FXO port.
And the sip phone would have a error is Request 408, I do not have any idea what happened with my VoIP gateway!

I used welltech 2522!Below is the introduction of voip gateway!

If you are going through port forwarding, that suggests NAT. In that case, Asterisk needs to be told about its public address and which address ranges are inside the NAT boundary. See the sample configuration files for details, as I think some of the parameter names have changed recently.