res_config_mysql querying database twice + DTMF problem

Hi,

My setup: Asterisk: 1.6.0-beta9, asterisk-addons-1.5.0-beta4

Two question.

  1. When using Realtime switch in my dialplan pointing to MySQL table (‘ivr’ in my case), Asterisk is queering every extension/priority twice. Why? This way we increase load on DB server by 100% - bad. My debug output:

.... [Jun 6 13:57:47] DEBUG[13407]: res_config_mysql.c:868 mysql_reconnect: MySQL RealTime: Connection okay. [Jun 6 13:57:47] DEBUG[13407]: res_config_mysql.c:151 realtime_mysql: MySQL RealTime: Retrieve SQL: SELECT * FROM ivr WHERE exten = 's' AND context = 'ivr-47' AND priority = '1' [Jun 6 13:57:47] DEBUG[13407]: res_config_mysql.c:868 mysql_reconnect: MySQL RealTime: Connection okay. [Jun 6 13:57:47] DEBUG[13407]: res_config_mysql.c:151 realtime_mysql: MySQL RealTime: Retrieve SQL: SELECT * FROM ivr WHERE exten = 's' AND context = 'ivr-47' AND priority = '1' -- Executing Set("SIP/10001-081eb8c0", "IVR_REPEATS=3") ...

  1. When using ‘Backgdoud(my-sound,m)’ in MySQL Realtime dialplan, I have to send DTMF twice to force asterisk to execute given extension. For example in my DB table I got:

... "context","exten","priority","app","appdata" .... "ivr-47","s",4,"Background","/home/chris/sounds/welcome,m," "ivr-47","s",5,"Background","/home/chris/sounds/you-have-these-options,m," ... "ivr-47","0",1,"Macro","UserLocal,1"

and when dialling into this context I press “0” once:

[Jun 6 13:57:48] DEBUG[13407]: channel.c:3189 set_format: Set channel SIP/10001-081eb8c0 to write format ulaw -- <SIP/10001-081eb8c0> Playing '/home/chris/sounds/you-have-these-options.ulaw' (language 'ivr-47') [Jun 6 13:57:50] DEBUG[13407]: rtp.c:950 process_rfc2833: - RTP 2833 Event: 00000000 (len = 4) [Jun 6 13:57:50] DEBUG[13407]: rtp.c:798 send_dtmf: Sending dtmf: 48 (0), at 78.105.1.131 [Jun 6 13:57:50] DEBUG[13407]: rtp.c:950 process_rfc2833: - RTP 2833 Event: 00000000 (len = 4) [Jun 6 13:57:50] DEBUG[13407]: rtp.c:950 process_rfc2833: - RTP 2833 Event: 00000000 (len = 4) [Jun 6 13:57:50] DEBUG[13407]: rtp.c:950 process_rfc2833: - RTP 2833 Event: 00000000 (len = 4) [Jun 6 13:57:50] DEBUG[13407]: rtp.c:950 process_rfc2833: - RTP 2833 Event: 00000000 (len = 4) [Jun 6 13:57:50] DEBUG[13407]: rtp.c:798 send_dtmf: Sending dtmf: 48 (0), at 78.105.1.131 [Jun 6 13:57:50] DEBUG[13407]: res_config_mysql.c:868 mysql_reconnect: MySQL RealTime: Connection okay. [Jun 6 13:57:50] DEBUG[13407]: res_config_mysql.c:151 realtime_mysql: MySQL RealTime: Retrieve SQL: SELECT * FROM ivr WHERE exten = '0' AND context = 'ivr-47' AND priority = '1' [Jun 6 13:57:50] DEBUG[13407]: channel.c:3189 set_format: Set channel SIP/10001-081eb8c0 to write format alaw [Jun 6 13:57:50] DEBUG[13407]: rtp.c:950 process_rfc2833: - RTP 2833 Event: 00000000 (len = 4) [Jun 6 13:57:50] DEBUG[13407]: res_config_mysql.c:868 mysql_reconnect: MySQL RealTime: Connection okay. [Jun 6 13:57:50] DEBUG[13407]: res_config_mysql.c:151 realtime_mysql: MySQL RealTime: Retrieve SQL: SELECT * FROM ivr WHERE exten = 's' AND context = 'ivr-47' AND priority = '1' [Jun 6 13:57:50] DEBUG[13407]: rtp.c:950 process_rfc2833: - RTP 2833 Event: 00000000 (len = 4) [Jun 6 13:57:50] DEBUG[13407]: res_config_mysql.c:868 mysql_reconnect: MySQL RealTime: Connection okay. [Jun 6 13:57:50] DEBUG[13407]: res_config_mysql.c:151 realtime_mysql: MySQL RealTime: Retrieve SQL: SELECT * FROM ivr WHERE exten LIKE '_%' AND context = 'ivr-47' AND priority = '1'

nothing happens, Asterisk is waiting and if:

a) “0” is pressed again:

[Jun 6 13:57:53] DEBUG[13407]: rtp.c:950 process_rfc2833: - RTP 2833 Event: 00000000 (len = 4) [Jun 6 13:57:53] DEBUG[13407]: rtp.c:798 send_dtmf: Sending dtmf: 48 (0), at 78.105.1.131 [Jun 6 13:57:53] DEBUG[13407]: rtp.c:950 process_rfc2833: - RTP 2833 Event: 00000000 (len = 4) [Jun 6 13:57:53] DEBUG[13407]: rtp.c:950 process_rfc2833: - RTP 2833 Event: 00000000 (len = 4) [Jun 6 13:57:53] DEBUG[13407]: rtp.c:950 process_rfc2833: - RTP 2833 Event: 00000000 (len = 4) [Jun 6 13:57:53] DEBUG[13407]: rtp.c:950 process_rfc2833: - RTP 2833 Event: 00000000 (len = 4) [Jun 6 13:57:53] DEBUG[13407]: rtp.c:798 send_dtmf: Sending dtmf: 48 (0), at 78.105.1.131 [Jun 6 13:57:53] DEBUG[13407]: res_config_mysql.c:868 mysql_reconnect: MySQL RealTime: Connection okay. [Jun 6 13:57:53] DEBUG[13407]: res_config_mysql.c:151 realtime_mysql: MySQL RealTime: Retrieve SQL: SELECT * FROM ivr WHERE exten LIKE '0_%' AND context = 'ivr-47' AND priority = '1' [Jun 6 13:57:53] DEBUG[13407]: res_config_mysql.c:868 mysql_reconnect: MySQL RealTime: Connection okay. [Jun 6 13:57:53] DEBUG[13407]: res_config_mysql.c:272 realtime_multi_mysql: MySQL RealTime: Retrieve SQL: SELECT * FROM ivr WHERE exten LIKE '\\_%' AND context = 'ivr-47' AND priority = '1' ORDER BY exten [Jun 6 13:57:53] DEBUG[13407]: rtp.c:950 process_rfc2833: - RTP 2833 Event: 00000000 (len = 4) [Jun 6 13:57:53] DEBUG[13407]: res_config_mysql.c:868 mysql_reconnect: MySQL RealTime: Connection okay. [Jun 6 13:57:53] DEBUG[13407]: res_config_mysql.c:151 realtime_mysql: MySQL RealTime: Retrieve SQL: SELECT * FROM ivr WHERE exten = '0' AND context = 'ivr-47' AND priority = '1' == CDR updated on SIP/10001-081eb8c0 [Jun 6 13:57:53] DEBUG[13407]: rtp.c:950 process_rfc2833: - RTP 2833 Event: 00000000 (len = 4) [Jun 6 13:57:53] DEBUG[13407]: res_config_mysql.c:868 mysql_reconnect: MySQL RealTime: Connection okay. [Jun 6 13:57:53] DEBUG[13407]: res_config_mysql.c:151 realtime_mysql: MySQL RealTime: Retrieve SQL: SELECT * FROM ivr WHERE exten = '0' AND context = 'ivr-47' AND priority = '1' [Jun 6 13:57:53] DEBUG[13407]: res_config_mysql.c:868 mysql_reconnect: MySQL RealTime: Connection okay. [Jun 6 13:57:53] DEBUG[13407]: res_config_mysql.c:151 realtime_mysql: MySQL RealTime: Retrieve SQL: SELECT * FROM ivr WHERE exten = '0' AND context = 'ivr-47' AND priority = '1'  -- Executing Macro("SIP/10001-081eb8c0", "UserLocal,1") [Jun 6 13:57:53] DEBUG[13407]: pbx.c:2885 pbx_extension_helper: Launching 'Macro'

b) if no another “0” is sent - call is terminated.

Any help with the above issues very much appreciated.