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

📄 song.sff

📁 使用flex和bison
💻 SFF
字号:
string menukey;
string songkey;
string songfile;
string songmenu;
string sql;
string phone;
string leavefile;
int menutime = 50;
int songtime = 50;
int connid=2;
int sysconnid = 1;
int isbaoyueuser = 0;
string myfile;
string dialoutflow = "1";
#测试是不是联通号码
state m_1_callertest 
{
	init
	{
		string mystr =  getsubstring($sys_caller,0,3);
		int myint = stoi(mystr);
		if(myint>=130)
		{
			if(myint<=133)
			{
				goto m_1_start;
			}
			else
			{
				hangup();
			}
		}
		else
		{
			hangup();
		}
	}

}
#流程开始

state m_1_start 
{
	init
	{
		sql=  "select id,flag,mobile,regtime from taga_talkin_song_baoyueuser "
				+"where flag = 1 and mobile = '" + $sys_caller+"'";
		sqlselect(connid,sql);
		int ret = getaffectedrow();
		if(ret==0)
		{
			goto 	m_1_songbaoyue;
		}
		else
		{	
			goto 	m_1_sendsong;	
		}
	}
	
}
#包月注册
state m_1_songbaoyue
{
	init
	{
		#1号键确定 2号键单曲点送
		playfile("d:\lgh\bin\trasin\10156\myvoc\songbaoyue.pcm",2);
		readdigits(1);
		setchantimer(menutime);
		
	}
	proc
	{
		switch($sys_dtmf)
		{			
		 	case "1":	
				sql=   "select * from taga_talkin_song_baoyueuser where  mobile = '"+$sys_caller+"'";
				sqlselect(connid,sql);
				int ret = getaffectedrow();
				#曾经注销过的用户
				if(ret==1)
				{
					sql= "update taga_talkin_song_baoyueuser set flag = 1 where mobile = '" 
					     +$sys_caller+"'";	
				}
				else
				{
					#新用户包月
					sql="insert into taga_talkin_song_baoyueuser(mobile,regtime,type,flag) values ('" +$sys_caller+"', getdate(),1,1)" ; 
					               
				}
				sqlcommand(connid,sql);
				isbaoyueuser = 1;
				goto m_1_sendsong;
			break;
			case "2":
				isbaoyueuser = 0;
				goto m_1_sendsong;
			break;
			default:
				goto m_1_songbaoyue;
			break;
		}
	}
}

state m_1_sendsong
{
	init
	{
		# 1-8号键点歌 9号键 按编号查询 0号键取消包月
		playfile("d:\lgh\bin\trasin\10156\myvoc\songmenu.pcm",2);
		readdigits(1);
		setchantimer(menutime);
	}
	proc
	{
		sf($sys_dtmf=="0")
		{
			sql= "update taga_talkin_song_baoyueuser set flag = 2 ,logouttime = getdate() where  mobile = '"
			     +$sys_caller+"'";
			sqlcommand(connid,sql);
			goto m_1_quxiaobaoyue;
		}
		elsesf($sys_dtmf=="9")
		{
			goto m_1_singlesong;
		}
		else
		{
			menukey=$sys_dtmf;		
			goto m_1_songmenu;
		}
	}
}
state m_1_quxiaobaoyue
{
	init
	{
		# 取消包月成功,谢谢你的使用
		playfile("d:\lgh\bin\trasin\10156\myvoc\diangequxiaoqueding.pcm",2);
	
	}
	proc
	{
		#挂机
		hangup();
	}
}
state m_1_singlesong
{
	init
	{
		# 请输入编号
		playfile("d:\lgh\bin\trasin\10156\myvoc\inputbynum.pcm",2);
		readdigits(4);
		setchantimer(menutime);
		
	}
	proc
	{
		songkey = $sys_dtmf;

		myfile = "d:\lgh\bin\trasin\10156\musicfile\song"+songkey+".pcm";
		int i = findfile(myfile);
		if(i ==1)
		{
			goto m_2_find;
		}
		else
		{
			goto m_2_nofind;
		}
	}
}
state m_2_nofind
{
    init
	{
		# 您输入编号未找到,请重新输入
		playfile("d:\lgh\bin\trasin\10156\myvoc\reinputbynum.pcm",2);
		readdigits(4);
		setchantimer(menutime);
	}
	proc
	{
		songkey = $sys_dtmf;

		myfile = "d:\lgh\bin\trasin\10156\musicfile\song"+songkey+".pcm";
		int i = findfile(myfile);
		if(i ==1)
		{
			goto m_2_find;
		}
		else
		{
			goto m_2_nofind;
		}

	}
}
state m_2_find
{
    init
	{
		playfile(myfile,2);
		readdigits(1);
		setchantimer(menutime);
	}
	proc
	{
		goto m_1_listen;
	}
}


state m_1_songmenu
{
	init
	{
		songmenu="d:\lgh\bin\trasin\10156\myvoc\songmenu";
		songmenu=songmenu+menukey+".pcm";
		playfile(songmenu,2);
		readdigits(1);
		setchantimer(menutime);
		
	}
	proc
	{
		switch($sys_dtmf)
		{
			case "*":
				goto m_1_sendsong;
			break;
			default:
				songkey=$sys_dtmf;
				sql="select songfile from taga_talkin_song_config where menukey = '"+
				menukey + "' and songkey = '"
				+ songkey +"'";
				sqlselect(connid,sql);
				int i = getaffectedrow();
				songfile = getfieldvalue(0);
				if(i==0)
				{
					goto m_2_nofind;
				}
				else
				{
					goto m_1_listen;
				}

			break;
		}
			
	}
	
}
state m_1_listen
{
	init
	{
		#1 电送2 视听 ×返回
		playfile("d:\lgh\bin\trasin\10156\myvoc\listen.pcm",2);
		readdigits(1);
		setchantimer(menutime);
		
	}
	proc
	{
		switch($sys_dtmf)
		{
			case "1":
				goto m_1_songsend;
			break;
			case "*":
				goto m_1_songmenu;
			break;
			default:
				goto m_1_listening;
			break;	
		}	
	}
}
state m_1_listening
{
	init
	{
		#不要放取键函数,放songtime秒就跳到proc 如果放了取键函数,songtime秒后重新播放
		playfile(songfile,2);
		setchantimer(songtime);
	}
	proc
	{
		goto m_1_listen;
	}
}

state m_1_songsend
{
	init
	{
		playfile("d:\lgh\bin\trasin\10156\myvoc\input.pcm",2);
		readdigits(13);	
	}
	proc
	{
		phone = $sys_dtmf;
		goto m_1_confirm;
	}
}

state m_1_confirm
{
	init
	{
		playfile("d:\lgh\bin\trasin\10156\myvoc\number.pcm",2);			
	}
	proc
	{	
		goto m_1_confirmnext;
	}
}

state m_1_confirmnext
{
	init
	{
		playfile(phone,1);	
	}
	proc
	{
		goto m_1_sure;
	}
}
state m_1_sure
{
	init
	{	
		playfile("d:\lgh\bin\trasin\10156\myvoc\sure.pcm",2);
		readdigits(1);	
	}
	proc
	{
		switch($sys_dtmf)
		{
			case "1":
				goto m_1_leave;
			break;
			case "2":
				goto m_1_songsend;
			break;
			default:
				goto m_1_sure;
			break;
		}
	}
}

state m_1_leave
{
	init
	{
		#需要给对方留言么,留言请按1,结束点波请按2
		playfile("d:\lgh\bin\trasin\10156\myvoc\leave.pcm",2);
		readdigits(1);
		setchantimer(menutime);
	}
	proc
	{
		sf($sys_dtmf=="1")
		{
			goto m_1_leavep;
		}
		elsesf($sys_dtmf=="2")
		{
		
			sql="insert into taga_talkin_musicsendinfo(callermobile,calledmobile,accessno,companyid,dialoutid,songfile," 
				+ "dialtime,dialcount,flag) values('" 
				+ $sys_caller
				+ "' ,'"
				+ phone
				+ "' ,'"
				+ $sys_callee
				+ "',1,"
				+ dialoutflow 
				+ ",'" 
				+ songfile 
				+ "',getdate(),0,0)";                
			sqlcommand(sysconnid,sql);
			goto m_1_over;
		}
		else
		{
			goto m_1_leave;
		}	
	}
}

state m_1_leavep
{
	init
	{
		#滴声后开始留言,#号键结束
		playfile("d:\lgh\bin\trasin\10156\myvoc\leavep.pcm",2);
	}
	proc
	{
		goto m_1_leaveing;	
	}
}
state m_1_leaveing
{
	init
	{
		string s = getnowtime();
		string t = itos($sys_channo);
		leavefile ="d:\lgh\bin\trasin\10156\recfile\" + s + t + ".pcm";
		recfile(leavefile,1);
	}
	proc
	{

		sql="insert into taga_talkin_musicsendinfo(callermobile,calledmobile,accessno,companyid,dialoutid,songfile," 
				+ "dialtime,leaveword,dialcount,flag) values('" 
				+ $sys_caller
				+ "' ,'"
				+ phone
				+ "' ,'"
				+ $sys_callee
				+ "',1,"
				+ dialoutflow 
				+ ",'" 
				+ songfile 
				+ "',getdate(), '" 
				+ leavefile 
				+ "' ,0,0)";                
			sqlcommand(sysconnid,sql);               
		sqlcommand(sysconnid,sql);
		goto m_1_over;
	}
}


state m_1_over
{
	init
	{
		playfile("d:\lgh\bin\trasin\10156\myvoc\success.pcm",2);
	}
	proc
	{
		goto m_1_sendsong;
	}
}


state hangupproc
{
    init 
	{
		sql="insert taga_talkin_log(caller,callee,hanguptime ) values( '" 
		+ $sys_caller+"','"
		+ $sys_callee+"' ,getdate() )";
		sqlcommand(connid,sql);
	
	}	
}

⌨️ 快捷键说明

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