Summary:ASTERISK-14323: AstApplicationData when called with several arguments escapes comma with backslash
Reporter:Nito Martinez (nito)Labels:
Date Opened:2009-06-16 19:59:22Date Closed:2011-07-26 15:18:48
Versions:Frequency of
Description:In my configuration we use LDAP as our database repository

With entries like this

dn: uid=jsalonen,ou=People,
AstApplication: Macro
AstExtension: 5035
AstPriority: 1
AstApplicationData: sipdial,SIP/nito,+3400012345

There is a macro in the dialplan

exten => ... ${ARG1} ...

and so on

on version 1.0.6-beta9 the macro was correctly called as:


but since version the macro is called as:


That is setting a backslash for any comma that appears,

****** STEPS TO REPRODUCE ******

Create a macro with more than one argument and try to reproduce.


Workaround in my configuration is

exten => s,1,Set(newarg1=${CUT(ARG1,\\,1)})
exten => s,n,Set(newarg2=${CUT(ARG2,\\,1)})
exten => s,n,Macro(sipdial,${newarg1},${newarg2})
Comments:By: Gavin Henry (suretec) 2009-11-10 03:45:28.000-0600


Have you tried this in the latest version?


By: Sander Eerdekens (sandereerd) 2010-02-22 14:47:28.000-0600

I am experiencing the same issue.
SIP Extensions are stored in LDAP.

AstApplication: Dial
AstApplicationData: SIP/user1,15,tr

then when trying to call the user:
-- Executing Dial("SIP/user2-00000012", "SIP/user1\,15\,tr")

Using Asterisk
Any help would be appreciated.

Would like to help debugging/testing if nessecary.

Edit: Found what appears to be the problem: pipes were used before to pass arguments?

When using pipes instead of commas, the pipes are replaced by commas again withing the res_config_ldap.c

This way the correct command is called:
-- Executing Dial("SIP/user2-00000012", "SIP/user1,15,tr")

AstApplication: Dial
AstApplicationData: SIP/user1|15|tr

Is this a bug or a feature? ;)

By: Vadim Mikhnevych (vmikhnevych) 2010-07-07 04:43:25

I've encountered a similar bug in,, .9 and .10-rc1, while calling a macro from AGI-script.
The console shows:
-- AGI Script Executing Application: (ExecIf) Options: ($[${DIALSTATUS}==BUSY]?Macro(BUTTON_REDIAL,1968):NoOp(${DIALSTATUS}))
[Jul  7 12:29:34] WARNING[8788]: app_macro.c:302 _macro_exec: No such context 'macro-BUTTON_REDIAL\' for macro 'BUTTON_REDIAL\'

Of course, there exists a context named [macro-BUTTON_REDIAL] , but it precedes comma with a backslash somewhy. But that's not the end. If I rename that context to [macro-BUTTON_REDIAL\] and reload dialplan, I have another bug:

CLI> dialplan show macro-BUTTON_REDIAL\
There is no existence of 'macro-BUTTON_REDIAL ' context
Command 'dialplan show macro-BUTTON_REDIAL\ ' failed.

Keep in mind, that auto-completion was used for macro name, and "dialplan show macro-" shows "macro-BUTTON_REDIAL\ " as one of possible matches,

As this affects AGI-script functioning, I suggest it has not a "trivial", but a higher severity.

By: Leif Madsen (lmadsen) 2010-10-21 08:01:19

I don't believe this really has anything to do with LDAP and is probably a functionality of how things are escaped in the Asterisk dialplan more generally. It just happens you're using res_config_ldap.

By: Russell Bryant (russell) 2011-07-26 15:18:43.504-0500

Per the Asterisk maintenance timeline page at http://www.asterisk.org/asterisk-versions maintenance (bug) support for the 1.4 and 1.6.x branches has ended. For continued maintenance support please move to the 1.8 branch which is a long term support (LTS) branch. For more information about branch support, please see https://wiki.asterisk.org/wiki/display/AST/Asterisk+Versions

If this is still an issue, please open a new issue so it can be re-triaged appropriately. Thanks!