[Freeswitch-dev] Need help on switch_ivr_originate(...) in switch_ivr_originate.c
Alex To
tonhudung at gmail.com
Tue Jan 26 03:53:00 PST 2010
Hi,
Would somebody enlighten me on this trunk of code in the mentioned file at
line 2273:
if (local_clobber) {
if (var_event) {
switch_event_t *event;
switch_event_header_t *header;
/* install the vars from the {} params
*/
for (header = var_event->headers;
header; header = header->next) {
switch_channel_set_variable(originate_status[i].peer_channel, header->name,
header->value);
}
switch_event_create(&event,
SWITCH_EVENT_CHANNEL_ORIGINATE);
switch_assert(event);
switch_channel_event_set_data(originate_status[i].peer_channel, event);
switch_event_fire(&event);
}
}
if (vdata) {
char *var_array[1024] = { 0 };
int var_count = 0;
if ((var_count = switch_separate_string(vdata,
'|', var_array, (sizeof(var_array) / sizeof(var_array[0]))))) {
int x = 0;
for (x = 0; x < var_count; x++) {
char *inner_var_array[2] = { 0 };
int inner_var_count;
if ((inner_var_count =
switch_separate_string(var_array[x], '=',
inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0])))) ==
2) {
switch_channel_set_variable(originate_status[i].peer_channel,
inner_var_array[0], inner_var_array[1]);
}
}
}
}
if (!local_clobber) {
if (var_event) {
switch_event_t *event;
switch_event_header_t *header;
/* install the vars from the {} params
*/
for (header = var_event->headers;
header; header = header->next) {
switch_channel_set_variable(originate_status[i].peer_channel, header->name,
header->value);
}
switch_event_create(&event,
SWITCH_EVENT_CHANNEL_ORIGINATE);
switch_assert(event);
switch_channel_event_set_data(originate_status[i].peer_channel, event);
switch_event_fire(&event);
}
}
The code block inside if (local_clobber) and if (!local_clobber) does
exactly the same thing. May I know is it by design and how does it actually
work ? I am not sure what does it mean by localClobber so if someone can
spare sometime explaining, I would really appreciate it.
Thank you
Best Regards
Alex To
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20100126/bc7b4753/attachment-0001.html
More information about the FreeSWITCH-dev
mailing list