FS-10623 [mod_conference] add conference to xml/json list

This commit is contained in:
lazedo 2018-03-21 23:19:00 +00:00
parent 51b96c33cb
commit ce198895f1
1 changed files with 20 additions and 6 deletions

View File

@ -1090,7 +1090,8 @@ switch_xml_t add_x_tag(switch_xml_t x_member, const char *name, const char *valu
void conference_xlist(conference_obj_t *conference, switch_xml_t x_conference, int off)
{
conference_member_t *member = NULL;
switch_xml_t x_member = NULL, x_members = NULL, x_flags;
switch_xml_t x_member = NULL, x_members = NULL, x_flags, x_variables;
switch_event_header_t *hp;
int moff = 0;
char i[30] = "";
char *ival = i;
@ -1175,6 +1176,13 @@ void conference_xlist(conference_obj_t *conference, switch_xml_t x_conference, i
switch_snprintf(i, sizeof(i), "%d", switch_epoch_time_now(NULL) - conference->run_time);
switch_xml_set_attr_d(x_conference, "run_time", ival);
x_variables = switch_xml_add_child_d(x_conference, "variables", 0);
for (hp = conference->variables->headers; hp; hp = hp->next) {
switch_xml_t x_variable = switch_xml_add_child_d(x_variables, "variable", 0);
switch_xml_set_attr_d(x_variable, "name", hp->name);
switch_xml_set_attr_d(x_variable, "value", hp->value);
}
x_members = switch_xml_add_child_d(x_conference, "members", 0);
switch_assert(x_members);
@ -1292,7 +1300,8 @@ void conference_xlist(conference_obj_t *conference, switch_xml_t x_conference, i
void conference_jlist(conference_obj_t *conference, cJSON *json_conferences)
{
conference_member_t *member = NULL;
static cJSON *json_conference, *json_conference_members, *json_conference_member, *json_conference_member_flags;
static cJSON *json_conference, *json_conference_variables, *json_conference_members, *json_conference_member, *json_conference_member_flags;
switch_event_header_t *hp;
switch_assert(conference != NULL);
json_conference = cJSON_CreateObject();
@ -1332,6 +1341,11 @@ void conference_jlist(conference_obj_t *conference, cJSON *json_conferences)
cJSON_AddNumberToObject(json_conference, "max_members", conference->max_members);
}
cJSON_AddItemToObject(json_conference, "variables", json_conference_variables = cJSON_CreateObject());
for (hp = conference->variables->headers; hp; hp = hp->next) {
cJSON_AddStringToObject(json_conference_variables, hp->name, hp->value);
}
cJSON_AddItemToObject(json_conference, "members", json_conference_members = cJSON_CreateArray());
switch_mutex_lock(conference->member_mutex);
for (member = conference->members; member; member = member->next) {