Пример #1
0
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;
}
Пример #2
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;
}