⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 d160aunpbxdlg.cpp

📁 VC交换机例程,东进
💻 CPP
📖 第 1 页 / 共 4 页
字号:
					i++;
					break;
				}
				break;

			case	LINE_IP_CONNECTING:
				if(HangUpDetect(channel)!=HANG_UP_FLAG_FALSE)
				{
					HangUpDetect(TelLine[channel].WaiConnectCh);
					TelLine[TelLine[channel].WaiConnectCh].Status=LINE_INIT;
					TelLine[channel].Status=LINE_INIT;
					break;
				}
				
			
				// 只管发送DTMF,直到受到#结束,或延时过5秒钟
			
				if(CheckPlayEnd(channel))		// 放音完成后再取下一个DTMF码
				{
					Sleep(180);
				if(ElapseTime(channel,TIMER_NO)>=ONE_SECOND*6)
				{
					TelLine[channel].Status=LINE_IP_CONNECTED;
					break;
				}
				
				code=GetDtmfCode(channel);
				if(code==-1) break;

				if(code==12)// 收到#结束,转IP通话
				{
					strcpy(FileName,VoicePath);
					strcat(FileName,"dtmf12");
					StartPlayFile(TelLine[channel].WaiConnectCh,FileName,0);
					TelLine[channel].Status=LINE_IP_CONNECTED;
					break;

				}
			
				{// 收码随后立即发送

					TelLine[channel].DtmfArray[0]=(char)(code%10+48);
					TelLine[channel].DtmfArray[1]='\0';
					strcpy(FileName,VoicePath);
					strcat(FileName,"dtmf");
					strcat(FileName,(char *)TelLine[channel].DtmfArray);
					StartPlayFile(TelLine[channel].WaiConnectCh,FileName,0L);
					StartTimer(channel,TIMER_NO);
				}
				}

				break;

			case	LINE_IP_CONNECTED:
				
				//	if(looptimes[channel]==20)
					{
						SetLink(channel,TelLine[channel].WaiConnectCh);
						TelLine[channel].Status=LINE_INTER_CALL;
					}
					break;

		
			case	LINE_JUST_WAIT:
			
				break;
			case	LINE_WAIT_AND_JUDGE:
				if(TelLine[channel].ChType==CHTYPE_TRUNK )
				{
					if(HangUpDetect(TelLine[channel].CallCh)==HANG_UP_FLAG_TRUE)
					{
						HangUp(channel);
						TelLine[channel].Status=LINE_INIT;

					}
					StartHangUpDetect(TelLine[channel].CallCh);
					break;
				}

				if(HangUpDetect(TelLine[channel].CallCh)==HANG_UP_FLAG_TRUE)
				{
					StartPlaySignal(channel,SIG_BUSY1);
					TelLine[channel].Status=LINE_WAIT_HANGUP;
					
				}
				StartHangUpDetect(TelLine[channel].CallCh);
					
				break;

			case	LINE_FREE_CALL:
				// 收DTMF码时的挂机处理
				if(TelLine[channel].ChType==CHTYPE_USER &&HangUpDetect(channel)!=HANG_UP_FLAG_FALSE)
				{	// 内线收号时的挂机处理
					TelLine[channel].Status=LINE_INIT;
					break;
				}

				if(TelLine[channel].ChType==CHTYPE_TRUNK && Sig_CheckBusy(channel))
				{// 收DTMF码时外线挂机处理
					HangUp(channel);
					TelLine[channel].Status =LINE_INIT;
					break;
				}
				code=GetDtmfCode(channel);
				InitDtmfBuf(channel);
				if(code!=-1)
				{
					StopPlayFile(channel);
					switch(code)
					{
						case 1:		// 号码查询
							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\numquery.voc");
							StartPlayFile(channel,FileName,0);
							TelLine[channel].Status=LINE_PLAY_RESULT;
							break;

						case 2:			// 公司介绍
							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\cointroduce.voc");
							StartPlayFile(channel,FileName,0);
							TelLine[channel].Status=LINE_PLAY_RESULT;
							break;

						case 3:			// 系统演示
							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\bank.voc");
							StartPlayFile(channel,FileName,0);
							TelLine[channel].Status=LINE_SYSTEM_DEMO;
							break;

						case 4:			// 东进电话教程
							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\phonetrain.voc");
							StartPlayFile(channel,FileName,0);
							TelLine[channel].Status=LINE_PLAY_RESULT;
							break;

						default:
							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\freecallwel.voc");
							StartPlayFile(channel,FileName,0);
							TelLine[channel].Status=LINE_FREE_CALL;
							break;
					}
				}

				if(CheckPlayEnd(channel))
				{
					StartPlayFile(channel,FileName,0);
				i++;

				}
				break;


			case	LINE_SYSTEM_DEMO:	// 电话银行的TTS DEMO 程序
				// 收DTMF码时的挂机处理
				if(TelLine[channel].ChType==CHTYPE_USER &&HangUpDetect(channel)!=HANG_UP_FLAG_FALSE)
				{	// 内线收号时的挂机处理
					TelLine[channel].Status=LINE_INIT;
					break;
				}

				if(TelLine[channel].ChType==CHTYPE_TRUNK && Sig_CheckBusy(channel))
				{// 收DTMF码时外线挂机处理
					HangUp(channel);
					TelLine[channel].Status =LINE_INIT;
					break;
				}
				code=GetDtmfCode(channel);
				InitDtmfBuf(channel);
				if(code!=-1)
				{
					StopPlayFile(channel);
			
					switch(code)
					{
						case 1:		// 	 余额
							StopPlayFile(channel);
							RsetIndexPlayFile(channel);
							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat ( FileName, "bank.005");
							AddIndexPlayFile(channel,FileName);

							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"d5");
							AddIndexPlayFile(channel,FileName);

							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"d12");
							AddIndexPlayFile(channel,FileName);
	
							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"d8");
							AddIndexPlayFile(channel,FileName);

							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"d11");
							AddIndexPlayFile(channel,FileName);

							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"d9");
							AddIndexPlayFile(channel,FileName);

							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"d10");
							AddIndexPlayFile(channel,FileName);

							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"d6");
							AddIndexPlayFile(channel,FileName);

							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"d15");
							AddIndexPlayFile(channel,FileName);

							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"d8");
							AddIndexPlayFile(channel,FileName);

							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"bank.008");
							AddIndexPlayFile(channel,FileName);
							StartIndexPlayFile(channel);
							TelLine[channel].Status = LINE_PLAY_RESULT;
							break;

						case 2:		// 利率
							StopPlayFile(channel);
							RsetIndexPlayFile(channel);
							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"bank.006");
							AddIndexPlayFile(channel,FileName);
	
							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"d0");
							AddIndexPlayFile(channel,FileName);

							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"d15");
							AddIndexPlayFile(channel,FileName);

							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"d4");
							AddIndexPlayFile(channel,FileName);

							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"d8");
							AddIndexPlayFile(channel,FileName);

							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"bank.008");
							AddIndexPlayFile(channel,FileName);
							StartIndexPlayFile(channel);
							TelLine[channel].Status = LINE_PLAY_RESULT;
							break;

						case 3:			// 利息	

							StopPlayFile(channel);
							RsetIndexPlayFile(channel);
							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"bank.007");
							AddIndexPlayFile(channel,FileName);

							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"d3");
							AddIndexPlayFile(channel,FileName);
		
							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"d13");
							AddIndexPlayFile(channel,FileName);

							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"d7");
							AddIndexPlayFile(channel,FileName);

							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"d12");
							AddIndexPlayFile(channel,FileName);

							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"bank.008");
							AddIndexPlayFile(channel,FileName);
							StartIndexPlayFile(i);
							TelLine[channel].Status = LINE_PLAY_RESULT;
							break;
						default:
							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\");
							strcat(FileName,"\\bank.voc");
							StartPlayFile(channel,FileName,0);
							TelLine[channel].Status=LINE_SYSTEM_DEMO;
							break;
					}
				}
			
				if(CheckPlayEnd(channel))
				{
					StopPlayFile(channel);
				}


				break;

			case	LINE_PLAY_RESULT:

				if(CheckIndexPlayFile(channel))
				{
					StopIndexPlayFile(channel);
					if(TelLine[channel].ChType==CHTYPE_TRUNK)
					{
						HangUp(channel);
						TelLine[channel].Status=LINE_INIT;
						break;
					}
						//yzResetChannel(channel);
					else 
					{
						StartPlaySignal(channel,SIG_BUSY1);
						TelLine[channel].Status=LINE_WAIT_HANGUP;
					}
				}
				break;

				
			case	LINE_VOICE_BOX:
				code=GetDtmfCode(channel);
				InitDtmfBuf(channel);
				if(code!=-1)
				{
					StopPlayFile(channel);
				
					switch(code)
					{
						case 1:			// 留言
							StopRecordFile(channel);
							strcpy(FileName,VoicePath);
							strcat(FileName,"voc\\voiceboxstart.voc");
							StartPlayFile(channel,FileName,0);
							TelLine[channel].Status=LINE_VOICE_BOX;
							break;

						case 2:			// 收听留言
							StopRecordFile(channel);
							strcpy(FileName,VoicePath);
							strcat(FileName,"\\voicebox\\");
							strcat(FileName,TelLine[channel].LineNum);
							strcat(FileName,".voc");
							StartPlayFile(channel,FileName,0);
							TelLine[channel].ListenFlag=TRUE;
							TelLine[channel].Status=LINE_VOICE_BOX;
							break;
						case 11:
							StopRecordFile(channel);
							strcpy(FileName,VoicePath);
							strcat(FileName,"\\voicebox\\");
							if(channel>=8)
								strcpy(TelLine[channel].LineNum,"88");
							strcat(FileName,TelLine[channel].LineNum);
							strcat(FileName,".voc");
						//	mfile.Open (FileName,CFile::modeCreate||CFile::modeWrite,NULL);
						//	StartRecordFile(channel,FileName,254120);
							DeleteFile(FileName);
							{int nnn=StartRecordFileNew(channel,FileName,196000,0);}
							TelLine[channel].Status=LINE_RECORD;

							break;
						default:
							break;
					}
				}

				if(CheckPlayEnd(channel))
				{
				  StopPlayFile(channel);
				  if(TelLine[channel].ListenFlag)
				  {
					  TelLine[channel].ListenFlag=false;
					  if(TelLine[channel].ChType==CHTYPE_TRUNK)
					  {
						  HangUp(channel);
						  TelLine[channel].Status=LINE_INIT;
						  break;
					  }
					  StartPlaySignal(channel,SIG_BUSY1);
					  TelLine[channel].Status=LINE_WAIT_HANGUP;
					  break;

				  }

				}				
				break;

			default0:break;


			case	LINE_RECORD:

				code=GetDtmfCode(channel);

				if(code !=-1 || CheckRecordEnd(channel))
				{
					StopRecordFile(channel);
					TelLine[channel].Status=LINE_INIT;
				}




		}


	}  // End for

}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -