亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? gc_basic_call_model.c

?? dialogic 板卡globalcall 測(cè)試代碼
?? C
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):
/***************************************************************************
 *			NAME: void set_calling_num(struct channel *pline, char *phone_num)
 *DESCRIPTION: Sets the calling number for the outbound direction
 *		  INPUT: pline - pointer to entry in port table
 *					phone_num - pointer to the phone number
 *		RETURNS: None.
  ***************************************************************************/
static void set_calling_num(struct channel *pline, char *phone_num)
{
	char		str[MAX_STRING_SIZE];

	if (pline->direction == DIR_OUT) {
		if (gc_SetCallingNum(pline->ldev, phone_num) < 0) {
			sprintf(str, "gc_SetCallingNum(linedev=%ld, phone_num = %s) Failed", pline->ldev, phone_num);
			printandlog(pline->index, GC_APIERR, NULL, str);
			exitdemo(1);
		}
		sprintf(str, "gc_SetCallingNum(linedev=%ld, phone_num = %s) Success\n", pline->ldev, phone_num);
		printandlog(pline->index, MISC, NULL, str);
	}
}


/***************************************************************************
 *			NAME: void intr_hdlr()
 *DESCRIPTION: Handler called when one of the following signals is
 *					received: SIGHUP, SIGINT, SIGQUIT, SIGTERM.
 *					This function stops I/O activity on all channels and
 *					closes all the channels.
 *		  INPUT: None
 *		RETURNS: None.
  ***************************************************************************/
static void intr_hdlr(void)
{
	printf("*******Received User Interrupted Signal*******\n");
	interrupted = YES;
	/* will handle graceful shutdown outside this handler in main's forever loop */
}

/********************************************************************************
 *			NAME: load_config_file()
 *DESCRIPTION: This function reads the configuration file line
 *					by line. Ignores commented lines. For valid lines, 
 *					it fills the devname field of corresponding element 
 *					of port (global array of struct channel) as it is
 *					to be passed as an argument to gc_OpenEx(). It also
 *					fills the direction field in port[index]. 
 * 
 *		  INPUT: None
 *		RETURNS: None - exits if error
 *	  CAUTIONS: Assumes config file is in a "reasonable" format
 *					Not all fields are case insensitive
 *					The parsing in this procedure is simplified for demo purposes,
 *					i.e. error handling is weak to non-existent.
 *					Your application will need to implement parsing that is appropriate 
 *					for your application
 ********************************************************************************/
void load_config_file(void)
{
	char		line[MAX_STRING_SIZE], direction[MAX_STRING_SIZE];
	int		index;
	char		netdevice[MAX_DEVNAME], protname[MAX_DEVNAME], voicedevice[MAX_DEVNAME];
	char		devname[MAX_DEVNAME], destination_num[MAXPHONENUM];
	FILE		*cfg_fp;
	
	/* Open Configuration file in Read mode */
	cfg_fp = fopen(cfgfile, "r");
	
	if (cfg_fp == NULL) {
		printf("Unable to open %s for read\n", cfgfile);
		perror("Reason is: ");
		exit(1);
	}
	
	while (fgets(line, MAX_STRING_SIZE, cfg_fp)) {
		/* strip trailing white space */
		index = strlen(line) - 1;
		while (index && (line[index] <= ' ')) {
			line[index] = '\0';
			index--;
		}

		/* ignore blank lines */
		if (index == 0) {
			continue;
		}
			
		/* if 1st character is not alpha numeric, then treat the line as a comment & ignore it */
		if ((line[0] < 'A') || (line[0] > 'z')) {	/* simplifed non-alpha check */
			continue; /* Ignore the line and read next */

		}
		
		num_devices++; /* Increment Global Variable */

		/* Parse DTI Device, Protocol Name, Direction and Voice Device Name */ 
		sscanf(line, "%s%s%s%s%s", netdevice, protname, direction, voicedevice, destination_num);
		
		if ((netdevice[0] == '\0') || (protname[0] == '\0') || (direction == '\0')) {
			/* Invalid entry in the configuration file */
			fclose (cfg_fp);
			printf("Invalid entry in %s\n", cfgfile);
			printf("Line is: %s\n", line);
			exitdemo(1);
		}
		
		/* Fill devname to be passed as arg in gc_OpenEx() 
		in port array (global) of struct channel */
		
		if (strcmp(netdevice, "NONE") != 0) {
			sprintf(devname, ":L_SS7:N_%s:P_%s", netdevice, protname);
		} else {
			sprintf(devname, ":P_%s", protname);
		}
		/*Fill :V_ only if voice device name is not specified as NONE in cfg file */
		if (tolower(voicedevice[0]) != 'n') {
			strcat(devname, ":V_");
			strcat(devname, voicedevice);
		}
		
		/* Fill Direction in port array (global) of struct channel */
		if (tolower(direction[0]) == 'i') {
			port[num_devices - 1].direction = DIR_IN;
		} else {
			port[num_devices - 1].direction = DIR_OUT;
		}

		/* Fill device index in port array (global) of struct channel */
		port[num_devices - 1].index = num_devices - 1;

		/* Copying all the local variable values to Global Variables */
		strcpy(port[num_devices - 1].devname, devname);
		strcpy(port[num_devices - 1].netdevice, netdevice);
		strcpy(port[num_devices - 1].voicedevice, voicedevice);
		strcpy(port[num_devices - 1].protname, protname);
		strcpy(port[num_devices - 1].destination_num, destination_num);
	} /* End of read all lines loop */
	
	fclose (cfg_fp);
} /* End of Function load_config_file() */

/********************************************************************************
 *		 NAME: printandlog ()
 * DESCRIPTION: prints on the screen and to the log file. 
 *				 Put time stamp to the log file. If the
 *				 message to be logged is specific to a device,
 *				 it is logged to the device specific log file.
 * 
 *		INPUT: index is the device index
 *				 log_type valid values are ERR, MISC, EVENT, GC_APICALL, GC_APIERR and GC_RESULT_INFO
 *				 metaeventp = pointer to metaevent data structure - only used for GC_RESULT_INFO
 *				 msg_str message string to be printed
 *	 RETURNS: NA
 ********************************************************************************/
void printandlog(int index, int log_type, METAEVENT *metaeventp, char *msg_str)
{	
	struct tm			*Time;
	time_t				Timet;
	int					i;

#ifdef _WIN32	/* Defined in Windows */  
	struct _timeb	  Timeb;										/* used to get milliseconds */
#else			/* Defined in Unix	*/
	struct timeb		Timeb;	  
#endif
	 
	char					TimeStr[MAX_STRING_SIZE];			/* will hold the time string when built */
	char					buffer[MAX_STRING_SIZE];			/* will have everything but the time */
	char					timestamp[MAX_STRING_SIZE];		/* holds the formatted time */
	char					str[MAX_STRING_SIZE];
	char					gc_apierr[MAX_STRING_SIZE];		/* iff have GC API error - most of time will be NULL */
	char					gc_result_info[MAX_STRING_SIZE]; /* iff have GC result info request - most of time will be null */
		 
	/* initialize temporary buffers */
	buffer[0] = '\0';
	gc_apierr[0] = gc_result_info[0] = timestamp[0] = '\0';
	 
	/* Put time stamp	 - everything but the milliseconds */
	TimeStr[0] = '\0';
	time(&Timet);
	Time = localtime(&Timet);

#ifdef _WIN32	/* Defined in Windows */  
	_ftime(&Timeb);												/* needed to get the milliseconds */
#else			/* Defined in Unix	 */  
	ftime(&Timeb); 
#endif

	if (log_type == MISC_WITH_NL) {
		strcpy(timestamp, "\n");
	} 

	sprintf(TimeStr, "%02d/%02d %02d:%02d:%02d.%03d ", Time->tm_mon+1, Time->tm_mday, Time->tm_hour, Time->tm_min, Time->tm_sec, Timeb.millitm);
	strcat(timestamp, TimeStr);

	switch(log_type)
	{
		case GC_APICALL:
				strcat(buffer, " [GC_APICALL]: ");
				break;

		case GC_APIERR:
				strcat(buffer, " [GC_APIERR]:	 ");
				format_error_info(gc_apierr);
				break;

		case GC_RESULT_INFO:
				strcat(buffer, " [GC_RESULT_INFO]: ");
				format_result_info(index, metaeventp, gc_result_info);
				break;

		case NON_GC_APIERR:
				strcat(buffer, " [NON_GC_APIERR]: ");
				break;

		case EVENT:
				strcat(buffer, " [EVENT]:		 ");
				break;

		case MISC:
				strcat(buffer, " [MISC]:		 ");
				break;

		case MISC_WITH_NL:
				strcat(buffer, " [MISC]:		 ");
				break;

		case STATE:
				strcat(buffer, " [STATE]:		 ");
				append_call_state_name(buffer, index);
				break;

		default:
			sprintf(str, " [UNEXPECTED LOG TYPE %d]:	", log_type);
			strcat(buffer, str);
			break;
	} /* End of Switch */
	 
	strcat(buffer, msg_str);
	 

	/* now do the actual logging */
	/* 1st to screen */
	printf("%s\n", buffer);

	/* print GC error or GC result information if required */
	if (gc_apierr[0]) {
		printf("%s\n", gc_apierr);
	}
	if (gc_result_info[0]) {
		printf("%s\n", gc_result_info);
	}

	/* then to log file(s) */
	if (index == ALL_DEVICES) {
		for (i = 0; i < num_devices; i++) {
			if (port[i].log_fp) {
				fprintf(port[i].log_fp, "%s ", timestamp);
				fprintf(port[i].log_fp, "%s\n", buffer);
			}
		}
	} else if (port[index].log_fp) {
		fprintf(port[index].log_fp, "%s", timestamp);
		fprintf(port[index].log_fp, "%s\n", buffer);

		/* print GC error or GC result information if required */
		if (gc_apierr[0]) {
			fprintf(port[index].log_fp, "%s\n", gc_apierr);
		}
		if (gc_result_info[0]) {
			fprintf(port[index].log_fp, "%s\n", gc_result_info);
		}
	}
}

/********************************************************************************
 *			NAME: format_error_info()
 *DESCRIPTION: formats error information using gc_ErrorInfo()
 *		  INPUT: buffer - buffer to format into
 *		RETURNS: None
 *	  CAUTIONS: No integrity checking done on dest_buffer overflow
 ********************************************************************************/
static void format_error_info(char *dest_buffer)
{
	GC_INFO			  t_info;	  /* Structure which stores information about GC related errors */ 

	gc_ErrorInfo(&t_info);
			 
	strcpy(dest_buffer, "					 GC ERROR: ");
	strcat(dest_buffer, t_info.gcMsg);
	strcat(dest_buffer, "\n");


	strcat(dest_buffer, "					 CC Name: ");
	strcat(dest_buffer, t_info.ccLibName);
	strcat(dest_buffer, "\n");


	strcat(dest_buffer, "					 CC ERROR: ");
	strcat(dest_buffer, t_info.ccMsg);
	strcat(dest_buffer, "\n");

}

/********************************************************************************
 *			NAME: format_result_info()
 *DESCRIPTION: formats result information using gc_ResultInfo()
 *		  INPUT: index - index into port data structure
 *             metaeventp - pointer to metaevent structure
 *					buffer - buffer to format into
 *		RETURNS: None
 *	  CAUTIONS: No integrity checking done on dest_buffer overflow
 ********************************************************************************/
static void format_result_info(int index, METAEVENT *metaeventp, char *dest_buffer)
{
	char					str[MAX_STRING_SIZE];
	int					rc;
	GC_INFO				t_info;	  /* Structure which stores information about GC related errors */ 

	rc = gc_ResultInfo(metaeventp, &t_info);
	if (rc < 0) {
		sprintf(str, "gc_ResultInfo() call failed");
		printandlog(index, GC_APIERR, NULL, str);
		exitdemo(1);
	}
			 
	strcpy(dest_buffer, "					 GC Result: ");
	strcat(dest_buffer, t_info.gcMsg);
	strcat(dest_buffer, "\n");


	strcat(dest_buffer, "					 CC Name: ");
	strcat(dest_buffer, t_info.ccLibName);
	strcat(dest_buffer, "\n");


	strcat(dest_buffer, "					 CC Result: ");
	strcat(dest_buffer, t_info.ccMsg);
	strcat(dest_buffer, "\n");
}

/********************************************************************************
 *			NAME: append_call_state_name ()
 *DESCRIPTION: Appends the call state to a given buffer for a specified channel index
 *		  INPUT: buffer - buffer to append to
 *					index - index into port st

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产米奇在线777精品观看| 精品国精品自拍自在线| av资源网一区| 成人高清免费在线播放| 国产成人99久久亚洲综合精品| 国产一区二区调教| 国产在线看一区| 狠狠色综合日日| 国产一区二区三区国产| 国产一区二区三区最好精华液| 国产一区二区三区观看| 国产成人免费视频一区| 国产99久久久久| 成人免费视频一区| av一区二区不卡| 一本大道综合伊人精品热热| 在线亚洲人成电影网站色www| 色婷婷激情综合| 在线观看日韩一区| 91麻豆精品国产91久久久使用方法 | 91精品国产aⅴ一区二区| 欧美日韩另类一区| 欧美一区二区三区思思人| 精品日韩一区二区三区 | 亚洲18影院在线观看| 日韩高清一区在线| 国内精品在线播放| voyeur盗摄精品| 欧美日韩中字一区| 精品国产电影一区二区| 国产精品成人一区二区艾草| 亚洲综合色成人| 精品在线观看视频| 成人免费看黄yyy456| 精品视频一区二区不卡| 欧美成人精品3d动漫h| 国产欧美视频在线观看| 亚洲麻豆国产自偷在线| 免费高清在线一区| av高清不卡在线| 91精品婷婷国产综合久久| 国产视频在线观看一区二区三区| 亚洲免费av高清| 久久精品国产99| 成人激情校园春色| 欧美精品国产精品| 国产午夜精品一区二区三区视频| 亚洲美女在线一区| 韩国欧美国产一区| 在线国产电影不卡| 欧美精品一区男女天堂| 亚洲精品菠萝久久久久久久| 免费日韩伦理电影| 99精品视频一区二区| 日韩小视频在线观看专区| 国产精品福利影院| 蜜乳av一区二区三区| 99久久精品免费观看| 欧美一级片在线看| 亚洲精品美腿丝袜| 国产尤物一区二区| 在线不卡一区二区| 亚洲欧洲日韩一区二区三区| 久久精品理论片| 欧美系列日韩一区| 国产精品素人一区二区| 奇米888四色在线精品| 91精品1区2区| 日本一区二区在线不卡| 另类小说综合欧美亚洲| 欧美日韩免费观看一区二区三区| 久久青草国产手机看片福利盒子 | 日韩成人午夜精品| 91黄色免费看| 中文字幕欧美激情| 黄色精品一二区| 欧美一区二区三区的| 日韩毛片一二三区| 国产精品一区二区三区网站| 欧美一级专区免费大片| 亚洲国产美女搞黄色| aaa亚洲精品| 国产女人水真多18毛片18精品视频 | 91麻豆精品国产91久久久资源速度| 亚洲视频 欧洲视频| 风间由美性色一区二区三区| 欧美成人video| 全国精品久久少妇| 欧美精品日韩综合在线| 亚洲一区二区三区四区中文字幕 | 欧美国产禁国产网站cc| 国产一区二区三区不卡在线观看| 日韩免费高清av| 日韩高清在线不卡| 91精品国产欧美一区二区成人| 伊人性伊人情综合网| 91麻豆精品一区二区三区| 国产精品久久久久久久久免费相片| 国模娜娜一区二区三区| 精品国产污网站| 狠狠色狠狠色合久久伊人| 精品久久人人做人人爱| 九九国产精品视频| 精品少妇一区二区三区视频免付费 | 色视频一区二区| 亚洲欧美综合另类在线卡通| 国产**成人网毛片九色| 国产欧美精品一区| 成人免费视频播放| 亚洲日穴在线视频| 欧美性一区二区| 亚洲午夜精品在线| 欧美精品黑人性xxxx| 日本亚洲欧美天堂免费| 日韩欧美国产一区二区三区| 久久成人18免费观看| 2021久久国产精品不只是精品| 国产综合色在线| 中文字幕精品—区二区四季| av成人老司机| 亚洲综合偷拍欧美一区色| 欧美狂野另类xxxxoooo| 免费精品视频在线| 国产亚洲综合性久久久影院| 成人av在线播放网址| 亚洲欧美日本韩国| 欧美另类高清zo欧美| 精品一区二区三区久久久| 国产日本欧美一区二区| 色综合天天综合| 成人av资源在线| 亚洲九九爱视频| 91精品国产全国免费观看| 国产专区综合网| 亚洲欧美日韩在线不卡| 欧美美女一区二区| 国产麻豆视频精品| 中文字幕一区二区不卡| 欧美日韩在线播放一区| 久久精品国产亚洲高清剧情介绍| 国产精品视频第一区| 欧美在线免费播放| 久久99精品国产麻豆不卡| 国产精品另类一区| 欧美女孩性生活视频| 国产美女精品人人做人人爽| 成人欧美一区二区三区白人 | 精品久久久久99| 91丨九色porny丨蝌蚪| 五月激情综合网| 久久精品一区二区三区四区| 91久久精品一区二区| 久久疯狂做爰流白浆xx| 亚洲日韩欧美一区二区在线| 制服丝袜国产精品| 白白色 亚洲乱淫| 日韩精品一区第一页| 久久婷婷久久一区二区三区| 色狠狠av一区二区三区| 国产自产高清不卡| 亚洲va在线va天堂| 国产精品每日更新在线播放网址| 欧美精品免费视频| 波多野结衣在线一区| 麻豆精品视频在线观看免费| 自拍偷在线精品自拍偷无码专区 | 国产精品高潮呻吟| 欧美成人综合网站| 欧美伊人久久久久久久久影院 | 91丨porny丨中文| 国产久卡久卡久卡久卡视频精品| 亚洲一区二区视频在线观看| 中文子幕无线码一区tr| 日韩三级在线观看| 欧美色涩在线第一页| 99国产精品国产精品久久| 极品美女销魂一区二区三区| 亚洲成a人片综合在线| 一区免费观看视频| 国产欧美日本一区视频| 日韩欧美国产1| 欧美日韩午夜精品| 一本色道综合亚洲| 成人黄色av网站在线| 经典三级视频一区| 热久久国产精品| 偷窥少妇高潮呻吟av久久免费| 自拍偷拍亚洲综合| 国产精品久久久久久久久久久免费看 | 欧美一级搡bbbb搡bbbb| 欧美无砖专区一中文字| av在线综合网| 国产成人免费高清| 极品瑜伽女神91| 久久激情综合网| 麻豆国产欧美日韩综合精品二区| 亚洲午夜久久久久久久久电影院 | 国产精品毛片大码女人| 久久欧美一区二区| 久久综合久久综合久久|