[Freeswitch-users] Embedding FreeSWITCH

Paul Mateer Paul.Mateer at outlook.com
Thu Jun 1 12:20:34 UTC 2017


Guys, I'm looking to embed FreeSWITCH into a piece of Windows software which is extendable through the use of add-ins (written in C#).

When installed the software has an add-ins folder containing subfolders for each add-in to be loaded.


By default FreeSWITCH would expect the base directory to be that of the executable, but in this case I want it to be down in the add-ins subfolder since it makes more sense to have it with the add-in rather than the application. I figured that this could be solved easily enough by adding the following line of code before the call to switch_core_init():

freeswitch.switch_core_init((uint)flags, switch_bool_t.SWITCH_FALSE, out err);

However doing this seems to cause a problem when trying to load certain modules (in particular mod_sofia.dll). This seems to be because the new base directory that I have specified is not included in the alternate search path (set using SetDefaultDllDirectories and AddDllDirectory) so when a call is made to switch_dso_open to load the module it doesn't search that directory for modules such as pthread.dll. Now I could call AddDllDirectory as part of my freeSWITCH initialization code and then call RemoveDllDirectory when shutting down, but I was wondering if there was a possible justification for this being done in the CSharp_switch_directories_base_dir_set method of freeswitch_wrap.cxx?


Interestingly there is also a bug in the switch_dso_open method as the second call to LoadLibraryEx doesn't capture the return value in the lib variable, so even if the second call to LoadLibraryEx succeeds switch_dso_open will return NULL.



Paul

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20170601/4088f303/attachment.html>


More information about the FreeSWITCH-users mailing list