Embedding FreeSWITCH
From FreeSWITCH Wiki
Just as FreeSWITCH™ can run embedded languages you can also embed FreeSWITCH™ into other programs in a variety of languages. FreeSWITCH™ is designed in a way to be extended from both sides of the equation, not only does it support modules but it also supports being embedded itself. Some examples of how this is done follow.
Contents |
[edit]
Extensibility
You can control the running process any way you want, which includes call data, or any other functionality within the application. You could, for example, write code to control a call path, and embed FreeSWITCH™ into that application.
[edit]
Language Examples
[edit]
C
#include <switch.h>
int main(int argc, char **argv)
{
switch_core_flag_t flags = SCF_USE_SQL;
int nc=0; /* this is for 'no console' mode, FALSE console is there, TRUE it isnt */
const char *err = NULL; /* error value for return from freeswitch initialization */
#define LOGFILE "freeswitch.log"
static char *lfile = LOGFILE; /* if NULL no logfile is generated */
switch_core_init_and_modload(lfile,flags,err);
switch_core_runtime_loop(nc);
switch_core_destroy();
return (0); /* per C89 spec */
}
compile and link against libfreeswitch.
[edit]
PHP
<?php
include("freeswitch.php");
fs_core_set_globals();
fs_core_init("");
fs_loadable_module_init();
fs_console_loop();
fs_core_destroy();
?>
[edit]
PERL
Similar method to PHP - need example
