Calls start 18 seconds after dialed

Something strange is happening to my running distro.
When I place a call between two sip extensions the called phone rings after about 18 seconds. ( Outbound calls via sip trunks , same behaviour)
I’m monitoring at asterisk CLI prompt , i.e. ext 5004 is calling 5001 :

Once call is placed by phone, nothing is happening on CLI,
then after 9 seconds the list of asterisk operations is displayed , ending with :

– Executing [[email protected]:44] Dial(“SIP/5004-00000018”, “SIP/995001&SIP/5001,30,TtrI”) in new stack
[2015-07-21 09:52:08] WARNING[4289][C-0000000e]: app_dial.c:2381 dial_exec_full: Unable to create channel of type ‘SIP’ (cause 20 - Subscriber absent)

Then after 9 seconds further of CLI inactivity (and phone silence), the called extension rings and CLI displays :

== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Called SIP/5001
– Connected line update to SIP/5004-00000018 prevented.
== Extension Changed 5001[ext-local] new state Ringing for Notify User 5007
– SIP/5001-00000019 is ringing

So the call can be answered in a regular way.

For incoming calls, behaviour is the same always those 9+9 seconds of inactivity with
Unable to create channel of type ‘SIP’ (cause 20 - Subscriber absent) in the middle.

sip peers are all registered correctly as well sip trunks, already tried reload, restart, reboot (of IP phones also) with no appreciable results.

Any idea about what to check ?

Thank you

Look this:

Try using softphones on both ends , the set nat=yes and post the result.

Thank you for sugestion,
Anyway I thing that wasn’t the problem as all is suddenly back working OK …!!!
In this particular installation , internet connection was down for two days: could this be the cause of this malfunctioning ??
FreePBX uses a DNS server that resides on the same LAN
Is there something FreePBX tries to look to internet (resolver, stun etc) before start handling the call ??
Anyway, the issue was present for some hours after internet connection has become up again.

Any comment please ??

STUN is definitively involved.

I’ve replicated the issue by declaring a wrong gateway (so no internet) so 18 seconds are needed to start an internal call.

Then I’ve removed stun server ip address from SIP settings–RTP settings and now internall calls are placed correctly.

Why STUN is invoked for internal calls ?
This system is on a LAN behind a router (nat) and has no external/internet extensions , do I still need a stun server ?

Thank you

I have seen this behavior when my DNS server was unreachable.
Not exactly sure as to why that was happening.

Thanks for reply,
Do you have a STUN server declared in SIPsettings->RTPsettings ?
Is it set with a name instead of ip address ?
If it’s a name it cannot be resolved when DNS is unreachable so my behaviour is replicated…

No. I wasn’t using STUN. There was really no reason to use DNS when the problem was occurring. That’s why it was so strange.

So, if internal calls fail when internet connection is not present , something configured in a bad way is the cause, I can only think so, Internet has not to be mandatory for a pbx system to work.

Probably our macroscopic error in networking section config??
Some experienced guy can help us ???

Thank you

P.S. just opening LAN pbx webpage for maintenance takes tens of seconds when internet connection is not present…