release mutex after iterating over channel vars

This commit is contained in:
Daniel Swarbrick 2012-05-10 10:19:45 +02:00
parent 76330ec918
commit 3ba5c72977
1 changed files with 8 additions and 3 deletions

View File

@ -124,11 +124,16 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
/* Channel variables */
bson_append_start_object(&cdr, "variables");
for (hi = switch_channel_variable_first(channel); hi; hi = hi->next) {
if (!zstr(hi->name) && !zstr(hi->value)) {
bson_append_string(&cdr, hi->name, hi->value);
if ((hi = switch_channel_variable_first(channel))) {
for (; hi; hi = hi->next) {
if (!zstr(hi->name) && !zstr(hi->value)) {
bson_append_string(&cdr, hi->name, hi->value);
}
}
switch_channel_variable_last(channel);
}
bson_append_finish_object(&cdr); /* variables */