<?xml version="1.0" encoding="utf-8"?>
<ivr>
	<flow Name="IVR_HX" Type="normal" MatchedNum="." MatchedLine="|-1|" Concurrency="1">
		<cell Name="CELL_START" Pos="1" Next="2" Note="开始节点" />
		<cell Name="CELL_SQL" Pos="2" ConnStr="Provider=SQLOLEDB.1;Password=800100;Persist Security Info=True;User ID=sa;Initial Catalog=CallCenter_ZYKJ2;Data Source=192.168.4.18" 
		SqlStr="INSERT INTO T_Call_CallRecords(CallId,CallNumber,CallType,CallState,DealType,BeginTime,IvrStartTime,IvrEndTime,EndTime,LongTime,IsDeal,OperateType,MYD) VALUES('%[CallID]','%[CallerID]',0,0,0,GETDATE(),GETDATE(),GETDATE(),GETDATE(),0,0,0,1)" 
		IsSaved="no" SuccessPos="3" FailPos="3" Note="插入通话记录" />
		<cell Name="CELL_DEFINEVAR" Pos="3" Next="4" Note="定义变量节点">
			<DefVar VarType="1" VarName="AgentNo" VarVal="0" />
			<DefVar VarType="1" VarName="AgentExtNo" VarVal="0" />
			<DefVar VarType="1" VarName="KeyGroup" VarVal="0" /><!--坐席组按键值-->
			<DefVar VarType="1" VarName="GroupID" VarVal="0" /><!--通过坐席组按键值 获取相应的坐席组ID-->
			<DefVar VarType="1" VarName="Key" VarVal="0" />
			<DefVar VarType="1" VarName="BlackListVerify" VarVal="0" />
			<DefVar VarType="1" VarName="HolidayVerify" VarVal="0" />
			<DefVar VarType="1" VarName="zbdh" VarVal="0" />
			<DefVar VarType="1" VarName="AgentTel" VarVal="0" />
		</cell>
		<cell Name="CELL_SQL" Pos="4" ConnStr="Provider=SQLOLEDB.1;Password=800100;Persist Security Info=True;User ID=sa;Initial Catalog=CallCenter_ZYKJ2;Data Source=192.168.4.18" 
		SqlStr="select COUNT(*) FROM T_Call_Blacklist where F_TelPhone='%[CallerID]'" IsSaved="yes" SuccessPos="5" FailPos="5" Note="读取黑名单" />
		<cell Name="CELL_RECORDSET" Pos="5" LPos="6" EPos="6" GPos="6" Note="取黑名单结果">
			<Map Var="BlackListVerify" />
		</cell>
		<cell Name="CELL_COMPARE" Pos="6" Data1Type="2" Data2Type="1" Data3Type="1" Data1="BlackListVerify" Data2="0" Data3="" VarType="1" CompareType="2" TruePos="7" FalsePos="1201" Note="判断黑名单" />
		<cell Name="CELL_SQL" Pos="7" ConnStr="Provider=SQLOLEDB.1;Password=800100;Persist Security Info=True;User ID=sa;Initial Catalog=CallCenter_ZYKJ2;Data Source=192.168.4.18" 
		SqlStr="update T_Call_CallRecords set CallState=1,DealType=1,IsDeal=1 where CallId='%[CallID]'" IsSaved="no" SuccessPos="26" FailPos="26" Note="黑名单通话记录" />
		
		<cell Name="CELL_AUDIODTMF" Pos="12" PlayType="2" ContentType="1" Content="D:\Midware\wav\欢迎词.wav" TTSNumMode="1" TTSSpeed="50" TTSVolume="50" 
		TTSEngine="0" StopWhenDtmf="2" MaxKeyCount="1" KeyPressInterval="0" FinishKey="#" KeyVar="" SuccessPos="8" FailPos="24" HangupPos="24" Note="放欢迎词" />
		<!--
			1.播放欢迎词-2.判断是否下班 是直接转入坐席，不是继续播报
		-->
		<!--
		<cell Name="CELL_SQL" Pos="8" ConnStr="Provider=SQLOLEDB.1;Password=hykj800100;Persist Security Info=True;User ID=sa;Initial Catalog=CallCenter_ZXZBNew;Data Source=192.168.4.18" 
		SqlStr="SELECT count(*) FROM T_Sys_WorkCalendar WHERE getdate() between F_DateId and DATEADD(dd,1,F_DateId) AND F_WorkingFlag=1 AND Convert(varchar(20),getdate(),108)&gt;=Convert(varchar(20),'07:30:00',108) and Convert(varchar(20),getdate(),108)&lt;=Convert(varchar(20),'18:30:00',108)" 
		IsSaved="yes" SuccessPos="9" FailPos="603" Note="节假日查询" />
		<cell Name="CELL_RECORDSET" Pos="9" LPos="10" EPos="10" GPos="10" Note="取节假日结果">
			<Map Var="HolidayVerify" />
		</cell>
		<cell Name="CELL_COMPARE" Pos="10" Data1Type="2" Data2Type="1" Data3Type="1" Data1="HolidayVerify" Data2="0" Data3="" VarType="1" CompareType="2" TruePos="603" FalsePos="11" Note="判断节假日" />
		<cell Name="CELL_AUDIODTMF" Pos="11" PlayType="1" ContentType="1" Content="D:\Midware\wav\假期提示音.wav" TTSNumMode="1" TTSSpeed="50" TTSVolume="50" 
		TTSEngine="0" StopWhenDtmf="1" MaxKeyCount="1" KeyPressInterval="3" FinishKey="#" KeyVar="keyh" SuccessPos="24" FailPos="24" HangupPos="24" Note="放节假日音" />
		-->
		<!--根据不同的被叫号码获取对应的欢迎词-->
		<cell Name="CELL_SQL" Pos="1201" ConnStr="Provider=SQLOLEDB.1;Password=800100;Persist Security Info=True;User ID=sa;Initial Catalog=CallCenter_ZYKJ2;Data Source=192.168.4.18" 
		SqlStr=" exec GetWelcomesByExtNo '%[CalleeID]'   " IsSaved="yes" SuccessPos="1202" FailPos="1202" Note="获取分机号对应的欢迎词文本" />
		<cell Name="CELL_RECORDSET" Pos="1202" LPos="1203" EPos="1203" GPos="1203" Note="获取欢迎词文本">
			<Map Var="ivrwords" />
		</cell>
		<cell Name="CELL_AUDIODTMF" Pos="1203" PlayType="2" ContentType="2" Content=" `vs40 您好,欢迎致电 `dig`vs30 %[ivrwords] `vs50 ." TTSNumMode="1" TTSSpeed="50" TTSVolume="50" TTSEngine="0" StopWhenDtmf="2" MaxKeyCount="1" KeyPressInterval="0" FinishKey="#" KeyVar="" SuccessPos="603" FailPos="24" HangupPos="24" Note="播报欢迎词文本" />
		<!--根据不同的被叫号码获取对应的欢迎词-->
		
		<!--通过按键值 拨打相应的坐席组-->
		<cell Name="CELL_AUDIODTMF" Pos="601" PlayType="1" ContentType="1" Content=" D:\Midware\wav\主菜单.wav" TTSNumMode="1" 
		TTSSpeed="50" TTSVolume="50" TTSEngine="0" StopWhenDtmf="1" MaxKeyCount="1" KeyPressInterval="3" FinishKey="#" KeyVar="KeyGroup" SuccessPos="602" FailPos="24" HangupPos="24" Note="依据按键值拨打坐席组导航语音" />
		<cell   Name="CELL_BRANCH"  Pos="602" Var="KeyGroup" DefaultPos="601" Note="依据按键值拨打坐席组导航语音-比较按键值" >
			<Branch   Pos="603" Value="1" /><!--1.咨询-->
			<Branch   Pos="603" Value="2" /><!--2.预约-->
			<Branch   Pos="603" Value="3" /><!--3.救援-->
			<Branch   Pos="603" Value="4" /><!--4.投诉-->
		</cell>
		
		<cell Name="CELL_SQL" Pos="603" ConnStr="Provider=SQLOLEDB.1;Password=800100;Persist Security Info=True;User ID=sa;Initial Catalog=CallCenter_ZYKJ2;Data Source=192.168.4.18" 
		SqlStr="select top 1 F_ZXZID from T_Sys_SeatGroup where F_ZXZCode='ZXZ'" 
		IsSaved="yes" SuccessPos="604" FailPos="24" Note="获取坐席组ID" />
		<cell Name="CELL_RECORDSET" Pos="604" LPos="501" EPos="501" GPos="501" Note="获取坐席组ID结果">
			<Map Var="GroupID" />
		</cell>
		
		<cell Name="CELL_SQL" Pos="501" ConnStr="Provider=SQLOLEDB.1;Password=800100;Persist Security Info=True;User ID=sa;Initial Catalog=CallCenter_ZYKJ2;Data Source=192.168.4.18" 
		SqlStr=" update T_Call_CallRecords set BusinessType=%[KeyGroup], WaitStartTime=GETDATE() where callid='%[CallID]' " IsSaved="no" SuccessPos="13" FailPos="13" 
		Note="更新排队开始时间" />
		
	
		
		<!--坐席排队时，没有登录坐席或无空闲直接转值班电话，无空闲坐席转坐席全忙放音，有空闲坐席继续播报-->
		<cell Name="CELL_QUEUE" Pos="13" Strategy="11" VipLevelType="1" VipLevel="0" GroupType="2" Group="GroupID" AgentVar="AgentNo" ExtenVar="AgentExtNo" 
		NoAgentPos="502" NoFreePos="502" SuccessPos="18" HangupPos="24" Note="排队节点" />
		<!-- <cell Name="CELL_RECORDSET" Pos="505" LPos="502" EPos="502" GPos="502" Note="取AgentNo"> -->
			<!-- <Map Var="CallID" /> -->
		<!-- </cell> -->
		<cell Name="CELL_SQL" Pos="502" ConnStr="Provider=SQLOLEDB.1;Password=800100;Persist Security Info=True;User ID=sa;Initial Catalog=CallCenter_ZYKJ2;Data Source=192.168.4.18" 
		SqlStr=" exec GetCallForwarding '%[CalleeID]'   " IsSaved="yes" SuccessPos="503" FailPos="503" Note="获取分机号对应的手机号码" />
		<cell Name="CELL_RECORDSET" Pos="503" LPos="506" EPos="506" GPos="506" Note="获取转接手机号码">
			<Map Var="iscall" />
			<Map Var="AgentTel" />
		</cell>
		<cell Name="CELL_COMPARE" Pos="506" Data1Type="2" Data2Type="1" Data3Type="1" Data1="iscall" Data2="0" Data3="" VarType="1" CompareType="1" TruePos="14" FalsePos="507" Note="判断是否开启值班电话" />
		<cell Name="CELL_COMPARE" Pos="507" Data1Type="2" Data2Type="1" Data3Type="1" Data1="AgentTel" Data2="" Data3="" VarType="3" CompareType="1" TruePos="14" FalsePos="509" Note="判断是否有值班电话" />
		<cell Name="CELL_TRANSFEROUT" Pos="509" CalleeNumType="2" CalleeNum="AgentTel" Timeout="60" SuccessPos="25" FailPos="14" Note="转值班电话" />
		
		<!--坐席排队时，没有登录坐席直接转值班电话，无空闲坐席转坐席全忙放音，有空闲坐席继续播报-->
		<!-- <cell Name="CELL_QUEUE" Pos="13" Strategy="11" VipLevelType="1" VipLevel="0" GroupType="2" Group="GroupID" AgentVar="AgentNo" ExtenVar="AgentExtNo"  -->
		<!-- NoAgentPos="14" NoFreePos="14" SuccessPos="18" HangupPos="24" Note="排队节点" /> -->
		
		<cell Name="CELL_AUDIODTMF" Pos="14" PlayType="1" ContentType="1" Content="D:\Midware\wav\坐席全忙.wav" TTSNumMode="1" TTSSpeed="50" TTSVolume="50" 
		TTSEngine="0" StopWhenDtmf="1" MaxKeyCount="1" KeyPressInterval="3" FinishKey="#" KeyVar="Key" SuccessPos="15" FailPos="24" HangupPos="24" Note="坐席全忙放音" />
		<cell Name="CELL_BRANCH" Pos="15" Var="Key" DefaultPos="14" Note="分支节点">
			<Branch Value="1" Pos="16" />
			<!--<Branch Value="2" Pos="29" />-->
		</cell>		
		<cell Name="CELL_CONTINUEQUEUE" Pos="16" Agent="AgentNo" Exten="AgentExtNo" Audio="D:\Midware\wav\保持音.wav" Timeout="60" SuccessPos="18" HangupPos="24" TimeoutPos="14" Note="继续排队节点" />
		<cell Name="CELL_CANCELQUEUE" Pos="17" Reason="等烦了" Next="24" Note="放弃排队节点" />		
		<cell Name="CELL_AUDIODTMF" Pos="18" PlayType="2" ContentType="1" Content="D:\Midware\wav\通话录音提示音.wav" TTSNumMode="1" 
		TTSSpeed="50" TTSVolume="50" TTSEngine="0" StopWhenDtmf="2" MaxKeyCount="1" KeyPressInterval="0" FinishKey="#" KeyVar="" SuccessPos="31" FailPos="24" HangupPos="24" Note="转接电话提示录音" />
		<cell Name="CELL_AUDIODTMF" Pos="31" PlayType="2" ContentType="2" Content=" `vs40 您好,欢迎致电 `dig`vs30 %[ivrwords] `vs50 , `dig`vs30 %[AgentNo] `vs50 号话务员为您服务." TTSNumMode="1" TTSSpeed="50" TTSVolume="50" TTSEngine="0" StopWhenDtmf="2" MaxKeyCount="1" KeyPressInterval="0" FinishKey="#" KeyVar="" SuccessPos="19" FailPos="24" HangupPos="24" Note="播报工号" />
		<cell Name="CELL_TURNAGENT" Pos="19" Exten="AgentExtNo" SuccessPos="25" FailPos="17" HangupPos="24" Note="转座席节点">
		  <BandData Var="CallID" />
		</cell>
		<cell Name="CELL_AUDIODTMF" Pos="20" PlayType="2" ContentType="1" Content="D:\Midware\wav\留言提示音.wav" TTSNumMode="1" TTSSpeed="50" TTSVolume="50" 
		TTSEngine="0" StopWhenDtmf="2" MaxKeyCount="1" KeyPressInterval="3" FinishKey="#" KeyVar="" SuccessPos="21" FailPos="24" HangupPos="24" Note="留言开始放音" />
		<cell Name="CELL_LEAVEWORD" Pos="21" Path="%[CallID]_%[CallerID]_%[StartTime].wav" FinishKey="#" Timeout="60" TimeoutPos="22" HangupPos="23" FinishPos="22" Note="留言节点" />
		<cell Name="CELL_AUDIODTMF" Pos="22" PlayType="2" ContentType="1" Content="D:\Midware\wav\留言结束提示音.wav" TTSNumMode="1" TTSSpeed="50" TTSVolume="50" 
		TTSEngine="0" StopWhenDtmf="2" MaxKeyCount="1" KeyPressInterval="3" FinishKey="#" KeyVar="" SuccessPos="23" FailPos="23" HangupPos="23" Note="留言结束放音" />
		<cell Name="CELL_SQL" Pos="23" ConnStr="Provider=SQLOLEDB.1;Password=800100;Persist Security Info=True;User ID=sa;Initial Catalog=CallCenter_ZYKJ2;Data Source=192.168.4.18" 
		SqlStr="INSERT INTO T_Call_LeaveRecord(F_CallId,F_Phone,F_LeaveTime,F_Status,F_RecFileUrl) VALUES('%[CallID]','%[CallerID]',GETDATE(),0,'%[CallID]_%[CallerID]_%[StartTime].wav')" IsSaved="no" 
		SuccessPos="24" FailPos="24" Note="留言入库" />
		<cell Name="CELL_HANGUP" Pos="24" Next="25" Note="挂机节点" />
		<cell Name="CELL_END" Pos="25" Note="结束节点" />	
		
		<!--黑名单提示音-->
		<cell Name="CELL_AUDIODTMF" Pos="26" PlayType="2" ContentType="1" Content="D:\Midware\wav\黑名单提示音.wav" TTSNumMode="1" TTSSpeed="50" TTSVolume="50" 
		TTSEngine="0" StopWhenDtmf="2" MaxKeyCount="1" KeyPressInterval="3" FinishKey="#" KeyVar="" SuccessPos="25" FailPos="24" HangupPos="24" Note="黑名单提示音" />
		<!--黑名单提示音-->
		
		<!--转值班电话-->
		<cell   Name="CELL_BRANCH"  Pos="28" Var="keyh" DefaultPos="14" Note="是否转值班电话-比较按键值" >
			<Branch   Pos="29" Value="1" />
		</cell>
		<cell Name="CELL_AUDIODTMF" Pos="29" PlayType="2" ContentType="1" Content="D:\Midware\wav\转值班电话提示.wav" TTSNumMode="1" TTSSpeed="50" TTSVolume="50" 
		TTSEngine="0" StopWhenDtmf="2" MaxKeyCount="1" KeyPressInterval="0" FinishKey="#" KeyVar="" SuccessPos="701" FailPos="24" HangupPos="24" Note="转值班电话提示音" />
		<cell Name="CELL_SQL" Pos="701" ConnStr="Provider=SQLOLEDB.1;Password=800100;Persist Security Info=True;User ID=sa;Initial Catalog=CallCenter_ZYKJ2;Data Source=192.168.4.18" SqlStr="EXEC proc_HR_ZZBDH " IsSaved="yes" SuccessPos="702" FailPos="24" Note="获取值班电话" />
		<cell Name="CELL_RECORDSET" Pos="702" LPos="30" EPos="30" GPos="30" Note="获取值班电话结果">
			<Map Var="zbdh" />
		</cell>
		<cell Name="CELL_TRANSFEROUT" Pos="30" CalleeNumType="2" CalleeNum="zbdh" Timeout="60" SuccessPos="25" FailPos="24" Note="转值班电话" />
		<!--转值班电话-->
	</flow>		
</ivr>