[Freeswitch-dev] Need help on switch_ivr_originate(...) in switch_ivr_originate.c

Anthony Minessale anthony.minessale at gmail.com
Tue Jan 26 07:27:11 PST 2010


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 at test.com
,[foo=value2]sofia/internal/101 at test.com

foo will be value1 on both legs

{foo=value1,local_clobber=true}sofia/internal/100 at test.com
,[foo=value2]sofia/internal/101 at 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 at 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 at 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 at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
iax:guest at conference.freeswitch.org/888
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:+19193869900
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20100126/48615382/attachment.html 


More information about the FreeSWITCH-dev mailing list