[Home]

Summary:ASTERISK-10327: macro defined in realtime that uses cmd MYSQL fails to connect
Reporter:Bruce Ferrell (bferell)Labels:
Date Opened:2007-09-18 00:18:54Date Closed:2011-06-07 14:08:01
Priority:MinorRegression?No
Status:Closed/CompleteComponents:PBX/pbx_realtime
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:MYSQL(Connect connid hostid xxxxx '' asterisk)

works in a macro defined in extensions.conf.

When the macro is defined in realtime it fails to connect
Comments:By: Jason Parker (jparker) 2007-09-18 10:03:19

Are you able to switch back and forth between extensions.conf and realtime, and reliably reproduce this?

I can't think of any reasons why an application would behave differently between the two.

By: Bruce Ferrell (bferell) 2007-09-19 10:55:11

yes, like clockwork.  I thought it was weird too

By: Jason Parker (jparker) 2007-09-19 12:24:18

Can you show us the exact dialplans (in both extensions.conf and in realtime) that do and do not work?

By: Bruce Ferrell (bferell) 2007-09-19 12:45:50

[macro-set-out-cid-pbx]

exten => s,1,MYSQL(Connect connid hostid root '' asterisk)
exten => s,2,MYSQL(Query resultid ${connid} select\ did\ from\ call_xlatn\ where\ ext=\'${CHANNEL:4:17}\')
exten => s,3,MYSQL(Fetch fetchid ${resultid} datavar)
exten => s,4,MYSQL(Disconnect ${connid})
exten => s,5,Set(anin=${datavar})
exten => s,6,Set(CALLERID(all)=${anin})


select * from extensions_table where context like 'macro-set%';
+-------+-----------------------+-------+----------+-------+---------------------------------------------------------------------------------+
| id    | context               | exten | priority | app   | appdata                                                                         |
+-------+-----------------------+-------+----------+-------+---------------------------------------------------------------------------------+
| 14792 | macro-set-out-cid-pbx | s     | 1        | MYSQL | Connect connid hostid root '' asterisk                            |
| 14793 | macro-set-out-cid-pbx | s     | 2        | MYSQL | Query resultid ${connid} select did from call_xlatn where ext='${CHANNEL:4:17}' |
| 14794 | macro-set-out-cid-pbx | s     | 3        | MYSQL | Fetch fetchid ${resultid} datavar                                               |
| 14795 | macro-set-out-cid-pbx | s     | 4        | MYSQL | Disconnect ${connid}                                                            |
| 14796 | macro-set-out-cid-pbx | s     | 5        | Set   | Disconnect ${connid}                                                            |
| 14797 | macro-set-out-cid-pbx | s     | 6        | Set   | (CALLERID(all)=${anin}                                                          |
+-------+-----------------------+-------+----------+-------+---------------------------------------------------------------------------------+

Failure in the realtime example happens on the connect



By: Jason Parker (jparker) 2007-09-19 12:50:27

The only difference I see between the two is that some of the spaces are escaped in the Query..  Do you get any error/warning messages?

I'd like to see your CLI output on a failed try.

By: Bruce Ferrell (bferell) 2007-09-22 14:38:19

-- Executing Macro("SIP/00-16-cb-92-dc-92-b5e13388", "set-out-cid-pbx")
   -- Executing MYSQL("SIP/00-16-cb-92-dc-92-b5e13388", "Connect connid dbhost root '' asterisk")
[Sep 22 19:52:45] WARNING[9969]: app_addon_sql_mysql.c:234 aMYSQL_connect: mysql_real_connect(mysql,dbhost,root,dbpass,asterisk,...) failed
   -- Executing MYSQL("SIP/00-16-cb-92-dc-92-b5e13388", "Query resultid  select did from call_xlatn where ext='00-16-cb-92-dc-92'")
[Sep 22 19:52:45] WARNING[9969]: app_addon_sql_mysql.c:114 find_identifier: Identifier 0, identifier_type 1 not found in identifier list
[Sep 22 19:52:45] WARNING[9969]: app_addon_sql_mysql.c:284 aMYSQL_query: aMYSQL_query: Invalid connection identifier 0 passed in aMYSQL_query
   -- Executing MYSQL("SIP/00-16-cb-92-dc-92-b5e13388", "Fetch fetchid  datavar")
[Sep 22 19:52:45] WARNING[9969]: app_addon_sql_mysql.c:114 find_identifier: Identifier 0, identifier_type 2 not found in identifier list
[Sep 22 19:52:45] WARNING[9969]: app_addon_sql_mysql.c:335 aMYSQL_fetch: aMYSQL_fetch: Invalid result identifier 0 passed
   -- Executing MYSQL("SIP/00-16-cb-92-dc-92-b5e13388", "Disconnect ")
[Sep 22 19:52:45] WARNING[9969]: app_addon_sql_mysql.c:114 find_identifier: Identifier 0, identifier_type 1 not found in identifier list
[Sep 22 19:52:45] WARNING[9969]: app_addon_sql_mysql.c:370 aMYSQL_disconnect: Invalid connection identifier 0 passed in aMYSQL_disconnect
   -- Executing Set("SIP/00-16-cb-92-dc-92-b5e13388", "Disconnect ")
[Sep 22 19:52:45] WARNING[9969]: pbx.c:5870 pbx_builtin_setvar: Ignoring entry 'Disconnect ' with no = (and not last 'options' entry)
   -- Executing Set("SIP/00-16-cb-92-dc-92-b5e13388", "(CALLERID(all)=")
[Sep 22 19:52:45] ERROR[9969]: pbx.c:1537 ast_func_write: Function  not registered
   -- Executing Set("SIP/00-16-cb-92-dc-92-b5e13388", "CDR(userfield)=00-16-cb-92-dc-92")
   -- Executing Set("SIP/00-16-cb-92-dc-92-b5e13388", "ext=15103933344")
   -- Executing Macro("SIP/00-16-cb-92-dc-92-b5e13388", "RNK-out")
   -- Executing Dial("SIP/00-16-cb-92-dc-92-b5e13388", "SIP/5103933344@207.2.123.182||r")
   -- Called 5103933344@207.2.123.182
   -- SIP/207.2.123.182-08277a68 is making progress passing it to SIP/00-16-cb-92-dc-92-b5e13388
 == Spawn extension (macro-RNK-out, s, 1) exited non-zero on 'SIP/00-16-cb-92-dc-92-b5e13388' in macro 'RNK-out'
 == Spawn extension (macro-RNK-out, s, 1) exited non-zero on 'SIP/00-16-cb-92-dc-92-b5e13388'


successful for comparison
===========================
   -- Executing Macro("SIP/00-16-cb-92-dc-92-b5e11e08", "set-out-cid-pbx")
   -- Executing [s@macro-set-out-cid-pbx:1] MYSQL("SIP/00-16-cb-92-dc-92-b5e11e08", "Connect connid dbhost root  asterisk") in new stack
   -- Executing [s@macro-set-out-cid-pbx:2] MYSQL("SIP/00-16-cb-92-dc-92-b5e11e08", "Query resultid 159 select did from call_xlatn where ext='00-16-cb-92-dc-92'") in new stack
   -- Executing [s@macro-set-out-cid-pbx:3] MYSQL("SIP/00-16-cb-92-dc-92-b5e11e08", "Fetch fetchid 160 datavar") in new stack
   -- Executing [s@macro-set-out-cid-pbx:4] MYSQL("SIP/00-16-cb-92-dc-92-b5e11e08", "Disconnect 159") in new stack
   -- Executing [s@macro-set-out-cid-pbx:5] Set("SIP/00-16-cb-92-dc-92-b5e11e08", "anin=5105551212") in new stack
   -- Executing [s@macro-set-out-cid-pbx:6] Set("SIP/00-16-cb-92-dc-92-b5e11e08", "CALLERID(all)=5105551212") in new stack
   -- Executing Set("SIP/00-16-cb-92-dc-92-b5e11e08", "CDR(userfield)=00-16-cb-92-dc-92")
   -- Executing Set("SIP/00-16-cb-92-dc-92-b5e11e08", "ext=15103933344")
   -- Executing Macro("SIP/00-16-cb-92-dc-92-b5e11e08", "RNK-out")
   -- Executing Dial("SIP/00-16-cb-92-dc-92-b5e11e08", "SIP/5103933344@207.2.123.182||r")
   -- Called 5103933344@207.2.123.182
   -- SIP/207.2.123.182-082b26b0 is making progress passing it to SIP/00-16-cb-92-dc-92-b5e11e08
   -- Got SIP response 603 "Declined (no dialog)" back from 66.92.17.165
 == Spawn extension (macro-RNK-out, s, 1) exited non-zero on 'SIP/00-16-cb-92-dc-92-b5e11e08' in macro 'RNK-out'
 == Spawn extension (macro-RNK-out, s, 1) exited non-zero on 'SIP/00-16-cb-92-dc-92-b5e11e08'

By: Jason Parker (jparker) 2007-10-01 10:52:00

file pointed out that in your first CLI output, there is a '' in the Connect, but it is not there in the second CLI output.

It IS there in both extensions.conf, and in the DB.  It doesn't look like the extensions.conf matches the second CLI output.

By: Bruce Ferrell (bferell) 2007-10-01 13:20:05

I agree about appearences.  the '' is in both places

By: Tilghman Lesher (tilghman) 2007-10-01 15:21:54

Am I the only one to see that your fifth step is NOT the same?

"anin=${datavar}" != "Disconnect ${connid}"

By: Bruce Ferrell (bferell) 2007-10-01 15:48:14

good catch, however it's irrelevent.  the failed connect in step one makes all the rest fail

By: Tilghman Lesher (tilghman) 2007-10-01 16:14:17

If you do a 'dialplan show' after loading from extensions.conf, the contents therein should be identical to what you have in the database.  If they are not, that is where your issue lies.

By: Bruce Ferrell (bferell) 2007-10-01 16:39:32

[ Context 'macro-set-out-cid-pbx' created by 'pbx_config' ]
 Alt. Switch =>    'Realtime/macro-set-out-cid-pbx'              [pbx_config]

the rest of the macro is not displayed.  If fact after looking at the other parts of the dialplan, they are stored in Realtime, only the switch statement is displayed

By: Tilghman Lesher (tilghman) 2007-10-08 17:31:06

No, you were comparing earlier what happens when you load the Macro from extensions.conf to what happens when you load the Macro from realtime.  I want you to load the macro from extensions.conf AND THEN run 'dialplan show', comparing the results to what you have in the database.  I suspect you're running two different things.

If you like, come onto IRC server irc.freenode.net, channel #asterisk-bugs and ask to speak to a bug marshal.  Please be prepared to give remote root access to your machine.

By: Edoardo Serra - WeBRainstorm S.r.l. (webrainstorm) 2007-10-10 06:40:53

You can try the patch attached to bug ASTERISK-1087932 to see the exact error
My 0,02 €

By: Tilghman Lesher (tilghman) 2007-10-26 09:56:19

I am confident that this is a typo on your part.  If you can produce the requested debug and that is not the case, then you're welcome to reopen.