mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 17:38:59 +00:00
Linux renaming from openzap to freetdm
git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@967 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
@@ -1,74 +1,74 @@
|
||||
#include "openzap.h"
|
||||
#include "freetdm.h"
|
||||
#include <signal.h>
|
||||
|
||||
static int R = 0;
|
||||
static zap_mutex_t *mutex = NULL;
|
||||
static ftdm_mutex_t *mutex = NULL;
|
||||
|
||||
static ZIO_SIGNAL_CB_FUNCTION(on_r2_signal)
|
||||
{
|
||||
zap_log(ZAP_LOG_DEBUG, "Got R2 channel sig [%s] in channel\n", zap_signal_event2str(sigmsg->event_id), sigmsg->channel->physical_chan_id);
|
||||
return ZAP_SUCCESS;
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Got R2 channel sig [%s] in channel\n", ftdm_signal_event2str(sigmsg->event_id), sigmsg->channel->physical_chan_id);
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
static void handle_SIGINT(int sig)
|
||||
{
|
||||
zap_mutex_lock(mutex);
|
||||
ftdm_mutex_lock(mutex);
|
||||
R = 0;
|
||||
zap_mutex_unlock(mutex);
|
||||
ftdm_mutex_unlock(mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
zap_span_t *span;
|
||||
zap_mutex_create(&mutex);
|
||||
ftdm_span_t *span;
|
||||
ftdm_mutex_create(&mutex);
|
||||
|
||||
zap_global_set_default_logger(ZAP_LOG_LEVEL_DEBUG);
|
||||
ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG);
|
||||
|
||||
if (argc < 2) {
|
||||
printf("umm no\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (zap_global_init() != ZAP_SUCCESS) {
|
||||
fprintf(stderr, "Error loading OpenZAP\n");
|
||||
if (ftdm_global_init() != FTDM_SUCCESS) {
|
||||
fprintf(stderr, "Error loading OpenFTDM\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
printf("OpenZAP loaded\n");
|
||||
printf("OpenFTDM loaded\n");
|
||||
|
||||
if (zap_span_find(atoi(argv[1]), &span) != ZAP_SUCCESS) {
|
||||
fprintf(stderr, "Error finding OpenZAP span\n");
|
||||
if (ftdm_span_find(atoi(argv[1]), &span) != FTDM_SUCCESS) {
|
||||
fprintf(stderr, "Error finding OpenFTDM span\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (zap_configure_span("r2", span, on_r2_signal,
|
||||
if (ftdm_configure_span("r2", span, on_r2_signal,
|
||||
"variant", "mx",
|
||||
"max_ani", 10,
|
||||
"max_dnis", 4,
|
||||
"logging", "all",
|
||||
TAG_END) == ZAP_SUCCESS) {
|
||||
TAG_END) == FTDM_SUCCESS) {
|
||||
|
||||
|
||||
zap_span_start(span);
|
||||
ftdm_span_start(span);
|
||||
} else {
|
||||
fprintf(stderr, "Error starting R2 span\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
signal(SIGINT, handle_SIGINT);
|
||||
zap_mutex_lock(mutex);
|
||||
ftdm_mutex_lock(mutex);
|
||||
R = 1;
|
||||
zap_mutex_unlock(mutex);
|
||||
ftdm_mutex_unlock(mutex);
|
||||
while(R) {
|
||||
zap_sleep(1 * 1000);
|
||||
ftdm_sleep(1 * 1000);
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
zap_global_destroy();
|
||||
ftdm_global_destroy();
|
||||
|
||||
return 1;
|
||||
|
||||
|
Reference in New Issue
Block a user