[Freeswitch-dev] Implement Javascript setGlobalVariable() optional third parameter

Anthony Minessale anthony.minessale at gmail.com
Mon May 24 13:44:34 PDT 2010


this is typically done by opening a new feature issue under FSCORE at
http://jira.freeswitch.org with a diff generated from an up-to-date git
checkout.



On Fri, May 21, 2010 at 10:58 AM, David Swardstrom <
dswardstrom at remotelink.com> wrote:

> I am developing FreeSwitch Javascript capability to emulate some
> functionality that is currently provided by a Dialogic based proprietary
> system running on Microsoft Windows, originally using ISDN interfaces and
> then ported to Sip based VoIP capability.
> This system uses external post-processing code that processes "event" type
> data for billing and other purposes and I need to provide equivalent event
> data.
> As part of this effort, I need a counter that is guarantied unique when
> there is a possibility that multiple calls may access the counter. The
> proprietary code, this unique counter is provided by using
> InterlockedIncrement().
>
> Looking at the available JavaScript code, it appears that using
> getGlobalVariable() and setGlobalVariable() as described in the SetGlobalVar
> Wiki page would allow me to do this as long as I was willing to allow holes
> in the count.
>
> However, I decided to look at the code to see exactly what was being done
> to implement this. I found was that there was no code at all to implement
> the 3rd optional parameter.
>
> I would like to implement this capability but extend the capability to
> truly provide a unique counter. To accomplish this, support must be provided
> by the switch core.
>
> I would like to provide a new routine into switch_core.c:
> <Following is the text for switch_core.h>
> /*!
>  \brief Conditionally add a global variable to the core
>  \param varname the name of the variable
>  \param value the value of the variable
>  \param val2 the value of the variable to verify against
>  \     If the global did not exist and val2=="", add global with value,
> return true
>  \     If the global exists with the value of val2, replace it, return true
>  \     If the global exists with a value other than val2, return false
> */
> SWITCH_DECLARE(switch_bool_t) switch_core_set_var_conditional(_In_z_ const
> char *varname, _In_opt_z_ const char *value, _In_opt_z_ const char *val2);
>
> Then the code in mod_spidermonkey.c can be modified to use this new switch
> core capability.
>
> Note: I have implemented this in my local version and have tested it.
>
> _______________________________________________
> 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>
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/20100524/e37732d6/attachment-0001.html 


More information about the FreeSWITCH-dev mailing list