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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? gc_basic_call_model.c

?? dialogic 板卡globalcall 測試代碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
/***************************************************************************
* C Source:	     gc_basic_call_model.c
* Description:   This is a demonstration program for a basic call model which performs,
*					  Basic make call and DropCall from Outbound end.It also shows the case 
*					  of simultaneous disconnect.
*					  which executes the program continuously until it encounters signal ctrl+c.
* General Notes: 1. The tab setting used for this file is 3. 
*					  2. Pagination is done with Courier New, 10 point, 64 lines per page
*					  3. For purposes of the demo, the outbound side waits 
*						  1-2 seconds in the connected state, then calls gc_DropCall()
*
*	%created_by:	parikhn %
*	%date_created: Fri Jun 29 17:32:48 2001 %
*
***************************************************************************/
/**********************************************************************
*	 Copyright (c) 2001 Dialogic Corporation.
*	 All Rights Reserved
*
*	 THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Dialogic Corporation.
*	 The copyright notice above does not evidence any actual or
*	 intended publication of such source code
**********************************************************************/
#ifndef lint
static char *_csrc = "@(#) %filespec: gc_basic_call_model.c-11 %  (%full_filespec: gc_basic_call_model.c-11:csrc:gc#1 %)";
#endif

/* OS Header Files */

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <time.h>
#include <signal.h>
#include <sys/timeb.h>

/* Dialogic Header Files */

#include <gclib.h>
#include <anapi.h>
#include <gcisdn.h>
#include <srllib.h>

/* Macro Definitions */


#define MAXCHAN		60		/* Maximum number of channels that can be opened - 2 E1 spans	*/
#define MAX_DEVNAME	64		/* Maximum length of device name											*/
#define MAX_STRING_SIZE 1000	/* Maximum length of string that to write on log file				*/
									/* Keep large																	*/

/* Logging defines */

#define NON_GC_APIERR	0	/* Had error on non-GC API function										*/
#define EVENT				1	/* An event																		*/
#define GC_APICALL		2	/* GC API funtion call														*/
#define GC_APIERR			3	/* Had error on GC API function											*/
#define STATE				4	/* STATE message																*/
#define GC_RESULT_INFO	5	/* want GC result information												*/
#define MISC				6	/* None of the above															*/
#define MISC_WITH_NL		7	/* None of the above with new line codes								*/

/* Inbound or Outbound Direction of device */

#define DIR_IN				1
#define DIR_OUT			2

/* Miscellaneous declarations */

#define YES					1				/* Value for the user interrupted flag */			
#define NO					0				/* Value for the user interrupted flag */ 
												/* code assumes this value is 0 */
#define ALL_DEVICES		-1				/* This value is used to write the miscellaneous */
												/* statements into all log files */ 

/*
 * Technology Types
 */
#define E1ORT1				1
#define ISDN				2
#define ANALOG				3
#define SS7					4

/* Global variables */

static char		logfile[] = "gc_basic_call_model";		/* log filename without the .log	 */
static char		cfgfile[] = "gc_basic_call_model.cfg"; /* config filename */

static int		num_devices;		/* Number of devices loaded from cfg file */
static int		interrupted = NO; /* Flag for user interrupted signals		 */ 

/* Data structure which stores all information for each line device */

static struct channel {
	LINEDEV				ldev;							/* GlobalCall line device handle							*/
	CRN					crn;							/* GlobalCall call handle									*/
	int					index;						/* Device index as loaded from cfg file				*/
	int					direction;					/* Inbound (WaitCall will be issued) 
																or outbound (MakeCall will be issued)				*/
	int					call_state;					/* state of first layer state machine					*/
	int					blocked;						/* YES or NO													*/
	char					netdevice[MAX_DEVNAME]; /* Network device name										*/
	char					protname[MAX_DEVNAME];	/* Protocol name												*/
	char					voicedevice[MAX_DEVNAME]; /* Voice device name										*/ 
	char					devname[MAX_DEVNAME];	/* Argument to gc_OpenEx() function						*/
	char					destination_num[MAXPHONENUM]; /* Phone													*/
	int					numb_calls;					/* The No of calls on the device							*/
	int					waitcall_active;			/* Flag for waitcall function for issuing only once*/
	int					dropcall_active;			/* Flag for simultaneous disconnect check				*/
	int					makecall_active;
	int					resetlinedev_active;		/* Necessary since must ignore call related GC		*/
															/* events with gc_ResetLineDev() active				*/
	int					resetlinedev_required_after_unblocked; /* for ISDN									*/
													
	int					makecall_timeout;			/* necessary since not all technologies support		*/
															/* async makecall timeout and they might be			*/
															/* different for different technologies				*/
	GC_MAKECALL_BLK	makecallblk;				/* Variable for MAKECALL block							*/
	FILE					*log_fp;						/* logfile Pointer											*/
	int					techtype;					/* technology type: E1ORT1, ISDN, ANALOG,				*/

	/* this variable is in so know when to drop a call */
	time_t				dropcall_time;				/* time to drop the call on the outbound side */
} port[MAXCHAN];

static int		in_calls, out_calls;					/* Counters for Inbound calls and Outbound calls	*/
static int		gc_started = NO;						/* Flag is set if gc_Start() is Success				*/
time_t			start_time;								/* To note down the start time for the test			*/

/* Function prototype(s) */

static void		init_srl_mode(void);							/* inits SRL mode */
static void		load_config_file(void);						/* Loads Configuration File									*/
static void		drop_outbound_calls_if_required(void); /* used by demo to make repeated calls */
static void		printandlog(int index, int log_type,	/* Prints and logs												*/ 
								METAEVENT *metavent, char *msg_str);
static void		gc_demo_makecall(int index);				/* Function for gc_MakeCall()									*/ 
static void		exitdemo(int exitlevel);					/* Exit routine													*/
static void		intr_hdlr(void);								/* For handling user interrupted signals					*/
static void		set_calling_num(struct channel *pline, char *phone_num);
static void		gc_demo_open_isdn_channel(int index);	/* Technology specific initialization for ISDN			*/
static void		gc_demo_open_E1orT1_channel(int index);/* Technology specific initialization for PDK			*/ 
static void		gc_demo_open_ss7_channel(int index);	/* Technology specific initialization for SS7			*/
static void		gc_demo_open_analog_channel(int index);/* Technology specific initialization for ANAPI			*/

static void		open_all_devices(void);						/* Function invokes Technology specific initilization 
																			functions to open all devices								*/
static void		open_device(int index);						/* Function invokes Technology specific initilization 
																			functions to open specific device						*/
static void		inbound_application(struct channel *pline); /* PLACE HOLDER FOR YOUR APPLICATION CODE			*/
static void		outbound_application(struct channel *pline); /* PLACE HOLDER FOR YOUR APPLICATION CODE			*/
static void		process_event(void);							/* Function handles the GlobalCall Events					*/
static void		process_connected_event(struct channel *pline);
static void		process_disconnected_event(struct channel *pline);
static void		process_offered_event(METAEVENT *metaeventp, struct channel *pline);
static void		process_inbound_event(struct channel *pline, METAEVENT *metaeventp); /* Function handles the GlobalCall Events for inbound */
static void		process_outbound_event(struct channel *pline, METAEVENT *metaeventp); /* Function handles the GlobalCall Events for outbound */
static int		open_all_logfiles(void);					/* Function to open the logfiles								*/
static void		append_call_state_name(char *buffer, int index);	/* append call state name to buffer														*/
static void		format_error_info(char *dest_buffer);		/* formats error information									*/
static void		format_result_info(int index, METAEVENT *metaeventp, /* formats event result information									*/
											char *dest_buffer);

/********************************************************************************
 *			NAME: main ()
 *DESCRIPTION: This is the entry point. 
 *					It loads the configuration file.
 *					Take cares the	 Event Handling process.
 *					Starts GC Library.
 *					Opens Configured Devices.
 *					Waits for user interrupted signal (ctrl+c).
 *					Whenever an event is received on any of the opened 
 *					devices, Depending upon the event received the proper 
 *					action will be taken.
 *		  INPUT: None
 *		RETURNS: 0 if success else -1
 ********************************************************************************/
int main(void)
{
	int						i, ret;
	char						str[MAX_STRING_SIZE], str1[MAX_STRING_SIZE];
	GC_CCLIB_STATUSALL	cclib_status_all;

	/* Note down the start time for the test */
	time(&start_time);
	
	/* Give control to Event Handler */ 
#ifdef _WIN32
	signal(SIGINT, (void (__cdecl*)(int)) intr_hdlr);
	signal(SIGTERM, (void (__cdecl*)(int)) intr_hdlr);
#else
	signal(SIGHUP, (void (*)()) intr_hdlr);
	signal(SIGQUIT, (void (*)()) intr_hdlr);
	signal(SIGINT, (void (*)()) intr_hdlr);
	signal(SIGTERM, (void (*)()) intr_hdlr);
#endif

	init_srl_mode();									/* set SRL mode to ASYNC, polled */
	/* Load Configuration file */
	load_config_file();

	/* Function to open all the logfiles */
	open_all_logfiles();
	if (num_devices == 0) {
		printf("No devices enabled - please modify gc_basic_call_model.cfg to enable desired technology\n");
		exitdemo(1);
	}
	printandlog(ALL_DEVICES, MISC, NULL, "********** GC DEMO - BASIC CALL MODEL ***********\n");
	
	/* Start GlobalCall */
	if (gc_Start(NULL) != GC_SUCCESS) { 
		sprintf(str, "gc_Start(startp = NULL) Failed");
		printandlog(ALL_DEVICES, GC_APIERR, NULL, str);
		exitdemo(1);
	}
	/* Set the flag gc_started to YES */
	gc_started = YES;
	sprintf(str, "gc_Start(startp = NULL) Success");
	printandlog(ALL_DEVICES, GC_APICALL, NULL, str);


	/* this code is usefule for installation problem debugging */
	/* you may not wish to use this code in production systems */
	if (gc_CCLibStatusEx("GC_ALL_LIB", &cclib_status_all) != GC_SUCCESS) {
		sprintf(str, "gc_CCLibStatusEx(GC_ALL_LIB, &cclib_status_all) Failed");
		printandlog(ALL_DEVICES, GC_APIERR, NULL, str);
		exitdemo(1);
	}	
	strcpy(str, " Call Control Library Status:\n");
	for (i = 0; i < GC_TOTAL_CCLIBS; i++) {
		switch (cclib_status_all.cclib_state[i].state) {
			case GC_CCLIB_CONFIGURED:
				sprintf(str1, "		  %s - configured\n", cclib_status_all.cclib_state[i].name);
				break;

			case GC_CCLIB_AVAILABLE:
				sprintf(str1, "		  %s - available\n", cclib_status_all.cclib_state[i].name);
				break;

			case GC_CCLIB_FAILED:
				sprintf(str1, "		  %s - is not available for use\n", cclib_status_all.cclib_state[i].name);
				break;

			default:
				sprintf(str1, "		  %s - unknown CCLIB status\n", cclib_status_all.cclib_state[i].name);
				break;


		}
		strcat(str, str1);
	}
	printandlog(ALL_DEVICES, MISC, NULL, str);

	/* open all the GC devices */
	open_all_devices(); 
	
	/* 
	-- Forever loop where the main work is done - wait for an event or user requested exit
	*/
	for (;;) {
		ret = sr_waitevt(500);					/* 1/2 second */
		if (interrupted == YES) {				/* flag set in intr_hdlr() */
			exitdemo(1);
		}
		if (ret != -1) {							/* i.e. not timeout */
			process_event();
		}
		drop_outbound_calls_if_required();	/* an artifact of the demo program */
														/* where the outbound side disconnects 1-2 */
														/* seconds after connected */
	}
	
} /* End of Main */

/****************************************************************
*			NAME: void init_srl_mode(void)
* DESCRIPTION: Inits SR mode
*		RETURNS: None
*	  CAUTIONS: NA
****************************************************************/
static void init_srl_mode(void)
{
/* 
SRL MODEL TYPE - Single Threaded Async, event handler will be called in the Main thread 
*/
#ifdef _WIN32
	int	mode = SR_STASYNC | SR_POLLMODE; 
#else
	int	mode = SR_POLLMODE;
#endif
	

	/* Set SRL mode */
#ifdef _WIN32
	if (sr_setparm(SRL_DEVICE, SR_MODELTYPE, &mode) == -1) {
		printandlog(ALL_DEVICES, NON_GC_APIERR, NULL, "Unable to set to SR_STASYNC | SR_POLLMODE");
		exitdemo(1);
	}
	printandlog(ALL_DEVICES, MISC, NULL, "SRL Model Set to SR_STASYNC | SR_POLLMODE");
#else
	if (sr_setparm(SRL_DEVICE, SR_MODEID, &mode) == -1) {
		printandlog(ALL_DEVICES, NON_GC_APIERR, NULL, "Unable to set mode ID to SR_POLLMODE ");
		exitdemo(1);
	}
	
	printandlog(ALL_DEVICES, MISC, NULL, "SRL mode ID set to SR_POLLMODE");
#endif
}

/****************************************************************
*			NAME: open_all_logfiles(void)
* DESCRIPTION: Function to Open the Logfiles and put file pointers in file 
*					pointer field of port array. Later depending upon the index the
*					particular file can be accessed to dump the data.
*					If the network device name is present, then the log file
*					uses the network device name
*					else it uses the voice device name
*		RETURNS: returns 1 if successful
*	  CAUTIONS: Assumes device name includes network device name or a voice device name
****************************************************************/
int open_all_logfiles(void)
{	
	char		temp_filename[MAX_DEVNAME], temp_str[MAX_STRING_SIZE];
	char		*i;
	int		index;

	for (index = 0; index < num_devices; index++) {
		/* build up temp_filename */
		strcpy(temp_filename, logfile);

		/* case 1: if dti name exists, use it */
		if (strcmp(port[index].netdevice, "NONE") != 0) {
			sscanf(port[index].devname, ":N_dti%[^:]", temp_str); 
			strcat(temp_filename,  "_");
			strcat(temp_filename, temp_str);
		}
		/* case 2: if voice name exists, use it */
		else if (strcmp(port[index].voicedevice, "NONE") != 0) {
			i = (char *)strstr(port[index].voicedevice, "B");
			strcpy(temp_str, i);
			strcat(temp_filename,  "_");
			strcat(temp_filename, temp_str);
		} else {
			printf("Missing both DTI and Voice resource in config file device name (%s)\n",
					port[index].devname);
			exitdemo(1);
		}		
		strcat(temp_filename, ".log");

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品 国产精品| 亚洲国产日韩在线一区模特| 欧美综合色免费| fc2成人免费人成在线观看播放| 久久精品国产亚洲a| 日韩高清一级片| 免费一区二区视频| 美国一区二区三区在线播放| 久久超碰97人人做人人爱| 日本在线不卡视频| 激情欧美日韩一区二区| 黄色小说综合网站| 国产成人精品亚洲777人妖 | xf在线a精品一区二区视频网站| 波多野结衣在线aⅴ中文字幕不卡 波多野结衣在线一区 | 日本一区二区三区免费乱视频| 欧美精品一区二区三| 欧美成人伊人久久综合网| 日韩欧美国产一区二区三区| 久久精品一级爱片| 中文字幕一区二区三区在线观看| 日韩美女精品在线| 午夜精品久久一牛影视| 麻豆91在线观看| 粉嫩一区二区三区性色av| 欧美日本乱大交xxxxx| 欧美一级在线视频| 欧美一区二区三区在线视频| 日韩美女一区二区三区四区| 精品第一国产综合精品aⅴ| 欧美韩国日本不卡| 亚洲成人综合视频| 经典三级在线一区| 色成人在线视频| 日韩欧美电影一二三| 最新热久久免费视频| 婷婷亚洲久悠悠色悠在线播放| 国产美女娇喘av呻吟久久| 一本大道av一区二区在线播放| 日韩一二在线观看| 国产精品国产三级国产aⅴ原创| 午夜日韩在线电影| 国产91色综合久久免费分享| 91超碰这里只有精品国产| 国产精品萝li| 美腿丝袜一区二区三区| 91久久精品一区二区二区| 久久一留热品黄| 天天操天天干天天综合网| 国产91在线观看丝袜| 欧美一级片在线观看| 亚洲人妖av一区二区| 激情小说欧美图片| 欧美性色aⅴ视频一区日韩精品| 久久综合丝袜日本网| 亚洲成a人在线观看| av在线不卡免费看| 国产视频一区在线观看| 欧美96一区二区免费视频| 日本久久一区二区三区| 国产精品天天看| 国产精品资源在线观看| 日韩一区二区三区在线视频| 亚洲制服丝袜av| 色婷婷综合五月| 亚洲欧美日韩电影| av动漫一区二区| 欧美国产日韩亚洲一区| 国产精品自拍在线| 久久老女人爱爱| 韩国午夜理伦三级不卡影院| 91精品国产色综合久久不卡电影 | 久久久亚洲高清| 精品在线播放免费| 精品少妇一区二区三区视频免付费| 亚洲成av人片在线观看| 欧美中文字幕一区二区三区 | 经典三级视频一区| 日韩精品一区二区在线观看| 免费成人在线播放| 精品欧美乱码久久久久久| 久久精品72免费观看| 欧美性三三影院| 亚洲成人手机在线| 欧美久久久一区| 日本欧美在线看| 日韩欧美中文一区二区| 久久疯狂做爰流白浆xx| 国产午夜精品一区二区三区视频| 国产高清无密码一区二区三区| 国产三级精品三级在线专区| 成人高清视频在线观看| 一区二区高清视频在线观看| 欧美日韩一本到| 看片网站欧美日韩| 国产欧美va欧美不卡在线| av中文一区二区三区| 亚洲一卡二卡三卡四卡 | 国产精品一区二区在线观看网站| 国产亚洲精品久| 在线看国产日韩| 久久99热狠狠色一区二区| 国产精品久久久久久久久免费丝袜| 一本一本大道香蕉久在线精品| 亚洲成人在线免费| 久久女同精品一区二区| 91香蕉视频mp4| 美女视频黄频大全不卡视频在线播放| 久久一日本道色综合| 色天使色偷偷av一区二区| 日韩一区精品视频| 亚洲国产精品高清| 欧美日韩精品一区二区三区| 国产激情一区二区三区四区| 亚洲一区二区精品3399| 久久午夜羞羞影院免费观看| 色偷偷久久一区二区三区| 韩国三级电影一区二区| 一区二区三区四区不卡在线| 欧美精品一区二区三区蜜桃| 91国偷自产一区二区使用方法| 国产一区二区精品久久91| 一区二区三区成人在线视频 | 国产高清不卡二三区| 亚洲国产精品自拍| 中文字幕亚洲电影| 久久综合色之久久综合| 欧美视频日韩视频| 99精品久久只有精品| 久久精品久久久精品美女| 又紧又大又爽精品一区二区| 国产日韩精品一区二区三区在线| 欧美精品黑人性xxxx| 91福利视频久久久久| 成人免费毛片app| 国产精品影视在线观看| 另类小说色综合网站| 亚洲成人高清在线| 一区二区三区中文免费| 欧美国产禁国产网站cc| 精品日韩在线一区| 激情综合色播五月| 久久国产日韩欧美精品| 亚洲精品综合在线| 欧美国产成人精品| xnxx国产精品| 日韩欧美亚洲一区二区| 欧美精品在线观看播放| 欧美日韩在线三级| 成人av第一页| 99久久精品费精品国产一区二区| 久草在线在线精品观看| 免费av成人在线| 蜜桃精品在线观看| 看片的网站亚洲| 国产一区三区三区| 国产传媒一区在线| 成人丝袜高跟foot| 日日夜夜一区二区| 亚洲第一精品在线| 日韩精品成人一区二区在线| 亚洲成a人片综合在线| 日精品一区二区| 美女网站色91| 国产999精品久久| 99久精品国产| 91福利小视频| 欧美视频精品在线| 欧美一级一级性生活免费录像| 日韩视频中午一区| 久久色在线视频| 亚洲欧美综合另类在线卡通| 亚洲欧美成aⅴ人在线观看| 一区二区三区精品在线| 日韩中文字幕亚洲一区二区va在线 | 国精产品一区一区三区mba视频| 国产在线看一区| 99精品国产视频| 欧美日韩国产另类一区| 日韩欧美一区二区不卡| 国产精品美女久久久久久久| 一区二区三区丝袜| 另类成人小视频在线| 国产成人福利片| 欧美色国产精品| 久久亚洲一区二区三区四区| 国产精品久久久久aaaa| 亚洲bt欧美bt精品| 国产精品亚洲第一| 欧美体内she精高潮| 久久精品一区二区三区四区| 亚洲一区欧美一区| 国产美女久久久久| 欧美日韩综合在线免费观看| 精品久久一区二区三区| 成人欧美一区二区三区小说| 日韩电影一二三区| 91麻豆swag| 久久精品视频一区二区| 三级亚洲高清视频|