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

📄 avoice.c

📁 asterisk c-agi 提供c 语言接口的例子
💻 C
字号:
#include "acard.h"


ACARD_Voice_List acardVoiceList;

int initACARDVoiceList(AGI_TOOLS agi,MYSQL mysql,ACARD_Caller_Info *acinfo)
{
	MYSQL_RES *result;
	MYSQL_ROW row;
	char sqlstr[200];

	sprintf(sqlstr,"select * from T_VoiceFile");
	mysql_query(&mysql,sqlstr);
	result=mysql_store_result(&mysql);
	acardVoiceList.num=0;
	while((row=mysql_fetch_row(result)))
	{
		if(acardVoiceList.num<MAX_VOICE_NUM)
		{
			acardVoiceList.acardVoiceList[acardVoiceList.num].type
				=atoi(row[0]);
			acardVoiceList.acardVoiceList[acardVoiceList.num].language_type
				=atoi(row[1]);
			sprintf(acardVoiceList.acardVoiceList[acardVoiceList.num].filename,
				row[2]);
			sprintf(acardVoiceList.acardVoiceList[acardVoiceList.num].descrp,
				row[3]);
			acardVoiceList.num++;
		}
	}
	mysql_free_result(result);
	sprintf(sqlstr,"VOICE NUM %d",acardVoiceList.num);
	printDebugInfo(agi,DEBUG_INFO_INFO,acinfo,sqlstr);
	return 0;
}

int getVoiceFileName(AGI_TOOLS agi,ACARD_Caller_Info *acinfo,int v_type,int l_type,char *filename)
{
	int i;
	char msgstr[200];
	for(i=0;i<acardVoiceList.num;i++)
	{
		if(acardVoiceList.acardVoiceList[i].type==v_type&&
			acardVoiceList.acardVoiceList[i].language_type==l_type)
		{
			sprintf(filename,acardVoiceList.acardVoiceList[i].filename);
			return 0;
		}
	}
	sprintf(msgstr,"VOice not Exists-VType-%d,LType-%d",v_type,l_type);
	printDebugInfo(agi,DEBUG_INFO_ERROR,acinfo,msgstr);
	return 1;
}

int getUserInput(AGI_TOOLS agi,ACARD_Caller_Info *acinfo,char *vfname,
				 int timeout,int maxdigits,int trynum)
{
	AGI_CMD_RESULT res;
	int i=0;

	while(i<trynum)
	{
		AGITool_get_data(&agi,&res,vfname,timeout,maxdigits);
		
		if(strlen(res.result)==0)
		{
		}
	}
}

⌨️ 快捷键说明

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