Simple MySQL - Asterisk connectivity prob

all i need is just to read some value from MySQL into a variable in Asterisk

i googled alot for connecting Astreisk with MySQL, came accross many solutions, one of them was ‘Asterisk cmd MySQL’, but some how not able to make work even one, i did every thing described in it http://www.voip-info.org/wiki/index.php?page=Asterisk+cmd+MYSQL & herez my dialplan

exten => 999, 1, Wait()
exten => 999, 2, Answer()
exten => 999, 3, Playback(connecting)
exten => 999,4,MYSQL(Connect connid localhost root acdacd asteriskdb)
;exten => 999,4,MYSQL(Connect connid 172.16.1.209 root dbpass asteriskdb)
exten => 999,5,MYSQL(Query resultid ${connid} SELECT\ Number\ from\ number\ where\ test=11)
exten => 999,6,MYSQL(Fetch fetchid ${resultid} var1)
exten => 999,7,MYSQL(Clear ${resultid})
exten => 999,8,MYSQL(Disconnect ${connid})

i compile Asterisk, it gets compiled but when i dial 999, it executes ‘Wait’, ‘Answer’, ‘Playback’ but shows error while executing MYSQL(Connect connid localhost root acdacd asteriskdb)…it says something is failed while executing this statement (unfortunately i forgot to get the exact error log on CLI)

i tried it again without any password to the root@localhost for MySQL(asteriskDB) n many more combinitions but all in vain…the same error

anybody plz help me in it, or tell me the whole step-by-step process if some1 can

2 thing,

First of all you don’t need to recompile asterisk everytime you change something in the extension.conf

Second, we absolutly need the exact error you get in the CLI.
David

okay here i go
but forgive me for one more error that i did’nt even mention in my prev post n that is; when i do perl -MCPAN -e “install DBD::mysql” before installing asterisk-addons as instructed in the asterisk-addons installation section, it gives me the following error (error log from CLI)
[color=darkblue]

t/insertid.t 255 65280 12 24 200.00% 1-12
t/param_values.t 255 65280 8 15 187.50% 1-8
t/prepare_noerror.t 255 65280 3 3 100.00% 1 3
t/texecute.t 255 65280 9 17 188.89% 1-9
1 test skipped.
Failed 20/22 test scripts, 9.09% okay. 428/434 subtests failed, 1.38% okay.
make: *** [test_dynamic] Error 255
/usr/bin/make test – NOT OK
Running make install
make test had returned bad status, won’t install without force[/color]

and then returns back to the LINUX prompt, so plz if any1 have any idea about what should i do at this moment

but then i continued installing asterisk-addons i.e. make, make install, and then compiled asterisk and received the following error upon dialing 999:

[color=darkblue]*CLI> – Executing Wait(“SIP/100-c25c”, “”) in new stack
– Executing Answer(“SIP/100-c25c”, “”) in new stack
– Executing Playback(“SIP/100-c25c”, “connecting”) in new stack
Aug 30 00:43:16 WARNING[7298]: file.c:512 ast_openstream_full: File connecting does not exist in any format
Aug 30 00:43:16 WARNING[7298]: file.c:824 ast_streamfile: Unable to open connecting (format ulaw): No such file or directory
Aug 30 00:43:16 WARNING[7298]: app_playback.c:132 playback_exec: ast_streamfile failed on SIP/100-c25c for connecting
– Executing MYSQL(“SIP/100-c25c”, “Connect connid localhost root acdacd asteriskdb”) in new stack
Aug 30 00:43:16 WARNING[7298]: app_addon_sql_mysql.c:235 aMYSQL_connect: mysql_real_connect(mysql,localhost,root,dbpass,asteriskdb,…) failed
– Executing MYSQL(“SIP/100-c25c”, “Query resultid SELECT Number from number where test=11”) in new stack
Aug 30 00:43:16 WARNING[7298]: app_addon_sql_mysql.c:115 find_identifier: Identifier 0, identifier_type 1 not found in identifier list
Aug 30 00:43:16 WARNING[7298]: app_addon_sql_mysql.c:279 aMYSQL_query: aMYSQL_query: Invalid connection identifier 0 passed in aMYSQL_query
– Executing MYSQL(“SIP/100-c25c”, “Fetch fetchid var1”) in new stack
Aug 30 00:43:16 WARNING[7298]: app_addon_sql_mysql.c:115 find_identifier: Identifier 0, identifier_type 2 not found in identifier list
Aug 30 00:43:16 WARNING[7298]: app_addon_sql_mysql.c:330 aMYSQL_fetch: aMYSQL_fetch: Invalid result identifier 0 passed
– Executing MYSQL(“SIP/100-c25c”, "Clear ") in new stack
Aug 30 00:43:16 WARNING[7298]: app_addon_sql_mysql.c:115 find_identifier: Identifier 0, identifier_type 2 not found in identifier list
Aug 30 00:43:16 WARNING[7298]: app_addon_sql_mysql.c:348 aMYSQL_clear: Invalid result identifier 0 passed in aMYSQL_clear
– Executing MYSQL(“SIP/100-c25c”, "Disconnect ") in new stack
Aug 30 00:43:16 WARNING[7298]: app_addon_sql_mysql.c:115 find_identifier: Identifier 0, identifier_type 1 not found in identifier list
Aug 30 00:43:16 WARNING[7298]: app_addon_sql_mysql.c:365 aMYSQL_disconnect: Invalid connection identifier 0 passed in aMYSQL_disconnect
Aug 30 00:43:26 WARNING[7298]: pbx.c:2415 __ast_pbx_run: Timeout, but no rule ‘t’ in context ‘agents’[/color]

so now watchin for any helper

[help] anyone who has made Asterisk communicate with MySQL can help me…waiting desperately

To install DBD::mysql on some systems require a forced install command, mine did (Fedora Core 5):

cpan

cpan> force install DBD::mysql

This will skip the errors from the testing, but will install OK.

Once this is done, recompile asterisk-addons, and install.

Hope this helps.

G.

thanx ‘g_man’ for your tip, doing that i got DBD::mysql installed successfully, but after that even though i had make clean, make & make install the asterisk-addon-1.2.3 successfully, it still shows the same error/warning upon dialing 999
(error log)
[color=blue]…
Executing Wait(“SIP/102-48e8”, “”) in new stack
– Executing Answer(“SIP/102-48e8”, “”) in new stack
– Executing Playback(“SIP/102-48e8”, “connecting”) in new stack
– Playing ‘connecting’ (language ‘en’)
– [/color][color=red]Executing MYSQL(“SIP/102-48e8”, “Connect connid 172.16.1.68 root acdacd asteriskDB”) in new stack
Jun 15 14:40:38 WARNING[18064]: app_addon_sql_mysql.c:235 aMYSQL_connect: mysql_real_connect(mysql,172.16.1.68,root,dbpass,asteriskDB,…) failed[/color][color=blue]
– Executing MYSQL(“SIP/102-48e8”, “Query resultid SELECT num1 from num where test=11”) in new stack
Jun 15 14:40:38 WARNING[18064]: app_addon_sql_mysql.c:115 find_identifier: Identifier 0, identifier_type 1 not found in identifier list
Jun 15 14:40:38 WARNING[18064]: app_addon_sql_mysql.c:279 aMYSQL_query: aMYSQL_query: Invalid connection identifier 0 passed in aMYSQL_query
– Executing MYSQL(“SIP/102-48e8”, “Fetch fetchid var1”) in new stack
Jun 15 14:40:38 WARNING[18064]: app_addon_sql_mysql.c:115 find_identifier: Identifier 0, identifier_type 2 not found in identifier list
Jun 15 14:40:38 WARNING[18064]: app_addon_sql_mysql.c:330 aMYSQL_fetch: aMYSQL_fetch: Invalid result identifier 0 passed
…[/color]

one more error that i must mention, comes while executing asterisk & that is:

[color=blue][res_config_mysql.so] => (MySQL RealTime Configuration Driver)
Jun 15 14:52:29 [/color][color=red]ERROR[/color][color=blue][17888]: res_config_mysql.c:615 mysql_reconnect: MySQL RealTime: Failed to connect database server on . Check debug for more info.
Jun 15 14:52:29 WARNING[17888]: res_config_mysql.c:450 load_module: MySQL RealTime: Couldn’t establish connection. Check debug.
Jun 15 14:52:29 NOTICE[17888]: config.c:863 ast_config_engine_register: Registered Config Engine mysql
MySQL RealTime driver loaded. [/color]

i m running asterisk-1.2.9 on FC-4 and i’ve explicitly cheked that with root@localhost (i.e. 172.16.1.68 ) & pwd=acdacd i can access MySQL…now plz suggest me something

root@localhost and root@172.16.1.68 are NOT the same user account in mysql!!! they are separate and distinct, in my experience.

change your connid to use localhost or 127.0.0.1 and not the external IP address of the box, that’s probably what your problem is.