root/src/testisdn.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. FIO_SIGNAL_CB_FUNCTION
  2. handle_SIGINT
  3. main

   1 #include "freetdm.h"
   2 #include <signal.h>
   3 
   4 
   5 static FIO_SIGNAL_CB_FUNCTION(on_signal)
   6 {
   7         return FTDM_FAIL;
   8 }
   9 
  10 static int R = 0;
  11 static void handle_SIGINT(int sig)
  12 {
  13         if (sig);
  14         R = 0;
  15         return;
  16 }
  17 
  18 int main(int argc, char *argv[])
  19 {
  20         ftdm_span_t *span;
  21         
  22         ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG);
  23 
  24         if (argc < 2) {
  25                 printf("umm no\n");
  26                 exit(-1);
  27         }
  28 
  29         if (ftdm_global_init() != FTDM_SUCCESS) {
  30                 fprintf(stderr, "Error loading FreeTDM\n");
  31                 exit(-1);
  32         }
  33 
  34         printf("FreeTDM loaded\n");
  35 
  36         if (ftdm_span_find(atoi(argv[1]), &span) != FTDM_SUCCESS) {
  37                 fprintf(stderr, "Error finding FreeTDM span\n");
  38                 goto done;
  39         }
  40         
  41         if (ftdm_configure_span("isdn", span, on_signal, 
  42                                                    "mode", "te", 
  43                                                    "dialect", "national",
  44                                                    TAG_END) == FTDM_SUCCESS) {
  45                 ftdm_span_start(span);
  46         } else {
  47                 fprintf(stderr, "Error starting ISDN D-Channel\n");
  48                 goto done;
  49         }
  50 
  51         signal(SIGINT, handle_SIGINT);
  52         R = 1;
  53         while(R) {
  54                 ftdm_sleep(1 * 1000);
  55         }
  56 
  57  done:
  58 
  59         ftdm_global_destroy();
  60 
  61         return 1;
  62 
  63 }
  64 
  65 /* For Emacs:
  66  * Local Variables:
  67  * mode:c
  68  * indent-tabs-mode:t
  69  * tab-width:4
  70  * c-basic-offset:4
  71  * End:
  72  * For VIM:
  73  * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  74  */

/* [<][>][^][v][top][bottom][index][help] */