Asterisk Register on Invite

I have an issue when the asterisk is restarted and all extensions become ‘Unspecified’.
If I’m trying to reach such extension - it will fail. But, if that extension is making a call outside - everything is working fine, except that the phone anyway is not registered on the server. So, any inbound calls to that extension will fail until the phone will send a new registration message, even if the invite was authenticated successfully.

Is there any way in Asterisk to register an extension on the first Invite?
Thank you.

If it knew where the device was, it wouldn’t need the device to register!

If you know where the device is, then you should not specify it as dynamic, but supply the actual IP address, eliminating the need to register, entirely.

Thank’s david551,

This is a good point but, unfortunately, this cannot be done because the extension is using dynamic IP address.

If you cant specify the IP address on the peer details, you can reduce the registration time on the device it self

I think I’m not having a DNS problem.
My communication is all internal.

I can not see the log in real time, or in the full file.

I only see the moment of the connection, and after the delay of 30 seconds the moment of connection to the telephone.

At this interval I can not know anything that happens in asterisk.

Look the debug

This image is when i call by Call Manager to Asterisk.

This image is the continuos… Look the time stamp. After 16:52:53 i have log only 16:53:21. This moment , its ringing on the phone. but I do not see what happens between 52:53 until 53:21 . Almost 30 seconds.

I need the tip to see all trace to understand.

Thx all !!!

Internal addresses will still be subject to DNS resolution, and, if you don’t positively reject unknown internal addresses, you may well get a long delay.

Thank you !
Any suggestions on dns resolution?
I can not see that this is according to the logs. But if I can do something.

I tried to add directly to the host file. Is it a good option?