[Freeswitch-users] mod_managed switch_xml_open_cfg and SIGSEGV

Anthony Minessale anthony.minessale at gmail.com
Sat Sep 17 02:04:51 MSD 2011


I dont use managed stuff but in c you would have

switch_xml_t xml, cfg;

 xml = switch_xml_open_cfg("freeswitch.conf", &cfg, NULL);

cfg is the same type of xml a node inside the xml pointed in "xml"

it always returns the whole root and then the area you are searching for.

When you are done you release the xml pointer and the cfg will also be released.



On Fri, Sep 16, 2011 at 4:52 PM, R H <buscom123+fs at gmail.com> wrote:
> Thanks for your response Anthony,
> I should of mentioned this in my previous email but The method signature
> for switch_xml_open_cfg looks like the following:
>
> public static switch_xml switch_xml_open_cfg(string file_path,
> SWIGTYPE_p_p_switch_xml node, switch_event arg2)
>
> and i have been unable to figure out how to create an instance
> of SWIGTYPE_p_p_switch_xml to pass into that. As far as I can tell, is not
> instantiable unless you write an interface for swig to use before you build.
> Perhaps you can give me a hint on how to use that object or is there
> something that has to be changed on the mod_managed code itself? Sorry, I am
> pretty new to freeswitch and swig so I am not terribly sure why that object
> is not available for me to instantiate.
> Thank you so much for your help.
> Ryan
>
> On Thu, Sep 15, 2011 at 9:26 AM, Anthony Minessale
> <anthony.minessale at gmail.com> wrote:
>>
>> you have to supply the 2nd arg too.
>>
>> the returned obj is the whole xml root, the 2nd param is a pointer to
>> pointer of the section you searched for inside that root.
>>
>>
>> On Wed, Sep 14, 2011 at 3:41 PM, R H <buscom123+fs at gmail.com> wrote:
>> > Has anyone had success working with xml configuration files using
>> > mod_managed? I have several modules that DO NOT override the xml
>> > configuration but, rather, I actually want to configure them using the
>> > freeswitch conf directory structure. I have not even tried to parse the
>> > xml
>> > because I cant even load the xml. Here is a very basic example of what I
>> > tried and the result I got:
>> > The Code:
>> > ------------------------------------------------
>> > using System;
>> > using FreeSWITCH;
>> > using FreeSWITCH.Native;
>> > namespace PsiCallCenterAddon
>> > {
>> > public class FreeSwitchConfigLoader
>> > {
>> > public static void loadConfigTest()
>> > {
>> > try
>> > {
>> > switch_xml xml = freeswitch.switch_xml_open_cfg("freeswitch.conf", null,
>> > null);
>> > freeswitch.switch_xml_free(xml);
>> > Log.WriteLine(LogLevel.Alert, "Config Loader Success!");
>> > }
>> > catch
>> > {
>> > Log.WriteLine(LogLevel.Alert, "Config Loader Fail!");
>> > }
>> > }
>> > }
>> > }
>> > ------------------------------------------------
>> > The Result:
>> > ------------------------------------------------
>> > Stacktrace:
>> >   at (wrapper managed-to-native)
>> > FreeSWITCH.Native.freeswitchPINVOKE.switch_xml_open_cfg
>> >
>> > (string,System.Runtime.InteropServices.HandleRef,System.Runtime.InteropServices.HandleRef)
>> > <0x000a3>
>> >   at (wrapper managed-to-native)
>> > FreeSWITCH.Native.freeswitchPINVOKE.switch_xml_open_cfg
>> >
>> > (string,System.Runtime.InteropServices.HandleRef,System.Runtime.InteropServices.HandleRef)
>> > <0x000a3>
>> >   at FreeSWITCH.Native.freeswitch.switch_xml_open_cfg
>> >
>> > (string,FreeSWITCH.Native.SWIGTYPE_p_p_switch_xml,FreeSWITCH.Native.switch_event)
>> > <0x0004f>
>> >   at PsiCallCenterAddon.FreeSwitchConfigLoader.loadConfigTest ()
>> > <0x0001b>
>> >   at PsiCallCenterAddon.QueueMonitorLoader.Load () <0x0000b>
>> >   at FreeSWITCH.PluginManager.RunLoadNotify (System.Type[]) <0x00190>
>> >   at FreeSWITCH.AsmPluginManager.LoadInternal (string) <0x001eb>
>> >   at FreeSWITCH.PluginManager.Load (string) <0x000a7>
>> >   at (wrapper remoting-invoke-with-check) FreeSWITCH.PluginManager.Load
>> > (string) <0x00067>
>> >   at (wrapper xdomain-dispatch) FreeSWITCH.PluginManager.Load
>> > (object,byte[]&,byte[]&,string) <0x0017b>
>> >   at (wrapper xdomain-invoke) FreeSWITCH.PluginManager.Load (string)
>> > <0x00126>
>> >   at (wrapper remoting-invoke-with-check) FreeSWITCH.PluginManager.Load
>> > (string) <0x00047>
>> >   at FreeSWITCH.Loader.loadFile (string) <0x004a3>
>> >   at FreeSWITCH.Loader.Load () <0x0027b>
>> >   at (wrapper runtime-invoke) <Module>.runtime_invoke_bool
>> > (object,intptr,intptr,intptr) <0x00046>
>> > Native stacktrace:
>> >         /usr/lib64/libmono-2.0.so.1(+0xacba0) [0x7fc7ea58dba0]
>> >         /usr/lib64/libmono-2.0.so.1(+0xfcedf) [0x7fc7ea5ddedf]
>> >         /lib64/libpthread.so.0(+0xf2d0) [0x7fc7f1ceb2d0]
>> >
>> > /usr/local/freeswitch/lib/libfreeswitch.so.1(switch_xml_open_cfg+0x1a)
>> > [0x7fc7f260b0ea]
>> >         [0x40155804]
>> > Debug info from gdb:
>> > =================================================================
>> > Got a SIGSEGV while executing native code. This usually indicates
>> > a fatal error in the mono runtime or one of the native libraries
>> > used by your application.
>> > =================================================================
>> >
>> > FreeSWITCH-users mailing list
>> > FreeSWITCH-users at lists.freeswitch.org
>> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> > 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
>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
>> IRC: irc.freenode.net #freeswitch
>>
>> FreeSWITCH Developer Conference
>> sip:888 at conference.freeswitch.org
>> googletalk:conf+888 at conference.freeswitch.org
>> pstn:+19193869900
>>
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>
>
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> 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
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org
googletalk:conf+888 at conference.freeswitch.org
pstn:+19193869900



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list