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

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

?? gc_basic_call_model.c

?? dialogic gcwithvoice
?? 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()
*					  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+");

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧洲av在线精品| 国产精品家庭影院| 国产精品三级视频| 午夜激情一区二区三区| 99麻豆久久久国产精品免费| 欧美精品一区二区在线观看| 亚洲成av人片在www色猫咪| 国产v综合v亚洲欧| 精品欧美乱码久久久久久 | 成人永久看片免费视频天堂| 欧美日韩的一区二区| 国产精品高潮久久久久无| 国产在线国偷精品产拍免费yy | 91精品国产福利| 亚洲精品成a人| 成人网页在线观看| www欧美成人18+| 久久国产精品99久久久久久老狼 | 国产麻豆午夜三级精品| 欧美日韩精品久久久| 一区二区三区自拍| 色综合天天天天做夜夜夜夜做| 26uuu色噜噜精品一区二区| 美女网站视频久久| 91精品婷婷国产综合久久竹菊| 亚洲一区二区三区爽爽爽爽爽 | 国产精品久久久久一区二区三区共| 日韩成人dvd| 欧美一区二区三区小说| 日韩电影免费一区| 欧美片在线播放| 首页亚洲欧美制服丝腿| 欧美精品乱码久久久久久| 亚洲成人高清在线| 欧美日韩国产综合一区二区三区| 亚洲大型综合色站| 日韩一级片网站| 激情综合网av| 国产精品嫩草影院av蜜臀| 丁香网亚洲国际| 亚洲精品亚洲人成人网在线播放| 91亚洲精品久久久蜜桃| 亚洲综合自拍偷拍| 欧美精品久久一区| 国内不卡的二区三区中文字幕| 欧美xxxx老人做受| 成人黄色网址在线观看| 亚洲日本中文字幕区| 在线日韩av片| 日av在线不卡| 国产精品视频九色porn| 欧洲一区二区av| 久久精品99国产精品| 久久精品亚洲乱码伦伦中文| 成人国产精品免费观看| 一区二区三区不卡在线观看 | 亚洲成人1区2区| 日韩一级大片在线| 国产suv精品一区二区6| 一二三区精品视频| 精品成人在线观看| 色爱区综合激月婷婷| 欧美96一区二区免费视频| 国产农村妇女毛片精品久久麻豆| 91同城在线观看| 久久精品国产久精国产爱| 亚洲欧洲国产专区| 678五月天丁香亚洲综合网| 国产福利91精品| 午夜av一区二区三区| 久久久久久影视| 欧美日韩一二三区| 国产成人免费视频| 国产91露脸合集magnet| 午夜精品一区在线观看| 国产午夜精品一区二区| 91精品麻豆日日躁夜夜躁| av在线不卡免费看| 久久国产精品一区二区| 亚洲精品久久久久久国产精华液| 亚洲精品一区二区三区香蕉| 在线看一区二区| 国产福利91精品一区二区三区| 亚洲国产精品一区二区www在线| 久久久久久久国产精品影院| 欧美午夜精品一区| 97成人超碰视| 国产精品18久久久久| 日本欧美一区二区在线观看| 怡红院av一区二区三区| 中文字幕av资源一区| 精品免费日韩av| 在线成人小视频| 色综合天天性综合| av成人免费在线观看| 国产高清不卡二三区| 麻豆成人在线观看| 免费在线看一区| 亚洲成人7777| 亚洲一卡二卡三卡四卡五卡| 综合久久久久综合| 中文字幕欧美国产| 国产视频在线观看一区二区三区 | 久久综合色一综合色88| 欧美日韩一区二区三区在线| 91丨porny丨国产入口| av在线不卡免费看| 成人性生交大片免费看视频在线 | 天天综合天天综合色| 亚洲午夜日本在线观看| 一区二区三区在线观看视频| 日韩一区在线看| 亚洲欧美偷拍另类a∨色屁股| 国产精品久久久久影院亚瑟| 国产精品视频看| 亚洲欧洲av一区二区三区久久| 欧美韩国一区二区| 日韩一区欧美小说| 亚洲制服欧美中文字幕中文字幕| 亚洲美女在线国产| 亚洲午夜三级在线| 免费在线视频一区| 国产最新精品免费| 成人福利视频网站| 色综合天天综合色综合av| 在线视频亚洲一区| 在线91免费看| 日韩一区二区免费高清| 久久久久久99久久久精品网站| 国产欧美一区在线| 国产精品高潮呻吟| 亚洲主播在线播放| 捆绑紧缚一区二区三区视频| 国产电影一区二区三区| 99久久精品国产观看| 欧美美女黄视频| 精品少妇一区二区三区在线播放| 国产欧美一区二区精品婷婷| 亚洲视频在线观看一区| 亚洲国产精品久久不卡毛片| 蜜桃免费网站一区二区三区| 国产盗摄一区二区| 欧美主播一区二区三区| 日韩精品一区国产麻豆| 国产精品三级视频| 天天综合色天天综合色h| 欧洲一区二区三区在线| 欧美成人欧美edvon| 中文字幕一区二区三区蜜月| 香蕉加勒比综合久久| 国产精品影视在线观看| 在线视频欧美精品| 国产日韩欧美综合在线| 亚洲一级不卡视频| 国产麻豆成人传媒免费观看| 日本电影亚洲天堂一区| 26uuu色噜噜精品一区| 亚洲国产cao| 成人18精品视频| 精品国产露脸精彩对白| 亚洲久草在线视频| 国产 欧美在线| 日韩小视频在线观看专区| 亚洲视频一区二区免费在线观看| 日韩精品乱码免费| 9l国产精品久久久久麻豆| 精品三级av在线| 午夜久久久久久电影| 色综合夜色一区| 国产人成一区二区三区影院| 免费黄网站欧美| 欧美午夜不卡视频| 亚洲欧洲日产国码二区| 国产酒店精品激情| 欧美一区二区三区啪啪| 亚洲精品欧美在线| 成人在线综合网| 久久影院午夜片一区| 日本不卡视频一二三区| 欧美自拍偷拍午夜视频| 亚洲女与黑人做爰| 福利一区福利二区| 久久久久久久电影| 国产在线一区观看| 欧美成人精品高清在线播放 | 韩国精品在线观看| 欧美男人的天堂一二区| 伊人性伊人情综合网| yourporn久久国产精品| 日本一区二区综合亚洲| 韩国成人精品a∨在线观看| 欧美一区二区在线免费观看| 天天av天天翘天天综合网| 在线免费观看日本一区| 亚洲中国最大av网站| 欧美亚洲国产bt| 午夜欧美2019年伦理| 欧美老肥妇做.爰bbww| 日韩精品一二三区| 欧美va在线播放|