int main(int argc, char *argv[]) { ftdm_span_t *span; ftdm_mutex_create(&mutex); ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); if (argc < 2) { printf("umm no\n"); exit(-1); } if (ftdm_global_init() != FTDM_SUCCESS) { fprintf(stderr, "Error loading FreeTDM\n"); exit(-1); } printf("FreeTDM loaded\n"); if (ftdm_span_find(atoi(argv[1]), &span) != FTDM_SUCCESS) { fprintf(stderr, "Error finding FreeTDM span\n"); goto done; } if (ftdm_configure_span("r2", span, on_r2_signal, "variant", "mx", "max_ani", 10, "max_dnis", 4, "logging", "all", TAG_END) == FTDM_SUCCESS) { ftdm_span_start(span); } else { fprintf(stderr, "Error starting R2 span\n"); goto done; } signal(SIGINT, handle_SIGINT); ftdm_mutex_lock(mutex); R = 1; ftdm_mutex_unlock(mutex); while(R) { ftdm_sleep(1 * 1000); } done: ftdm_global_destroy(); return 1; }
int main(int argc, char *argv[]) { ftdm_conf_parameter_t parameters[20]; ftdm_span_t *span; int local_port, remote_port; local_port = remote_port = 53000; ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); #if 0 if (argc < 2) { printf("invalid arguments\n"); exit(-1); } #endif if (ftdm_global_init() != FTDM_SUCCESS) { fprintf(stderr, "Error loading FreeTDM\n"); exit(-1); } if (ftdm_global_configuration() != FTDM_SUCCESS) { fprintf(stderr, "Error configuring FreeTDM\n"); exit(-1); } printf("FreeTDM loaded\n"); if (ftdm_span_find_by_name("wp1", &span) != FTDM_SUCCESS) { fprintf(stderr, "Error finding FreeTDM span %s\n", argv[1]); goto done; } parameters[0].var = "sigmod"; parameters[0].val = "sangoma_prid"; parameters[1].var = "switchtype"; parameters[1].val = "euroisdn"; parameters[1].var = "signalling"; parameters[1].val = "pri_cpe"; parameters[2].var = NULL; if (ftdm_configure_span_signaling("sangoma_boost", span, on_signal, parameters) == FTDM_SUCCESS) { ftdm_span_start(span); } else { fprintf(stderr, "Error starting SS7_BOOST\n"); goto done; } while(ftdm_running() && R) { ftdm_sleep(1 * 1000); } done: ftdm_global_destroy(); return 0; }
int main(int argc, char *argv[]) { ftdm_span_t *span; int span_id; int digit_timeout = 2000; int max_dialstr = 11; if (argc < 2) { printf("usage %s <spanno>\n", argv[0]); exit(-1); } span_id = atoi(argv[1]); ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); if (ftdm_global_init() != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "Error loading FreeTDM\n"); exit(-1); } ftdm_log(FTDM_LOG_DEBUG, "FreeTDM loaded\n"); if (ftdm_span_find(span_id, &span) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span\n"); goto done; } if (ftdm_configure_span("analog", span, on_signal, "tonemap", "us", "digit_timeout", &digit_timeout, "max_dialstr", &max_dialstr, TAG_END ) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "Error configuring FreeTDM span\n"); goto done; } ftdm_span_start(span); R = 1; while(ftdm_running() && R) { ftdm_sleep(1 * 1000); } done: ftdm_global_destroy(); return 0; }
int main(int argc, char *argv[]) { ftdm_span_t *span; ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); if (argc < 2) { printf("umm no\n"); exit(-1); } if (ftdm_global_init() != FTDM_SUCCESS) { fprintf(stderr, "Error loading FreeTDM\n"); exit(-1); } printf("FreeTDM loaded\n"); if (ftdm_span_find(atoi(argv[1]), &span) != FTDM_SUCCESS) { fprintf(stderr, "Error finding FreeTDM span\n"); goto done; } if (ftdm_configure_span("isdn", span, on_signal, "mode", "te", "dialect", "national", TAG_END) == FTDM_SUCCESS) { ftdm_span_start(span); } else { fprintf(stderr, "Error starting ISDN D-Channel\n"); goto done; } signal(SIGINT, handle_SIGINT); R = 1; while(R) { ftdm_sleep(1 * 1000); } done: ftdm_global_destroy(); return 1; }
int main(int argc, char *argv[]) { ftdm_status_t status; custom_data_t data; ftdm_sched_t *sched; signal(SIGINT, trap); ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); ftdm_cpu_monitor_disable(); if (ftdm_global_init() != FTDM_SUCCESS) { fprintf(stderr, "Error loading FreeTDM\n"); exit(-1); } status = ftdm_sched_create(&sched, "testsched"); if (status != FTDM_SUCCESS) { fprintf(stderr, "Error creating sched\n"); exit(-1); } data.sched = sched; data.counter = 10; data.beat = 5000; data.callback = handle_heartbeat; status = ftdm_sched_timer(sched, "heartbeat", data.beat, data.callback, &data, &data.heartbeat_timer); if (status != FTDM_SUCCESS) { fprintf(stderr, "Error creating heartbeat timer\n"); exit(-1); } ftdm_sched_free_run(sched); while (running) { ftdm_sleep(10); } ftdm_global_destroy(); printf("Done, press any key to die!\n"); getchar(); return 0; }
/* Our Program */ int main(int argc, char *argv[]) { struct sangoma_pri spri; int debug = 0; if (argv[1]) { debug = atoi(argv[1]); } ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); if (ftdm_global_init() != FTDM_SUCCESS) { fprintf(stderr, "Error loading FreeTDM\n"); exit(-1); } printf("FreeTDM loaded\n"); debug = PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE; printf("WTF %d\n", debug); if (sangoma_init_pri(&spri, 1, // span 24, // dchan SANGOMA_PRI_SWITCH_DMS100, SANGOMA_PRI_CPE, debug) < 0) { return -1; } //spri.pri->debug = (PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_STATE); //pri_set_debug(&spri.pri, (PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_STATE)); SANGOMA_MAP_PRI_EVENT(spri, SANGOMA_PRI_EVENT_ANY, on_anything); SANGOMA_MAP_PRI_EVENT(spri, SANGOMA_PRI_EVENT_RING, on_ring); SANGOMA_MAP_PRI_EVENT(spri, SANGOMA_PRI_EVENT_HANGUP, on_hangup); SANGOMA_MAP_PRI_EVENT(spri, SANGOMA_PRI_EVENT_HANGUP_REQ, on_hangup); SANGOMA_MAP_PRI_EVENT(spri, SANGOMA_PRI_EVENT_INFO_RECEIVED, on_info); SANGOMA_MAP_PRI_EVENT(spri, SANGOMA_PRI_EVENT_RESTART, on_restart); signal(SIGCHLD, chan_ended); sangoma_run_pri(&spri); return 0; }
int main(int argc, char *argv[]) { char cmdline[255]; char name[255]; ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); if (ftdm_global_init() != FTDM_SUCCESS) { fprintf(stderr, "Error loading FreeTDM\n"); exit(-1); } memset(loaded, 0, sizeof(loaded)); printf("CLI> "); while (fgets(cmdline, sizeof(cmdline), stdin)) { if (sscanf(cmdline, "load=%s\n", name) == 1) { load(name); } else if (sscanf(cmdline, "unload=%s\n", name) == 1) { unload(name); } else if (!strncasecmp(cmdline, "exit", sizeof("exit")-1)) { printf("Quitting ...\n"); sleep(1); break; } else { fprintf(stderr, "load=<name> | unload=<name> | exit\n"); } printf("\nCLI> "); } ftdm_global_destroy(); printf("Done, press any key to die!\n"); getchar(); return 0; }
int main(int argc, char *argv[]) { ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); ftdm_channel_t *chan; unsigned ms = 20; ftdm_codec_t codec = FTDM_CODEC_SLIN; unsigned runs = 1; int spanid, chanid; ftdm_unused_arg(argc); ftdm_unused_arg(argv); if (ftdm_global_init() != FTDM_SUCCESS) { fprintf(stderr, "Error loading FreeTDM\n"); exit(-1); } printf("FreeTDM loaded\n"); top: //if (ftdm_channel_open_any("wanpipe", 0, FTDM_TOP_DOWN, &chan) == FTDM_SUCCESS) { if (ftdm_channel_open(1, 1, &chan) == FTDM_SUCCESS) { int x = 0; spanid = ftdm_channel_get_span_id(chan); chanid = ftdm_channel_get_id(chan); printf("opened channel %d:%d\n", spanid, chanid); #if 1 if (ftdm_channel_command(chan, FTDM_COMMAND_SET_INTERVAL, &ms) == FTDM_SUCCESS) { ms = 0; ftdm_channel_command(chan, FTDM_COMMAND_GET_INTERVAL, &ms); printf("interval set to %u\n", ms); } else { printf("set interval failed [%s]\n", ftdm_channel_get_last_error(chan)); } #endif if (ftdm_channel_command(chan, FTDM_COMMAND_SET_CODEC, &codec) == FTDM_SUCCESS) { codec = 1; ftdm_channel_command(chan, FTDM_COMMAND_GET_CODEC, &codec); printf("codec set to %u\n", codec); } else { printf("set codec failed [%s]\n", ftdm_channel_get_last_error(chan)); } for(x = 0; x < 25; x++) { unsigned char buf[2048]; ftdm_size_t len = sizeof(buf); ftdm_wait_flag_t flags = FTDM_READ; if (ftdm_channel_wait(chan, &flags, -1) == FTDM_FAIL) { printf("wait FAIL! %u [%s]\n", (unsigned)len, ftdm_channel_get_last_error(chan)); } if (flags & FTDM_READ) { if (ftdm_channel_read(chan, buf, &len) == FTDM_SUCCESS) { printf("READ: %u\n", (unsigned)len); } else { printf("READ FAIL! %u [%s]\n", (unsigned)len, ftdm_channel_get_last_error(chan)); break; } } else { printf("wait fail [%s]\n", ftdm_channel_get_last_error(chan)); } } ftdm_channel_close(&chan); } else { printf("open fail [%s]\n", ftdm_channel_get_last_error(chan)); } if(--runs) { goto top; } ftdm_global_destroy(); return 0; }
int main(int argc, char *argv[]) { ftdm_span_t *span; ftdm_conf_parameter_t parameters[20]; ftdm_mutex_create(&the_mutex); if (argc < 2) { printf("umm no\n"); exit(1); } ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); if (ftdm_global_init() != FTDM_SUCCESS) { fprintf(stderr, "Error loading FreeTDM\n"); exit(1); } ftdm_global_configuration(); printf("FreeTDM loaded\n"); if (ftdm_span_find_by_name(argv[1], &span) != FTDM_SUCCESS) { fprintf(stderr, "Error finding FreeTDM span %s\n", argv[1]); goto done; } /* testing non-blocking operation */ //ftdm_span_set_blocking_mode(span, FTDM_FALSE); parameters[0].var = "variant"; parameters[0].val = "br"; parameters[1].var = "max_ani"; parameters[1].val = "4"; parameters[2].var = "max_dnis"; parameters[2].val = "4"; parameters[3].var = "logging"; parameters[3].val = "all"; parameters[4].var = NULL; parameters[4].val = NULL; if (ftdm_configure_span_signaling(span, "r2", on_r2_signal, parameters) == FTDM_SUCCESS) { ftdm_span_start(span); } else { fprintf(stderr, "Error starting R2 span\n"); goto done; } running = 1; signal(SIGINT, stop_test); while(running) { ftdm_sleep(20); if (fchan && indication != FTDM_CHANNEL_INDICATE_NONE) { ftdm_channel_t *lchan = NULL; ftdm_channel_indication_t ind = FTDM_CHANNEL_INDICATE_NONE; ftdm_time_t start, stop, diff; ftdm_mutex_lock(the_mutex); ind = indication; indication = FTDM_CHANNEL_INDICATE_NONE; lchan = fchan; ftdm_mutex_unlock(the_mutex); start = ftdm_current_time_in_ms(); ftdm_channel_call_indicate(lchan, ind); stop = ftdm_current_time_in_ms(); diff = stop - start; ftdm_log(FTDM_LOG_DEBUG, "Setting indication %s took %"FTDM_TIME_FMT" ms\n", ftdm_channel_indication2str(ind), diff); } } done: ftdm_global_destroy(); return 0; }