Ignore my previous message. Wanted to say thanks Anthony but I
wrote “Mike” . I think I wrote it in a hurry.
Sorry for the mistake and thanks Anthony for your help. :D
Regards
Alex To
From:
freeswitch-dev-bounces@lists.freeswitch.org
[mailto:freeswitch-dev-bounces@lists.freeswitch.org] On Behalf Of Anthony
Minessale
Sent: Tuesday, January 26, 2010 11:27 PM
To: freeswitch-dev@lists.freeswitch.org
Subject: Re: [Freeswitch-dev] Need help on switch_ivr_originate(...) in
switch_ivr_originate.c
local_clobber true|false
(default false)
whether or not to allow (per-leg) local variables inside [] to take precedence
over originate global variables in {}
{foo=value1,local_clobber=false}sofia/internal/100@test.com,[foo=value2]sofia/internal/101@test.com
foo will be value1 on both legs
{foo=value1,local_clobber=true}sofia/internal/100@test.com,[foo=value2]sofia/internal/101@test.com
foo will be value1 on all legs except the 101 who set it to value2
On Tue, Jan 26, 2010 at 5:53 AM, Alex To <tonhudung@gmail.com> wrote:
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
_______________________________________________
FreeSWITCH-dev mailing list
FreeSWITCH-dev@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
http://www.freeswitch.org
--
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire
AIM: anthm
MSN:anthony_minessale@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org
pstn:+19193869900