[Freeswitch-dev] FreeSwitch / sipXconfig integration
Paweł Pierścionek
pawel at voiceworks.pl
Thu Jan 18 17:46:27 EST 2007
Hi,
I am integrating FS with sipX - for conferencing as the first step :)
sipXconfig already has a conferencing WEB UI so I am just reusing
it to dynamically create freeswitch.xml for FS running on the same
machine as sipXconfig.
Later on I will do it the proper way via xml/rpc so that
sipXconfig can manage distributed FS conferencing setup.
Right now I need a small patch to be accepted :) so that I can
integrate sipX process management (watchdog) with FreeSwitch.
What I need is basically a "no console, no fork" mode. :D :D
--- freeswitch_snapshot/src/switch.c 2006-12-23 23:45:33.000000000 +0100
+++ fs_urtho/src/switch.c 2007-01-18 23:04:13.000000000 +0100
@@ -194,7 +194,8 @@
{
char pid_path[256] = ""; // full path to the pid file
const char *err = NULL; // error value for return from freeswitch
initialization
- int bg = 0; // TRUE if we are running in background mode
+ int nf = 0; // TRUE if we are running in nofork mode
+ int nc = 0; // TRUE if we are running in noconsole mode
int vg = 0; // TRUE if we are running in vg mode
FILE *f; // file handle to the pid file
pid_t pid = 0; //
@@ -264,7 +265,11 @@
}
if (argv[x] && !strcmp(argv[x], "-nc")) {
- bg++;
+ nc++;
+ }
+
+ if (argv[x] && !strcmp(argv[x], "-nf")) {
+ nf++;
}
if (argv[x] && !strcmp(argv[x], "-vg")) {
@@ -276,7 +281,7 @@
return freeswitch_kill_background();
}
- if (bg) {
+ if (nc) {
signal(SIGHUP, handle_SIGHUP);
signal(SIGTERM, handle_SIGHUP);
@@ -284,14 +289,14 @@
#ifdef WIN32
FreeConsole();
#else
- if ((pid = fork())) {
+ if (!nf && (pid = fork())) {
fprintf(stderr, "%d Backgrounding.\n", (int)pid);
exit(0);
}
#endif
}
- if (switch_core_init_and_modload(bg ? lfile : NULL, &err) !=
SWITCH_STATUS_SUCCESS) {
+ if (switch_core_init_and_modload(nc ? lfile : NULL, &err) !=
SWITCH_STATUS_SUCCESS) {
fprintf(stderr, "Cannot Initilize [%s]\n", err);
return 255;
}
@@ -305,7 +310,7 @@
fprintf(f, "%d", pid = getpid());
fclose(f);
- switch_core_runtime_loop(bg);
+ switch_core_runtime_loop(nc);
return switch_core_destroy(vg);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: switch.c.diff
Type: application/octet-stream
Size: 1600 bytes
Desc: not available
Url : http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20070118/d1bb4d55/attachment.obj
More information about the Freeswitch-dev
mailing list