#include <switch.h>
SWITCH_BEGIN_EXTERN_C
+
+typedef struct profile_node_s {
+ char *var;
+ char *val;
+ struct profile_node_s *next;
+} profile_node_t;
+
+
+
/*! \brief Call Specific Data
*/
struct switch_caller_profile {
switch_memory_pool_t *pool;
struct switch_caller_profile *next;
switch_call_direction_t direction;
+ profile_node_t *soft;
};
/*! \brief An Abstract Representation of a dialplan Application */
switch_snprintf(header_name, sizeof(header_name), "%s-Profile-Index", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->profile_index);
}
+
+ if (caller_profile->soft) {
+ profile_node_t *pn;
+
+ for (pn = caller_profile->soft; pn; pn = pn->next) {
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, pn->var, pn->val);
+ }
+
+ }
+
if (caller_profile->times) {
switch_snprintf(header_name, sizeof(header_name), "%s-Profile-Created-Time", prefix);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->profile_created);
} else if (!strcasecmp(name, "chan_name")) {
channel->caller_profile->chan_name = v;
} else {
- status = SWITCH_STATUS_FALSE;
+ profile_node_t *pn, *n = switch_core_alloc(channel->caller_profile->pool, sizeof(*n));
+
+ n->var = switch_core_strdup(channel->caller_profile->pool, name);
+ n->val = v;
+
+ if (!channel->caller_profile->soft) {
+ channel->caller_profile->soft = n;
+ } else {
+ for(pn = channel->caller_profile->soft; pn && pn->next; pn = pn->next);
+
+ if (pn) {
+ pn->next = n;
+ }
+ }
}
switch_mutex_unlock(channel->profile_mutex);
}
switch_xml_set_txt_d(param, caller_profile->chan_name);
+
+ if (caller_profile->soft) {
+ profile_node_t *pn;
+
+ for (pn = caller_profile->soft; pn; pn = pn->next) {
+
+ if (!(param = switch_xml_add_child_d(xml, pn->var, off++))) {
+ return -1;
+ }
+ switch_xml_set_txt_d(param, pn->val);
+ }
+
+ }
+
+
return off;
}