void ResultNode::ResetLine(int LineNo,Channel &channel) { if( channel.nType == CHTYPE_TRUNK ) { FeedPower(channel.ConnectToLine); HangUp(LineNo); Sig_ResetCheck(LineNo); StartSigCheck(LineNo); } else if( channel.nType == CHTYPE_USER ) { } InitDtmfBuf(LineNo); channel.UsableFlag = TRUE; channel.ConnectToLine = -1; channel.State = CH_FREE; channel.TelLength = 0; channel.DTMFCode[0] = NULL; channel.nTimeElapse = 0; playCount = 0; state = CH_RESULT; bFlag1 = FALSE; bFlag2 = FALSE; //дÈÕÖ¾ CTime tm; CString strTime; tm=CTime::GetCurrentTime(); strTime = tm.Format(_T("%Y-%m-%d %X")); myXml.insertTextToLogItem(channel.strItemId,strTime,_T("EndTime"),channel.ctStartTime); }
void RunFax(void) { extern char *FaxString; if (FaxString != NULL) { printf("Fax detected, running %s\n", FaxString); CitSystem(TRUE, "%s", FaxString); HangUp(TRUE); /* yeah, TRUE */ } }
/* * DoTimeouts() * * This is the function responsible for actual checking of timeouts. It * returns TRUE if you want modIn to break out, too. It should only be called * from modIn(). */ char DoTimeouts() { int yr, dy, hr, mn, temp, mon, secs, milli; static char warned = FALSE; #ifdef SYSTEM_CLOCK static int LastMinute = -1; #endif static int LastDay = 0; extern int PriorityMail; TwoNumbers *tmp; EvDoorRec *evtmp; extern SListBase UntilNetSessions; void Activate(); char Oldpage; getRawDate(&yr, &mon, &dy, &hr, &mn, &secs, &milli); #ifdef SYSTEM_CLOCK if (LastMinute != mn) { ScrTimeUpdate(hr, mn); LastMinute = mn; } #endif if (LastDay != dy) { LastDay = dy; RunListA(&DayBased, Activate, (void *) &LastDay); } ThisMinute = (WhatDay() * 1440) + (hr * 60) + mn; ThisAbsolute = (long) ThisMinute; ThisSecond = ThisAbsolute * 60 + secs; ThisAbsolute = CurAbsolute(); /* First we deal with events which are deactivating */ if ((tmp = GetFirst(&EventEnds)) != NULL) { if (ThisAbsolute >= tmp->second) { /* event is ending! */ ClassActive[tmp->first] = FALSE; KillData(&EventEnds, tmp); /* take it off the list */ if (tmp->first == CL_DL_TIME) ResolveDLStuff(); } } if ((evtmp = GetFirst(&AutoDoors)) != NULL) { if (ThisAbsolute >= evtmp->finish) { /* autodoor finish */ KillData(&AutoDoors, evtmp); } } if ((evtmp = GetFirst(&Redirected)) != NULL) { if (ThisAbsolute >= evtmp->finish) { /* redirection finish */ KillData(&Redirected, evtmp); } } /* Next we deal with preemptive events, which are Type 0 */ /* give a warning at T-5 */ if ((Cur = GetFirst(&Types[0].List)) != NULL && !warned && Types[0].NextAbs - ThisAbsolute < 300l && onLine()) { temp = Cur->EvMinutes % 1440; warned = TRUE; outFlag = IMPERVIOUS; Oldpage = Pageable; Pageable = FALSE; mPrintf("\n %cWARNING: System going down at %d:%02d for %s.\n ", BELL, temp/60, temp%60, Cur->EvWarn + cfg.codeBuf); outFlag = OUTOK; Pageable = Oldpage; return FALSE; } else if (Cur != NULL && Types[0].NextAbs < ThisAbsolute) { if (onLine()) { /* first boot off user, next time do event */ outFlag = IMPERVIOUS; PagingOff(); mPrintf("\n %cGoing to %s, bye!\n ", BELL, Cur->EvWarn + cfg.codeBuf); if (onConsole) { /* Ugly cheat */ onConsole = FALSE; whichIO = MODEM; justLostCarrier = TRUE; EnableModem(FALSE); } else HangUp(FALSE); outFlag = OUTOK; return TRUE; } warned = FALSE; return FigureEvent(0); } if (!onLine() && (Cur = GetFirst(&Types[1].List)) != NULL && Types[1].NextAbs < ThisAbsolute) return FigureEvent(1); if ((Cur = GetFirst(&Types[2].List)) != NULL && Types[2].NextAbs < ThisAbsolute) return FigureEvent(2); /* check priority mail -- odd place for the check, but wotthehell */ if (PriorityMail) { if (!onLine()) { netController((hr*60) + mn, 0, PRIORITY_MAIL, ANYTIME_NET, 0); PriorityMail = 0; } } /* handle anytime netting here - is special type of thing */ if (chkTimeSince(NEXT_ANYNET) > DeadTime || ForceNet) { if (ClassActive[CL_ANYTIME_NET]) { if (!onLine()) { netController((hr * 60) + mn, AnyNetLen, AnyTimeNets, ANYTIME_NET, 0); ScrNewUser(); ForceNet = FALSE; } } else ForceNet = FALSE; startTimer(NEXT_ANYNET); } /* * now see if we have any other net sessions due to be run. These are * sessions scheduled by the user from the Net menu. If so, run each of * them by killing the list (the kill function should run each). */ if (!onLine() && GetFirst(&UntilNetSessions) != NULL) { KillList(&UntilNetSessions); } return ExitToMsdos; }
PRIVATE void talk () { char *line; char *machine; int connection; int code; int value; access *Data; unsigned short port; Data = (access *) space (sizeof (access)); printf ("enter machine to connect to (return if same as caller)\n"); line = get_line (stdin); if (*line == '\0') { machine = NULL; free (line); } else machine = line; printf ("enter port number (return if 5000)\n"); line = get_line (stdin); if (*line == '\0') port = 5000; else sscanf (line, "%u", port); free (line); while (TRUE) { if ((connection = DialServer (machine, port)) > 0) { system ("clear"); while (CheckForData (connection, Data, sizeof (access)) <= 0); show_options (Data); line = get_line (stdin); if (*line == '\0') { Send (connection, Data, sizeof (access)); free (line); } else if (*line == '\\') { Data->ctrl = -1; if ((connection = DialServer (machine, port)) > 0) Send (connection, Data, sizeof (access)); HangUp (connection); free (line); free (machine); exit (0); } else { sscanf (line, "%d %d", &code, &value); switch (code) { case 0: if (value == 2) { printf ("re-read parameters? (y/n) [y]\n"); line = get_line (stdin); if (!(*line == 'y' || *line == '\0')) { free (line); Data->ctrl = 1; break; } printf ("input filename [alchemy.inp]\n"); line = get_line (stdin); if (*line == '\0') strcpy (Data->message, "alchemy.inp"); else strcpy (Data->message, line); free (line); } Data->ctrl = value; break; case 1: Data->show = value; break; default: printf ("no such parameter\n"); break; } free (line); Send (connection, Data, sizeof (access)); } } } }