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

📄 methods.cpp

📁 语音接口~语音识别 & 从声音识别到对各种情报的查找/提供 资料请求~住所.姓名.电话号码等的识别接待 受订货业务~被定型化的受订货业务 预约业务~预约情况的向导和预约接
💻 CPP
字号:
// Copyright (C) 2005 Open Source Telecom Corp.//  // This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.// // This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.#include "module.h"namespace binder {using namespace ost;using namespace std;bool Methods::scrJoin(void){	Event event;	state.timeout = 0;	state.join.peer = getSid(var_pid);	state.join.dtmf = false;	if(!state.join.peer)	{		error("peer-missing");		return true;	}		memset(&event, 0, sizeof(event));	event.id = PEER_WAITING;	release();	if(!state.join.peer->postEvent(&event))	{		error("peer-invalid");		return true;	}	peer = state.join.peer;	setState(STATE_JOIN);	return false;}bool Methods::scrStart(void){	Line *line = getLine();	const char *dial = getValue(NULL);	const char *name = getValue(NULL);	const char *caller = getKeyword("caller");	const char *display = getKeyword("display");	Symbol *sym = getKeysymbol("session", 16);	BayonneSession *child;	const char *cp, *id;	char buf[65];	TelTone::tonekey_t *key = NULL;	Audio::Level level = 26000;	if(!stricmp(line->cmd, "connect"))	{		state.timeout = getTimeoutKeyword("timeout");		state.tone.duration = getTimeoutKeyword("duration");		state.tone.dtmf = true;		if(state.timeout && state.timeout != TIMEOUT_INF)		{			if(audio.tone)			{				delete audio.tone;				audio.tone = NULL;			}			cp = getKeyword("tone");			if(cp && !stricmp(cp, "ringback"))				cp = "ring";			if(cp)				key = TelTone::find(cp, Bayonne::server->getLast("location"));			if(key)				audio.tone = new TelTone(key, level, getToneFraming());		}	}		if(!dial || !name)	{		if(sym)			ScriptInterp::commit(sym, "none");		if(!scriptEvent("start:invalid"))			error("start-invalid");		return true;	}	child = startDialing(dial, name, caller, display, this);	if(!child)	{		if(sym)			ScriptInterp::commit(sym, "none");		if(!scriptEvent("start:failed"))			error("start-invalid");		return true;	}	if(sym)		ScriptInterp::commit(sym, child->getExternal("session.id"));	if(!stricmp(line->cmd, "connect"))		strcpy(state.tone.sessionid, child->getExternal("session.id"));	while(NULL != (cp = getOption(NULL)))	{		sym = mapSymbol(cp, 0);		if(!sym)			continue;		id = sym->id;		if(!strchr(id, '.'))		{			snprintf(buf, sizeof(buf), "parent.%s", id);			id = buf;		}		child->setConst(id, sym->data);	}	child->leave();	if(!stricmp(line->cmd, "connect"))	{		setState(STATE_CONNECT);		return false;	}	advance();	return true;}bool Methods::scrStop(void){	Event event;	BayonneSession *s;	const char *cp = getValue(NULL);	if(!cp)	{		error("no-timeslot");		return true;	}	s = getSid(cp);	if(!s)	{		error("invalid-timeslot");		return true;	}	memset(&event, 0, sizeof(event));	event.id = CANCEL_CHILD;	s->queEvent(&event);	advance();	return true;}	bool Methods::scrEndinput(void){	frame[stack].mask &= ~0x08;	state.menu = NULL;	advance();	return false;}bool Methods::scrEndform(void){	if(stack < 1 || stack == frame[stack].base)	{		error("stack-underflow");		return true;	}	if(!frame[stack].line->argc)		goto exit;	if(conditional())		goto exit;	frame[stack].line = frame[stack - 1].line;	frame[stack].tranflag = true;	if(!state.menu)		state.menu = getName();	goto clear;	exit:	frame[stack - 1] = frame[stack];	--stack;	if(stack < state.stack)		state.menu = NULL;			frame[stack].tranflag = false;clear:	*dtmf_digits = 0;	advance();	return false;}bool Methods::scrForm(void){	const char *cp, *value;	Line *line = getLine();	unsigned idx = 0;	if(!push())	{		error("stack-overflow");		return true;	}	if(!state.menu)	{		state.menu = getName();		state.stack = stack;	}	while(idx < line->argc)	{		cp = line->args[idx++];		if(*cp != '=')			continue;                value = getContent(line->args[idx++]);   		if(!value)			continue;		setSymbol(++cp, value);	}	frame[stack].tranflag = true;	*dtmf_digits = 0;	if(!requiresDTMF())		return true;	advance();	return false;}bool Methods::scrDial(void){        unsigned len = 0;        const char *cp;                state.join.answer_timer = state.timeout = getTimeoutKeyword("timeout");                while(NULL != (cp = getValue(NULL)))        {                setString(state.join.digits + len, sizeof(state.join.digits) - len, cp);                len = strlen(state.join.digits);        }        state.join.dial = state.join.digits;        setState(STATE_DIAL);        return false;  }bool Methods::scrKey(void){        const char *cp;        const char *val = getKeyword("value");        const char *ind = getKeyword("index");        Symbol *sym;        while(NULL != (cp = getOption(NULL)))        {                sym = mapSymbol(cp, PersistProperty::getSize());                if(!sym)                        continue;                PersistProperty::refresh(sym, ind, val);        }        advance();               return true;  } } // end namespace

⌨️ 快捷键说明

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