Problem with delay in call setup

FreePBX12 distro installation. Overall the system works. The problem is that both inbound and outbound calls have a 10 to 15 second delay between dialing the number and the first ring.

The problem appears to be some kind of configuration problem on my system. For example, when calling in from outside, tail -f /var/log/asterisk/full shows that the call is routed from Vitelity to my system within a second or two. The log spins through to this point, which shows a 9 second delay.

> [2016-01-25 10:40:07] VERBOSE[11808][C-00000073] pbx.c: -- Executing [s@app-blacklist-check:3] Return("SIP/vitel-inbound-00000076", "") in new stack
> [2016-01-25 10:40:07] VERBOSE[11808][C-00000073] pbx.c: -- Executing [s@ext-did:3] Gosub("SIP/vitel-inbound-00000076", "cidlookup,cidlookup_2,1()") in new stack
> [2016-01-25 10:40:07] VERBOSE[11808][C-00000073] pbx.c: -- Executing [cidlookup_2@cidlookup:1] Set("SIP/vitel-inbound-00000076", "CURLOPT(httptimeout)=7") in new stack
> **[2016-01-25 10:40:08] VERBOSE[11808][C-00000073] pbx.c: -- Executing [cidlookup_2@cidlookup:2] Set("SIP/vitel-inbound-00000076", "CALLERID(name)=EVOLVING SYS") in new stack**
> **[2016-01-25 10:40:23] VERBOSE[1788][C-00000074] netsock2.c: == Using SIP RTP TOS bits 184**
> [2016-01-25 10:40:23] VERBOSE[1788][C-00000074] netsock2.c: == Using SIP RTP CoS mark 5
> [2016-01-25 10:40:23] VERBOSE[11854][C-00000074] pbx.c: -- Executing [6503252100@from-trunk:1] NoOp("SIP/vitel-inbound-00000077", "Catch-All DID Match - Found 6503252100 - You probably want a DID for this.") in new stack
> [2016-01-25 10:40:23] VERBOSE[11854][C-00000074] pbx.c: -- Executing [6503252100@from-trunk:2] Log("SIP/vitel-inbound-00000077", "WARNING,Friendly Scanner from 66.241.99.27") in new stack
> [2016-01-25 10:40:23] WARNING[11854][C-00000074] Ext. 6503252100: Friendly Scanner from 66.241.99.27
> [2016-01-25 10:40:23] VERBOSE[11854][C-00000074] pbx.c: -- Executing [6503252100@from-trunk:3] Set("SIP/vitel-inbound-00000077", "__FROM_DID=6503252100") in new stack

Need a bit of help identifying the configuration problem and how to correct it.

Thanks.

What further information can I provide to aid in getting help analyzing this problem?

I had a similar issue that was a result of specifying a STUN server in the Asterisk SIP Settings. I didn’t have the network and firewall (firewall device not related to the FreePBX Firewall Module) configured properly, so it was creating this delay. As soon as I removed the STUN Server setting and left it blank, everything was fine.

I have not yet re-enabled the STUN Server settings, just haven’t had time to identify the proper firewall rules needed.

I hope that helps.

Thank you. That was the source of the problem. Removed the stun server and the delay went away.