예제 #1
0
//-----------------------------------------------------------------------------
void Phone::sendDTMFDigits(int call_id, const QString &digits)
{
    Call *call = getCall(call_id);
    if (call) {
        call->sendDTMFDigits(digits);
    }
}
예제 #2
0
// must be locked
void CallManager::updateCallState(vector<Translator> &tlist, int client)
{
	vector<unsigned int>calls = findCalls(client);
	for (int i=0; i<tlist.size(); i++) {
		tlist[i].setAwait(false); tlist[i].setConfirmed(false);	tlist[i].setRejected(false);
		for (int j=0; j<calls.size(); j++) {
			PhoneCall *c = dynamic_cast<PhoneCall *>(getCall(calls[j]));
			if (!c)
				continue;
			if (c->getTranslator() == tlist[i].getID()) {
				switch (c->getState()) {
				case INIT:
					break;
				case AWAIT:
					tlist[i].setAwait(true);
					break;
				case CONFIRMED:
					tlist[i].setConfirmed(true);
					break;
				case REJECTED:
					tlist[i].setRejected(true);
					break;
				case ACTIVE:
					break;
				case ERROR:
					tlist[i].setError(true);
					break;
				}
				break;
			}
		}
	}
}
예제 #3
0
// must be write-locked, SessionManager must be read-locked
void CallManager::EndCall(Connection *sqlCon, unsigned int call_id)
{
	Call *call = getCall(call_id);
	if (!call)
		return;
	call->lock();

	//call->sendCallStatuses();

	if (call->tarificate(sqlCon)) {
		log(LOG_FATAL, "Error tarficating call[%d].", call_id);
	}
	call->DBwrite(sqlCon);

	if (call->getState() == ACTIVE || call->getState() == END) {
		if (User::CheckNeedMark(sqlCon, call->getClient(), call->getTranslator())) {
			Session *cs = sManager->findSessionByUser(call->getClient());
			if (cs) {
				struct timeval tv;
				gettimeofday(&tv, 0);
				unsigned long time = tv.tv_sec*1000 + tv.tv_usec/1000;
				cs->sendPacket_MarkRequest(call->getTranslator(), call->getTranslatorName(), time);
			}
		}
	}
	call->unlock();
	log(LOG_VERBOSE, "EndCall[%d->%d]: accounted=%d cost=%d.", call->getClient(), call->getTranslator(),
			call->getAccountedTime(), call->getCost());
	removeCall(call_id);
	delete call;
}
예제 #4
0
파일: SimSphere.cpp 프로젝트: cran/unfoldr
R_Calldata buildRCallSpheres(SEXP R_param,SEXP R_cond) {
  int nprotect=0;
  R_Calldata d = Calloc(1,R_Calldata_s);

  d->call = R_NilValue;
  PROTECT(d->fname = getListElement( R_cond, "rdist")); ++nprotect;
  PROTECT(d->rho   = getListElement( R_cond, "rho"  )); ++nprotect;
  PROTECT(d->args  = getListElement( R_param,"radii")); ++nprotect;
  PROTECT(d->label = getListElement( R_cond, "label"));  ++nprotect;

  /* radii distribution */
  const char *ftype = CHAR(STRING_ELT(d->fname, 0));
  if ( !std::strcmp( ftype, "rlnorm") ||
       !std::strcmp( ftype, "rbeta" ) ||
       !std::strcmp( ftype, "rgamma") ||
       !std::strcmp( ftype, "runif" ) ||
       !std::strcmp( ftype, "const" ))
  {;
  } else {
    PROTECT(d->call = getCall(d->fname,d->args,d->rho)); ++nprotect;
  }
  d->nprotect = nprotect;
  d->isPerfect = asLogical(getListElement( R_cond, "perfect" ));
  return d;
}
예제 #5
0
//-----------------------------------------------------------------------------
void Phone::slotCallState(int call_id, int call_state, int last_status)
{
    Call *call = getCall(call_id);
    if (call) {
        call->setState(call_state);
    }

    if( gui_handler_ )
    {
        gui_handler_->callState(call_id, call_state, last_status);
    }
}
예제 #6
0
gui::CallTab *ViewController::getCallTab(size_t tabId)
{
	if (callTabMap.count(tabId) == 0)
	{
		auto *call = &(getCall(tabId));
		if (callTabType.count(call->type()) == 0)
		{
			throw std::invalid_argument{
				"no such type '" + call->type().toStdString() +
				"'"
			};
		}
		callTabMap[tabId] =
		    callTabType[call->type()](util::makeRef(*call));
	}
	return callTabMap[tabId].get();
}
예제 #7
0
IAXCall*
IAXVoIPLink::getIAXCall(const std::string& id)
{
    return dynamic_cast<IAXCall*>(getCall(id));
}