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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? gc_basic_call_model.c

?? dialogic gcwithvoice
?? C
?? 第 1 頁 / 共 5 頁
字號(hào):
/***************************************************************************
* 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()
*					  4. PDK as shipped has an issue where occasionally the first makecall may
*						  fail with an invalid state error. The demo program has a recovery
*						  mechanism built in. When connected to a switch, this should not be 
*						  a problem.
*					  5. gc_demo_open_isdn_channel may need to be modified for your environment,
*						  especially if you are using T1.

*
*	%created_by:	fiedorom %
*	%date_created: Tue May 25 11:21:03 2004 %
*
***************************************************************************/
/**********************************************************************
*  Copyright (C) 2000-2002 Intel Corporation.
*  All Rights Reserved
*
*  All names, products, and services mentioned herein are the 
*  trademarks or registered trademarks of their respective 
*  organizations and are the sole property of their respective owners.
**********************************************************************/

#ifndef lint
static char *_csrc = "@(#) %filespec: gc_basic_call_model.c-28 %  (%full_filespec: gc_basic_call_model.c-28: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>
#include <fcntl.h>
#include <errno.h>

/**
  Intel Header Files
 **/
#include <srllib.h>
#include <dxxxlib.h>
#include <dtilib.h>


/* OS Socket API Headers */
#ifdef _WIN32
//#include <winsock2.h>
#else
#include <unistd.h>
#include <netdb.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#endif

/* Dialogic Header Files */
#include <gcip.h>
#include <gclib.h>
#include <gcisdn.h>



/*
 * Vox Files to Open
 */
#define INTRO_VOX	"INTRO.VOX"
#define INVALID_VOX	"INVALID.VOX"
#define GOODBYE_VOX	"GOODBYE.VOX"
#define BLANK_VOX	"BLANK.VOX"

/*
 * Definition of states
 */
#define ST_WTRING	1	/* Waiting for an Incoming Call    */
#define ST_OFFHOOK	2	/* Going Off Hook to Accept Call   */
#define ST_INTRO	3	/* Play the intro.vox File         */
#define ST_GETDIGIT	4	/* Get DTMF Digits (Access Code)   */
#define ST_PLAY		5	/* Play the Caller's Message File  */
#define ST_RECORD	6	/* Recording Message from Caller   */
#define ST_INVALID	7	/* Play invalid.vox (Invalid Code) */
#define ST_GOODBYE	8	/* Play goodbye.vox                */
#define ST_ONHOOK	9	/* Go On Hook                      */
#define ST_ERROR	10	/* An Error has been Encountered   */
#define ST_DIAL	11	/* An Error has been Encountered   */
int introfd;
int invalidfd;
int goodbyefd;
int blankfd;

#ifdef _WIN32
#define QUIT( n )	/*endwin();*/	\
			exit( (n) )
#else
#define QUIT( n )	exit( (n) )
#endif

int fileopen(char *filename, int flags)
{
#ifdef _WIN32
	return dx_fileopen(filename, flags|O_BINARY, 0666);
#else
	return open(filename, flags, 0666);
#endif
}

int fileclose(int fhandle)
{
#ifdef _WIN32
	return dx_fileclose(fhandle);
#else
	return close(fhandle);
#endif
}



/* Macro Definitions */

char	tmpbuff[ 256 ];		/* Temporary Buffer */

#define MAXCHAN			480		/* Maximum number of channels that can be opened - 2 E1 spans	*/
#define MAX_DEVNAME		64		/* Maximum length of device name											*/
#define MAX_CODECNAME	20		/* Maximum length of codec name											*/
#define MAX_STRING_SIZE 1000	/* Maximum length of string that to write on log file			*/
								/* Keep large																	*/
#define MAX_CALLS			2	/* Maximum number of calls per channel */
#define MIN_CONNECTED_TIME	30	/* Minimum connected time, artifact of test program				*/
								/* and most likely will not be needed for a production program */

#define	MIN_MAKECALL_RETRY_TIME	5	/* min time to wait before retrying makecall under		*/
									/* error conditions															*/
#define MAXCODECS			10	/* Maximum number of codecs per VoIP channel */
#define MAX_VADSTR		10		/* Maximum length of VAD string, e.g. "ON", "OFF", "N/A" */


/* 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 VOICE				5	/* VOICE message																*/
#define GC_RESULT_INFO		6	/* want GC result information												*/
#define MISC				7	/* None of the above															*/
#define MISC_WITH_NL		8	/* 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
#define NO					0

#define ALL_DEVICES	  -1		/* This value is used to write the */
										/* miscellaneous statements into all log files */ 
#define OUT_OF_RANGE	  -1		/* callindex is out of range */

/*
 * Technology Types
 */
#define E1ORT1_CAS		1
#define ISDN				2							/* includes both E1 and T1 ISDN */
#define ANALOG				3
#define SS7					4
#define H323				5
#define SIP					6

/* 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		 */
static int		reset_linedevs_left_to_complete = 0; 

/* Data structure which stores call information for each line device */
typedef struct {
	CRN					crn;							/* GlobalCall call handle */
	int					call_state;					/* state of first layer state machine */
	int					dropcall_active;			/* Flag for simultaneous disconnect check	*/
} CALL;

/* TX and RX codecs for each line device although only used for H.323 or SIP */
typedef struct {
	char					txcodec[MAX_CODECNAME];	/* TX codec type (H.323 or SIP only)					*/
	int					txrate;						/* TX codec rate (H.323 or SIP only)					*/
	char					txVAD[MAX_VADSTR];		/* TX VAD enabled/disabled (H.323 or SIP only)		*/
	char					rxcodec[MAX_CODECNAME];	/* RX codec type (H.323 or SIP only)					*/
	int					rxrate;						/* RX codec rate (H.323 or SIP only)					*/
	char					rxVAD[MAX_VADSTR];		/* RX VAD enabled/disabled (H.323 or SIP only)		*/
} CODEC;

/* Data structure which stores all information for each line device */
static struct channel {
	LINEDEV				ldev;							/* GlobalCall line device handle							*/
	LINEDEV				mediah;						/* Media handle - only for H323                    */
	CALL				call[MAX_CALLS];
	int					index;						/* Device index as loaded from cfg file				*/
	int					direction;					/* Inbound(WaitCall will be issued)
																or outbound(MakeCall will be issued)				*/
	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[60]; /* Phone													*/
	int					num_codecs;					/* The No. of codecs specified (VoIP device only) 	*/
	CODEC					codec[MAXCODECS];			/* Codecs (VoIP device only)								*/
	int					numb_calls;					/* The No of calls on the device							*/
	int					waitcall_active;			/* Flag for waitcall function for issuing only once*/
	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									*/
															/* and some error conditions								*/
													
	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_CAS, ISDN, ANALOG,		*/

	time_t				makecall_time;				/* time before which makecall is not allowed       */
															/* this is to add robustness to the app				*/
															/* if makecall fails which it might under some		*/
															/* circumstances, but will work if try later			*/
															/* if this value is 0, then OK to do now           */

	/* this variable is in so know when to drop a call */
	/* it is an artifact of the demo program and 	   */
	/* and should not be used in production level 		*/
	/* programs														*/
	time_t				dropcall_time;				/* time to drop the call on the outbound side      */
															/* format is result of time() function call        */
															/* 0 <=> no dropcall required                      */
	time_t				intercall_time;			/* Time when the call was released. The next call  */
                                             /* would be made after intercall_time +            */
                                             /* intercall_delay seconds.                        */
   int               intercall_delay;        /* Inter-call delay in milliseconds                */
   int	    chdev;			/* Channel Device Descriptor    */
   int	    tsdev;			/* Timeslot Device Descriptor   */
   int	    state;			/* State of Channel             */
   int	    msg_fd;			/* File Desc for Message Files  */
   DV_DIGIT digbuf;			/* Buffer for DTMF Digits       */
   DX_IOTT  iott[ 1 ];			/* I/O Transfer Table		*/
   char	    msg_name[ MAX_DEVNAME+1 ];	/* Message Filename             */
} port[MAXCHAN];

/* codec translation table */
typedef struct {
	char*			codecname;
	int			codecvalue;
	int			isVADsupported;
} CODECXLAT;

static const CODECXLAT codecxlat[] = {
	{"G.711Alaw",	GCCAP_AUDIO_g711Alaw64k,			NO},
	{"G.711ulaw",	GCCAP_AUDIO_g711Ulaw64k,			NO},
	{"G.723_5.3k",	GCCAP_AUDIO_g7231_5_3k,				YES},
	{"G.723_6.3k",	GCCAP_AUDIO_g7231_6_3k,				YES},
	{"G.726_16k",	GCCAP_AUDIO_g726_16k,				YES},
	{"G.726_24k",	GCCAP_AUDIO_g726_24k,				YES},
	{"G.726_32k",	GCCAP_AUDIO_g726_32k,				YES},
	{"G.726_40k",	GCCAP_AUDIO_g726_40k,				YES},
	{"G.729",		GCCAP_AUDIO_g729		,				NO},
	{"G.729A",		GCCAP_AUDIO_g729AnnexA,				NO},
	{"G.729B",		GCCAP_AUDIO_g729wAnnexB,			YES},
	{"G.729AB",		GCCAP_AUDIO_g729AnnexAwAnnexB,	YES},
	{"GSM_FULL",	GCCAP_AUDIO_gsmFullRate,			YES},
	{"T.38UDP",		GCCAP_DATA_t38UDPFax,				NO},
	{"DONT_CARE",	GCCAP_dontCare,						NO}
};

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		make_calls_if_required(void);				/* used by demo to handle makecall error conditions 	*/
static void		printandlog(int index, int log_type,	/* Prints and logs												*/ 
								METAEVENT *metavent, char *msg_str, int callindex);
static void		gc_demo_makecall(int index);				/* Function for gc_MakeCall()									*/ 
static void		exitdemo(int exitlevel);					/* Exit routine													*/
static void		initiate_exit(void);
static void		intr_hdlr(void);								/* For handling user interrupted signals					*/
static void		set_calling_num(struct channel *pline, char *phone_num);
static void		enable_alarm_notification(struct channel *pline);/* enable alarm notification                */
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 Analog		*/
static void		gc_demo_open_H323_channel(int index);	/* Technology specific initialization for H323  		*/
static void		gc_demo_open_SIP_channel(int index);	/* Technology specific initialization for SIP   		*/
static void		gc_set_channel_codecs(int index);		/* VoIP specific initialization of codecs					*/
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		print_alarm_info(METAEVENTP metaeventp, struct channel *pline);
static void		process_event(void);							/* Function handles the GlobalCall Events					*/
static void		process_connected_event(struct channel *pline, METAEVENT *metaeventp);
static void		process_disconnected_event(struct channel *pline, METAEVENT *metaeventp);
static void		process_offered_event(METAEVENT *metaeventp, struct channel *pline);
static void		process_call_related_inbound_event(struct channel *pline, METAEVENT *metaeventp); /* Function handles the GlobalCall Events for inbound */
static void		process_call_related_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, int callindex);	/* 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);
static int		existCRN(CRN crn, struct channel *pline);	/* Retrieve CRN if available */
static int		process_voice_event(int channum);
int				routevoice(int index);

void printError(char *devname, char *messages)
{
	struct tm			*Time;
	time_t				Timet;
	char					TimeStr[MAX_STRING_SIZE];			/* will hold the time string when built */
	FILE *fp = fopen ("Error.log", "a+");

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品主播直播| 欧美综合一区二区三区| 美女一区二区三区在线观看| 亚洲大片一区二区三区| 一区二区三区在线高清| 中文字幕在线不卡一区 | 久久亚洲精华国产精华液| 欧美久久久久中文字幕| 56国语精品自产拍在线观看| 欧美私模裸体表演在线观看| 欧美三电影在线| 在线播放视频一区| 日韩精品一区在线| 久久综合色8888| 久久久欧美精品sm网站| 国产日韩精品久久久| 国产欧美一区二区三区网站| 国产精品久久久久久久久久免费看 | 午夜欧美视频在线观看 | 成人在线视频一区二区| av在线播放成人| 91久久国产最好的精华液| 欧美色图12p| 日韩精品专区在线| 国产色产综合色产在线视频| 国产三级精品视频| 亚洲欧美日韩一区二区| 亚洲第一福利一区| 久久不见久久见中文字幕免费| 国产成人欧美日韩在线电影| 99久久综合99久久综合网站| 在线观看日韩毛片| 91麻豆精品国产91久久久使用方法| 日韩欧美一级特黄在线播放| 中文字幕乱码久久午夜不卡 | 中文av一区特黄| 一区二区成人在线视频| 青青草97国产精品免费观看无弹窗版| 国产最新精品免费| 日本久久电影网| 日韩欧美自拍偷拍| 国产精品色在线| 亚洲综合一区在线| 麻豆国产精品视频| 91蝌蚪porny| 日韩欧美自拍偷拍| 日韩美女视频一区| 久久精品国产99| 91视频免费观看| 欧美mv日韩mv亚洲| 亚洲伦理在线精品| 国产在线精品不卡| 欧美在线啊v一区| 久久久久国产一区二区三区四区| 亚洲情趣在线观看| 激情综合网天天干| 欧美午夜精品久久久久久孕妇| 久久午夜老司机| 五月天激情综合网| 91一区二区在线| 久久精品一二三| 婷婷成人综合网| 97se亚洲国产综合自在线观| 精品少妇一区二区三区日产乱码| 亚洲欧洲一区二区三区| 六月丁香婷婷久久| 色哟哟一区二区三区| wwww国产精品欧美| 丝袜诱惑制服诱惑色一区在线观看| 成人午夜精品一区二区三区| 欧美一区二区三区影视| 亚洲永久精品大片| fc2成人免费人成在线观看播放| 日韩精品在线一区| 亚洲福利一二三区| 色综合久久88色综合天天6| 久久精品亚洲精品国产欧美kt∨| 午夜精品福利视频网站| 91网址在线看| 日本一区二区三区dvd视频在线| 蜜桃视频在线观看一区二区| 欧美性一区二区| 亚洲免费观看在线视频| 岛国av在线一区| 久久婷婷综合激情| 日本91福利区| 欧美高清www午色夜在线视频| 亚洲欧美日本韩国| 99久久国产免费看| 国产精品欧美精品| 粉嫩一区二区三区性色av| 欧美一级欧美三级| 五月天激情综合| 欧美精品亚洲一区二区在线播放| 亚洲乱码中文字幕| 色综合色狠狠综合色| 椎名由奈av一区二区三区| 成人黄色国产精品网站大全在线免费观看 | 天堂影院一区二区| 在线视频一区二区三区| 亚洲精品成人少妇| 色综合久久中文综合久久牛| 中文字幕一区二区三区精华液| 福利91精品一区二区三区| 久久综合99re88久久爱| 国产综合色产在线精品| 久久综合久久综合九色| 激情综合网激情| 久久久国产一区二区三区四区小说| 国产乱码精品1区2区3区| 久久久国产精品午夜一区ai换脸| 国产精品一级黄| 中文一区一区三区高中清不卡| 国产成人自拍网| 国产精品久久午夜| 99精品久久99久久久久| 亚洲美女偷拍久久| 欧美日韩激情一区二区三区| 午夜天堂影视香蕉久久| 日韩一区二区在线看| 久久国产精品99久久人人澡| 久久精品视频免费| 成人免费精品视频| 亚洲精品中文在线影院| 欧美日韩不卡在线| 精一区二区三区| 欧美极品aⅴ影院| 99精品在线免费| 亚洲国产精品视频| 日韩欧美国产高清| 波多野结衣视频一区| 一区二区三区不卡在线观看| 欧美乱熟臀69xxxxxx| 久久国产精品99久久久久久老狼 | 国产在线精品一区二区三区不卡 | 国产精品水嫩水嫩| 日本高清免费不卡视频| 午夜精品爽啪视频| 久久久精品2019中文字幕之3| 97精品久久久久中文字幕| 香港成人在线视频| 2023国产精品自拍| 91影视在线播放| 免费欧美在线视频| 国产精品久久看| 7777精品伊人久久久大香线蕉| 国产成人在线观看| 一区二区三区丝袜| 久久综合久久久久88| 在线观看日韩高清av| 精品一区二区三区免费| 亚洲免费高清视频在线| 欧美一二区视频| 91丝袜国产在线播放| 久久99国产精品久久99| 亚洲欧美另类在线| 日韩欧美你懂的| 91欧美一区二区| 激情五月播播久久久精品| 亚洲精品久久7777| 久久久久国色av免费看影院| 欧美中文字幕一区二区三区 | 91精品国产综合久久久久久| 国产麻豆91精品| 亚洲影院在线观看| 国产欧美综合在线观看第十页| 欧美在线free| 粗大黑人巨茎大战欧美成人| 亚洲成年人影院| 欧美激情艳妇裸体舞| 在线综合亚洲欧美在线视频| 91最新地址在线播放| 黑人精品欧美一区二区蜜桃| 一区二区免费看| 国产精品盗摄一区二区三区| 欧美成人在线直播| 欧美色图激情小说| 一本色道久久综合精品竹菊| 成人午夜精品在线| 国产在线一区二区综合免费视频| 亚洲成人精品一区| 亚洲婷婷在线视频| 久久久99免费| 欧美成人bangbros| 91精品国产综合久久久久久漫画| 在线看不卡av| 91免费精品国自产拍在线不卡| 高清不卡在线观看av| 久久66热re国产| 日本不卡一区二区三区高清视频| 亚洲制服丝袜一区| 亚洲美女免费在线| 亚洲人成影院在线观看| 中文字幕成人网| 久久免费电影网| 久久精品这里都是精品| 亚洲精品一区二区三区99| 欧美一区二区三区免费视频| 欧美美女视频在线观看| 欧美日韩一区中文字幕|