2007-05-22 22:07:05 +00:00
|
|
|
#include "openzap.h"
|
2008-08-29 15:58:59 +00:00
|
|
|
#include <signal.h>
|
|
|
|
|
2007-05-22 22:07:05 +00:00
|
|
|
|
|
|
|
static ZIO_SIGNAL_CB_FUNCTION(on_signal)
|
|
|
|
{
|
|
|
|
return ZAP_FAIL;
|
|
|
|
}
|
|
|
|
|
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[])
|
|
|
|
{
|
|
|
|
zap_span_t *span;
|
2008-08-29 15:58:59 +00:00
|
|
|
|
2007-05-22 22:07:05 +00:00
|
|
|
zap_global_set_default_logger(ZAP_LOG_LEVEL_DEBUG);
|
|
|
|
|
2007-06-23 18:51:10 +00:00
|
|
|
if (argc < 2) {
|
|
|
|
printf("umm no\n");
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
2007-05-22 22:07:05 +00:00
|
|
|
if (zap_global_init() != ZAP_SUCCESS) {
|
|
|
|
fprintf(stderr, "Error loading OpenZAP\n");
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("OpenZAP loaded\n");
|
|
|
|
|
2007-06-23 18:51:10 +00:00
|
|
|
if (zap_span_find(atoi(argv[1]), &span) != ZAP_SUCCESS) {
|
2007-05-22 22:07:05 +00:00
|
|
|
fprintf(stderr, "Error finding OpenZAP span\n");
|
2007-05-24 13:46:54 +00:00
|
|
|
goto done;
|
2007-05-22 22:07:05 +00:00
|
|
|
}
|
|
|
|
|
2008-08-29 15:58:59 +00:00
|
|
|
if (zap_configure_span("isdn", span, on_signal,
|
|
|
|
"mode", "te",
|
2008-08-29 20:41:17 +00:00
|
|
|
"dialect", "national",
|
|
|
|
TAG_END) == ZAP_SUCCESS) {
|
2008-08-29 15:58:59 +00:00
|
|
|
zap_span_start(span);
|
|
|
|
} else {
|
|
|
|
fprintf(stderr, "Error starting ISDN D-Channel\n");
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
signal(SIGINT, handle_SIGINT);
|
|
|
|
R = 1;
|
|
|
|
while(R) {
|
2007-05-27 04:42:10 +00:00
|
|
|
zap_sleep(1 * 1000);
|
2007-05-22 22:07:05 +00:00
|
|
|
}
|
|
|
|
|
2007-05-24 13:46:54 +00:00
|
|
|
done:
|
|
|
|
|
2007-05-22 22:07:05 +00:00
|
|
|
zap_global_destroy();
|
|
|
|
|
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
|
|
|
*/
|