Merge pull request #1196 in FS/freeswitch from ~PECHEN/freeswitch:feature/FS-10061-send-custom-variables-on-incoming to master

* commit 'ccae1567803ec7bb7b3c7cb623911a50f898c754':
  FS-10061 [mod_verto] now it sends custom variables on incoming call via verto
This commit is contained in:
Mike Jerris 2017-03-07 10:11:39 -06:00
commit c16434bf04

View File

@ -1077,6 +1077,8 @@ static void set_call_params(cJSON *params, verto_pvt_t *tech_pvt) {
const char *caller_id_number = NULL;
const char *callee_id_name = NULL;
const char *callee_id_number = NULL;
const char *prefix = "verto_h_";
switch_event_header_t *var = NULL;
caller_id_name = switch_channel_get_variable(tech_pvt->channel, "caller_id_name");
caller_id_number = switch_channel_get_variable(tech_pvt->channel, "caller_id_number");
@ -1092,7 +1094,14 @@ static void set_call_params(cJSON *params, verto_pvt_t *tech_pvt) {
cJSON_AddItemToObject(params, "display_direction",
cJSON_CreateString(switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound"));
for (var = switch_channel_variable_first(tech_pvt->channel); var; var = var->next) {
const char *name = (char *) var->name;
char *value = (char *) var->value;
if (!strncasecmp(name, prefix, strlen(prefix))) {
cJSON_AddItemToObject(params, name, cJSON_CreateString(value));
}
}
switch_channel_variable_last(tech_pvt->channel);
}