2010-01-15 19:22:49 +00:00
|
|
|
#include "freetdm.h"
|
2008-08-29 15:58:59 +00:00
|
|
|
#include <signal.h>
|
|
|
|
|
2007-05-22 22:07:05 +00:00
|
|
|
|
2010-01-15 20:35:11 +00:00
|
|
|
static FIO_SIGNAL_CB_FUNCTION(on_signal)
|
2007-05-22 22:07:05 +00:00
|
|
|
{
|
2010-01-15 19:22:49 +00:00
|
|
|
return FTDM_FAIL;
|
2007-05-22 22:07:05 +00:00
|
|
|
}
|
|
|
|
|
2008-08-29 15:58:59 +00:00
|
|
|
static int R = 0;
|
|
|
|
static void handle_SIGINT(int sig)
|
|
|
|
{
|
|
|
|
if (sig);
|
|
|
|
R = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-05-22 22:07:05 +00:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2010-01-15 19:22:49 +00:00
|
|
|
ftdm_span_t *span;
|
2008-08-29 15:58:59 +00:00
|
|
|
|
2010-01-15 19:22:49 +00:00
|
|
|
ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG);
|
2007-05-22 22:07:05 +00:00
|
|
|
|
2007-06-23 18:51:10 +00:00
|
|
|
if (argc < 2) {
|
|
|
|
printf("umm no\n");
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
2010-01-15 19:22:49 +00:00
|
|
|
if (ftdm_global_init() != FTDM_SUCCESS) {
|
2010-01-15 19:56:54 +00:00
|
|
|
fprintf(stderr, "Error loading FreeTDM\n");
|
2007-05-22 22:07:05 +00:00
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
2010-01-15 19:56:54 +00:00
|
|
|
printf("FreeTDM loaded\n");
|
2007-05-22 22:07:05 +00:00
|
|
|
|
2010-01-15 19:22:49 +00:00
|
|
|
if (ftdm_span_find(atoi(argv[1]), &span) != FTDM_SUCCESS) {
|
2010-01-15 19:56:54 +00:00
|
|
|
fprintf(stderr, "Error finding FreeTDM span\n");
|
2007-05-24 13:46:54 +00:00
|
|
|
goto done;
|
2007-05-22 22:07:05 +00:00
|
|
|
}
|
|
|
|
|
2010-01-15 19:22:49 +00:00
|
|
|
if (ftdm_configure_span("isdn", span, on_signal,
|
2008-08-29 15:58:59 +00:00
|
|
|
"mode", "te",
|
2008-08-29 20:41:17 +00:00
|
|
|
"dialect", "national",
|
2010-01-15 19:22:49 +00:00
|
|
|
TAG_END) == FTDM_SUCCESS) {
|
|
|
|
ftdm_span_start(span);
|
2008-08-29 15:58:59 +00:00
|
|
|
} else {
|
|
|
|
fprintf(stderr, "Error starting ISDN D-Channel\n");
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
signal(SIGINT, handle_SIGINT);
|
|
|
|
R = 1;
|
|
|
|
while(R) {
|
2010-01-15 19:22:49 +00:00
|
|
|
ftdm_sleep(1 * 1000);
|
2007-05-22 22:07:05 +00:00
|
|
|
}
|
|
|
|
|
2007-05-24 13:46:54 +00:00
|
|
|
done:
|
|
|
|
|
2010-01-15 19:22:49 +00:00
|
|
|
ftdm_global_destroy();
|
2007-05-22 22:07:05 +00:00
|
|
|
|
2008-09-06 05:46:14 +00:00
|
|
|
return 1;
|
|
|
|
|
2007-05-22 22:07:05 +00:00
|
|
|
}
|
2007-06-04 14:53:12 +00:00
|
|
|
|
|
|
|
/* For Emacs:
|
|
|
|
* Local Variables:
|
|
|
|
* mode:c
|
|
|
|
* indent-tabs-mode:t
|
|
|
|
* tab-width:4
|
|
|
|
* c-basic-offset:4
|
|
|
|
* End:
|
|
|
|
* For VIM:
|
2009-09-14 22:06:20 +00:00
|
|
|
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
|
2007-06-04 14:53:12 +00:00
|
|
|
*/
|