");
- if ((vc = ao2_find(vco, var, 0)))
- vc->count++;
- else {
- /* Create a new entry for this one */
- vc = ao2_alloc(sizeof(*vc), NULL);
- vc->varname = var;
- vc->count = 1;
- ao2_link(vco, vc);
- }
- xml_copy_escape(out, var, xml ? 1 | 2 : 0);
- if (vc->count > 1)
- ast_str_append(out, 0, "-%d", vc->count);
- ao2_ref(vc, -1);
- ast_str_append(out, 0, xml ? "='" : " | ");
- if (!strcmp(var, "Opaque-data"))
- in_data = 1;
+ if (in_data) {
+ /* Process data field in Opaque mode */
+ xml_copy_escape(out, val, 0); /* data field */
+ ast_str_append(out, 0, xml ? "\n" : " \n");
+ continue;
}
+
+ /* We expect "Name: value" line here */
+ var = strsep(&val, ":");
+ if (val) {
+ /* found the field name */
+ val = ast_skip_blanks(val);
+ ast_trim_blanks(var);
+ } else {
+ /* field name not found, switch to opaque mode */
+ val = var;
+ var = "Opaque-data";
+ in_data = 1;
+ }
+
+
+ ast_str_append(out, 0, xml ? " " : " |
");
+ if ((vc = ao2_find(vco, var, 0))) {
+ vc->count++;
+ } else {
+ /* Create a new entry for this one */
+ vc = ao2_alloc(sizeof(*vc), NULL);
+ vc->varname = var;
+ vc->count = 1;
+ ao2_link(vco, vc);
+ }
+
+ xml_copy_escape(out, var, xml ? 1 | 2 : 0); /* data name */
+ if (vc->count > 1) {
+ ast_str_append(out, 0, "-%d", vc->count);
+ }
+ ao2_ref(vc, -1);
+ ast_str_append(out, 0, xml ? "='" : " | ");
xml_copy_escape(out, val, 0); /* data field */
- if (!in_data)
- ast_str_append(out, 0, xml ? "'" : " |
\n");
- else
- ast_str_append(out, 0, xml ? "\n" : "