From: Anthony Minessale Date: Wed, 7 Nov 2007 00:00:51 +0000 (+0000) Subject: recurse variable expansion in api variables X-Git-Tag: v1.0-beta2~206 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22d52836e0ab270583d3797de3edeccfe2b42eae;p=thirdparty%2Ffreeswitch.git recurse variable expansion in api variables git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6169 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- diff --git a/src/switch_channel.c b/src/switch_channel.c index 8a287c705d..555132fe38 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1379,12 +1379,21 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel SWITCH_STANDARD_STREAM(stream); if (stream.data) { + char *expanded = NULL; + + if ((expanded = switch_channel_expand_variables(channel, vval)) == vval) { + expanded = NULL; + } else { + vval = expanded; + } + if (switch_api_execute(vname, vval, channel->session, &stream) == SWITCH_STATUS_SUCCESS) { func_val = stream.data; sub_val = func_val; - } else { - free(stream.data); } + + switch_safe_free(expanded); + free(stream.data); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); free(data);