Please confirm that this is trunk registration related (after the internet is working again, you can make calls between extensions, access voicemail from an extension, etc.)
After causing the issue, see whether running
from a root shell prompt restores connectivity. If so and a monitoring script proves necessary, it could restart Asterisk instead of rebooting the whole server.
If REGISTER requests are really being repeatedly issued with no reply, the problem is likely a ‘poisoned’ NAT association in your router that is being kept alive by the continual retries.
Or, Asterisk may have considered the error to be ‘fatal’ and given up.
At the Asterisk console, type
pjsip set logger on
(for pjsip trunks) and/or
sip set debug on
(for chan_sip trunks).
See whether registration requests are going out and what replies, if any are being received.
If there is no reply to repeated requests, it’s probably a router NAT issue. If your router allows separate configuration of ‘unreplied’ and ‘assured’ timeouts, try setting unreplied down to e.g. 10 seconds. Otherwise, try having Asterisk wait longer between retries: set General Retry Interval (pjsip) or registertimeout (chan_sip) to e.g. 600 (10 minutes) and also set the qualify frequency to 600.
If you still have trouble, post router make/model. If the router doesn’t get a public IP on its WAN interface, post details (modem is configured as router, ISP does NAT, etc.)
If you have a static IP and your provider supports it, using IP authentication may avoid the need for registration altogether.
If you have trunks used only for outbound, most providers will accept calls without registration (though they still need to be authenticated).
If your provider can route calls to a SIP URI and you have dynamic DNS set up, you may be able to receive calls without registration, even with a dynamic IP address (you’ll also have to permit incoming INVITEs from the provider’s IP addresses through your firewall).