Solved. Firewall problem.
In case someone may run into this issue.
There is a firewall between Asterisk and the database. The firewall kills an
idle TCP connection after an hour. Asterisk and MySQL do not know this. Next
time a call comes in, Asterisk reuses the connection. To make use of the
connection, realtime pings the mysql first to check the connection. However,
the firewall has killed/blocked the session so TCP on Asterisk side does not
get an ACK. TCP then retries to transmit for about 15 minutes.
Then after 2 hours TCP Keep-Alives on Asterisk server and MySQL server kicks
in which does not help.
Solution: Make TCP Keep-Alive kick in after 45 minutes of idle connection.
R
On Thu, Mar 27, 2008 at 5:22 PM, Richard Open Source <oss.richard at
gmail.com>
wrote:
> Hi,
>
> I am investigating an issue with voicemail and realtime.
>
> What we are seeing is the following:
> 1. Caller calls in and goes to an IVR
> 2. Presses 101 to go to voicemail
> 3. app_voicemail start and tries to connect to the database trhough
> res_config_mysql. However, it takes too long to be able to connect (~15
> minutes)
> It seems like it first attemots to connect to the database on 16:25:03 and
> manage to connect at 16:40:24.
>
> [Mar 26 16:25:03] VERBOSE[19786] logger.c: -- AGI Script agi://
> 127.0.0.1/enswitch?stype=external completed, returning 0
> [Mar 26 16:25:03] DEBUG[19786] pbx.c: Launching 'Answer'
> [Mar 26 16:25:03] VERBOSE[19786] logger.c: -- Executing
> [101 at enswitch-mailbox:1] Answer("SIP/5060-ac017e30",
"") in new stack
> [Mar 26 16:25:03] DEBUG[19786] pbx.c: Expression result is '0'
> [Mar 26 16:25:03] DEBUG[19786] pbx.c: Launching 'GotoIf'
> [Mar 26 16:25:03] VERBOSE[19786] logger.c: -- Executing
> [101 at enswitch-mailbox:2] GotoIf("SIP/5060-ac017e30",
"0?5") in new stack
> [Mar 26 16:25:03] DEBUG[19786] pbx.c: Not taking any branch
> [Mar 26 16:25:03] DEBUG[19786] pbx.c: Launching 'VoiceMail'
> [Mar 26 16:25:03] VERBOSE[19786] logger.c: -- Executing
> [101 at enswitch-mailbox:3] VoiceMail("SIP/5060-ac017e30",
"101 at 708|us<101 at 708%7Cus>")
> in new stack
> [Mar 26 16:25:03] DEBUG[19786] app_voicemail.c: Before find_user
> [Mar 26 16:25:03] DEBUG[19786] app_voicemail.c: In find_user_realtime for
> mailbox 101 context 708
>
> [Mar 26 16:40:24] VERBOSE[14269] logger.c: Really destroying SIP dialog
> '1004787600 at 127.0.0.1' Method: OPTIONS
> [Mar 26 16:40:28] ERROR[19786] res_config_mysql.c: MySQL RealTime: Ping
> failed (2006). Trying an explicit reconnect.
> [Mar 26 16:40:28] DEBUG[19786] res_config_mysql.c: MySQL RealTime: Server
> Error (2006): MySQL server has gone away
> [Mar 26 16:40:28] DEBUG[19786] res_config_mysql.c: MySQL RealTime:
> Successfully connected to database.
> [Mar 26 16:40:28] DEBUG[19786] res_config_mysql.c: MySQL RealTime:
> Retrieve SQL: SELECT * FROM mailboxes WHERE mailbox = '101' AND
context > '708'
> The database and the connection seems to be ok. It is only this query
> that's taking long.
>
> We are experiencing this on Asterisk 1.4.17 and 1.4.18 but difficult to
> reproduce.
>
> Anybody have any idea what might be the cause and how to procceed and
> figure out what's wrong?
>
> Thanks in advance.
>
> R
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.digium.com/pipermail/asterisk-users/attachments/20080402/dd5efa63/attachment.htm