[Home]

Summary:ASTERISK-20589: When using eswitch - variable substitution fails if there is no dialplan executed immediately before the eswitch
Reporter:sybasesql (sybasesql)Labels:
Date Opened:2012-10-21 05:59:02Date Closed:
Priority:MajorRegression?
Status:Open/NewComponents:PBX/pbx_realtime
Versions:1.8.16.0 13.18.4 Frequency of
Occurrence
Constant
Related
Issues:
duplicatesASTERISK-19265 ESwitch not Converting Variables
is related toASTERISK-15123 eswitch does not substiotute variables when using Local Channel
Environment:OS: CentOS 5.5 x86_64 Asterisk: Asterisk 1.8.16.0 x86_64Attachments:
Description:eswitch not substitute variables (${CDR(accountcode)}=100 in this example):
[out]
eswitch => Realtime/${CDR(accountcode)}-out@

and when I dialed 101 extension I got INCORRECT SQL in PostgreSQL (through odbc):
LOG:  statement: SELECT * FROM asterisk.extensions WHERE exten = E'101' AND context = E'-out' AND priority = E'1'

but if I add any function before eswitch calling variables substitution occured:
[out]
exten => _X.,1,NoOp(out)
eswitch => Realtime/${CDR(accountcode)}-out@

and when I dialed 101 extension I got CORRECT SQL in PostgreSQL (through odbc):
LOG:  statement: SELECT * FROM asterisk.extensions WHERE exten = E'101' AND context = E'100-out' AND priority = E'2'
Comments:By: Rusty Newton (rnewton) 2012-11-06 18:48:04.383-0600

sybasesql, i'm pretty sure this is a bug, but it would be helpful if you could provide a full log with VERBOSE and DEBUG both turned up to level 5 and captured during a demonstration of the failure.

By: Rusty Newton (rnewton) 2012-11-06 19:01:36.394-0600

What channel technology is being used? Is this a local channel,  sip channel, etc ?

By: sybasesql (sybasesql) 2012-11-07 00:55:46.561-0600

This is SIP channel.
It's hard to capture because this is production server with high load.
There are what I can get with verbose/debug level 5:

---good call 100 -> 101 (with noop first)
[Nov  7 05:48:01] DEBUG[17712] pbx.c: Launching 'NoOp'
[Nov  7 05:48:01] VERBOSE[17712] pbx.c:     -- Executing [101@out:1] NoOp("SIP/100-0000a16d", "Out") in new stack
[Nov  7 05:48:01] DEBUG[17712] pbx.c: Function result is '100'
[Nov  7 05:48:01] DEBUG[17712] res_config_odbc.c: Skip: 0; SQL: SELECT * FROM asterisk.extensions WHERE exten = ? AND context = ? AND priority = ?
[Nov  7 05:48:01] DEBUG[17712] res_config_odbc.c: Parameter 1 ('exten') = '101'
[Nov  7 05:48:01] DEBUG[17712] res_config_odbc.c: Parameter 2 ('context') = '100-out'
[Nov  7 05:48:01] DEBUG[17712] res_config_odbc.c: Parameter 3 ('priority') = '2'
[Nov  7 05:48:01] DEBUG[17712] res_odbc.c: odbc_release_obj2(0x2ac6fc00aea8) called (obj->txf = (nil))
[Nov  7 05:48:01] DEBUG[17712] res_config_odbc.c: Skip: 0; SQL: SELECT * FROM asterisk.extensions WHERE exten LIKE ? AND context = ? AND priority = ? ORDER BY exten
[Nov  7 05:48:01] DEBUG[17712] res_config_odbc.c: Parameter 1 ('exten LIKE') = '\_%'
[Nov  7 05:48:01] DEBUG[17712] res_config_odbc.c: Parameter 2 ('context') = '100-out'
[Nov  7 05:48:01] DEBUG[17712] res_config_odbc.c: Parameter 3 ('priority') = '2'
[Nov  7 05:48:01] DEBUG[17712] res_odbc.c: odbc_release_obj2(0x2ac6fc00aea8) called (obj->txf = (nil))
[Nov  7 05:48:01] VERBOSE[17712] pbx.c:     -- Auto fallthrough, channel 'SIP/100-0000a16d' status is 'UNKNOWN'
[Nov  7 05:48:01] DEBUG[17712] channel.c: Soft-Hanging up channel 'SIP/100-0000a16d'
[Nov  7 05:48:01] DEBUG[17712] pbx.c: Function result is '100'
[Nov  7 05:48:01] DEBUG[17712] res_config_odbc.c: Skip: 0; SQL: SELECT * FROM asterisk.extensions WHERE exten = ? AND context = ? AND priority = ?
[Nov  7 05:48:01] DEBUG[17712] res_config_odbc.c: Parameter 1 ('exten') = 'h'
[Nov  7 05:48:01] DEBUG[17712] res_config_odbc.c: Parameter 2 ('context') = '100-out'
[Nov  7 05:48:01] DEBUG[17712] res_config_odbc.c: Parameter 3 ('priority') = '1'
[Nov  7 05:48:01] DEBUG[17712] res_odbc.c: odbc_release_obj2(0x2ac6fc00aea8) called (obj->txf = (nil))
[Nov  7 05:48:01] DEBUG[17712] res_config_odbc.c: Skip: 0; SQL: SELECT * FROM asterisk.extensions WHERE exten LIKE ? AND context = ? AND priority = ? ORDER BY exten
[Nov  7 05:48:01] DEBUG[17712] res_config_odbc.c: Parameter 1 ('exten LIKE') = '\_%'
[Nov  7 05:48:01] DEBUG[17712] res_config_odbc.c: Parameter 2 ('context') = '100-out'
[Nov  7 05:48:01] DEBUG[17712] res_config_odbc.c: Parameter 3 ('priority') = '1'
[Nov  7 05:48:01] DEBUG[17712] res_odbc.c: odbc_release_obj2(0x2ac6fc00aea8) called (obj->txf = (nil))
---bad call 100 -> 101 (with eswitch first)
[Nov  7 05:46:47] DEBUG[28126] pbx.c: Function result is '(null)'
[Nov  7 05:46:47] DEBUG[28126] res_config_odbc.c: Skip: 0; SQL: SELECT * FROM asterisk.extensions WHERE exten = ? AND context = ? AND priority = ?
[Nov  7 05:46:47] DEBUG[28126] res_config_odbc.c: Parameter 1 ('exten') = '101'
[Nov  7 05:46:47] DEBUG[28126] res_config_odbc.c: Parameter 2 ('context') = '-out'
[Nov  7 05:46:47] DEBUG[28126] res_config_odbc.c: Parameter 3 ('priority') = '1'
[Nov  7 05:46:47] DEBUG[28126] res_odbc.c: odbc_release_obj2(0x2ac6fc00aea8) called (obj->txf = (nil))
[Nov  7 05:46:47] DEBUG[28126] res_config_odbc.c: Skip: 0; SQL: SELECT * FROM asterisk.extensions WHERE exten LIKE ? AND context = ? AND priority = ? ORDER BY exten
[Nov  7 05:46:47] DEBUG[28126] res_config_odbc.c: Parameter 1 ('exten LIKE') = '\_%'
[Nov  7 05:46:47] DEBUG[28126] res_config_odbc.c: Parameter 2 ('context') = '-out'
[Nov  7 05:46:47] DEBUG[28126] res_config_odbc.c: Parameter 3 ('priority') = '1'
[Nov  7 05:46:47] DEBUG[28126] res_odbc.c: odbc_release_obj2(0x2ac6fc00aea8) called (obj->txf = (nil))
[Nov  7 05:46:47] DEBUG[28126] pbx.c: Function result is '(null)'
[Nov  7 05:46:47] DEBUG[28126] res_config_odbc.c: Skip: 0; SQL: SELECT * FROM asterisk.extensions WHERE exten = ? AND context = ? AND priority = ?
[Nov  7 05:46:47] DEBUG[28126] res_config_odbc.c: Parameter 1 ('exten') = '101'
[Nov  7 05:46:47] DEBUG[28126] res_config_odbc.c: Parameter 2 ('context') = '-out'
[Nov  7 05:46:47] DEBUG[28126] res_config_odbc.c: Parameter 3 ('priority') = '1'
[Nov  7 05:46:47] DEBUG[28126] res_odbc.c: odbc_release_obj2(0x2ac6fc00aea8) called (obj->txf = (nil))
[Nov  7 05:46:47] DEBUG[28126] res_config_odbc.c: Skip: 0; SQL: SELECT * FROM asterisk.extensions WHERE exten LIKE ? AND context = ? AND priority = ? ORDER BY exten
[Nov  7 05:46:47] DEBUG[28126] res_config_odbc.c: Parameter 1 ('exten LIKE') = '\_%'
[Nov  7 05:46:47] DEBUG[28126] res_config_odbc.c: Parameter 2 ('context') = '-out'
[Nov  7 05:46:47] DEBUG[28126] res_config_odbc.c: Parameter 3 ('priority') = '1'
[Nov  7 05:46:47] DEBUG[28126] res_odbc.c: odbc_release_obj2(0x2ac6fc00aea8) called (obj->txf = (nil))

By: Rusty Newton (rnewton) 2012-11-07 17:30:39.675-0600

sybasesql, please remove the debug and attach as separate files to the issue. https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines

The issue has been acknowledged and being that it's most likely in pbx_realtime (under extended support) it will be up to the community to investigate the issue.

Thanks!