// функция звонок @SuppressWarnings("static-access") public static void Call(final String num) { CallFrame CallFrame = new CallFrame(); CallFrame.HoldIfNotActive(); Redial = num; PrintWriter writer = MainFrame.TelnetWriter(); writer.print("Action: Originate\r\n"); writer.print("Channel: SIP/" + MainExtension + "\r\n"); writer.print("Exten: " + num + "\r\n"); writer.print("Context: " + Context + "\r\n"); writer.print("Priority: 1\r\n"); writer.print("CallerId: phone<" + num + ">\r\n"); writer.print("Async: yes\r\n\r\n"); writer.flush(); CallFrame.removeFromList(CallFrame); CallFrame.dispose(); // для последовательного вывод на экран CallFrames MainFrame.xLocationForCallFrame -= 450; // остановка главного потока на 1300 миллисекунд, чтобы поток Asterisk смог обработать команды CallButton.setEnabled(false); try { Thread.sleep(600); } catch (InterruptedException e) { } new CallButtonTrue().start(); CallFrame.MakeFramesNotEnable(false); new CallFramesTrue().start(); }
@Override public void run(Object thisPointer, CallFrame callingFrame) { System.out.println("Method " + self.getName() + " was called."); // setup call frame CallFrame callFrame = self.metaCreateCallFrame(); callFrame.setCallingFrame(callFrame); callFrame.setThis(thisPointer); if (self.getScope() == Scope.MEMBER && callFrame.getThis() == null) { throw new ModelException("Member variable without this pointer."); } for (Variable localVar : self.getVariable()) { callFrame.getLocalVariable().add(localVar.metaCreateSlot()); } // run body for (Statement statement : self.getBody()) { if (statement instanceof Assignment) { callFrame .slotForVariable(((Assignment) statement).getAssignTo()) .setValue(((Assignment) statement).getAssignWith().evaluate(callFrame)); } else if (statement instanceof MethodCall) { Method method = ((MethodCall) statement).getCalledMethod(); if (method.getScope() == Scope.MEMBER) { method.run(((MethodCall) statement).getTarget().evaluate(callFrame), callFrame); } } } // destroy call frame for (Slot slot : new ListImpl<Slot>((callFrame.getLocalVariable()))) { slot.metaDelete(); } callFrame.metaDelete(); }
public void cmdProc( Interp interp, // Current interpreter. TclObject argv[]) // Argument list. throws TclException // Standard Tcl exception. { // Create the call frame and parameter bindings CallFrame frame = interp.newCallFrame(this, argv); // Execute the body interp.pushDebugStack(srcFileName, srcLineNumber); try { Parser.eval2(interp, body.array, body.index, body_length, 0); } catch (TclException e) { int code = e.getCompletionCode(); if (code == TCL.RETURN) { int realCode = interp.updateReturnInfo(); if (realCode != TCL.OK) { e.setCompletionCode(realCode); throw e; } } else if (code == TCL.ERROR) { if (this.isLambda()) { TclObject name = TclList.newInstance(); TclList.append(interp, name, argv, 0, 2); interp.addErrorInfo( "\n (lambda term \"" + name.toString() + "\" line " + interp.errorLine + ")"); } else { interp.addErrorInfo( "\n (procedure \"" + argv[0] + "\" line " + interp.errorLine + ")"); } throw e; } else if (code == TCL.BREAK) { throw new TclException(interp, "invoked \"break\" outside of a loop"); } else if (code == TCL.CONTINUE) { throw new TclException(interp, "invoked \"continue\" outside of a loop"); } else { throw e; } } finally { interp.popDebugStack(); // The check below is a hack. The problem is that there // could be unset traces on the variables, which cause // scripts to be evaluated. This will clear the // errInProgress flag, losing stack trace information if // the procedure was exiting with an error. The code // below preserves the flag. Unfortunately, that isn't // really enough: we really should preserve the errorInfo // variable too (otherwise a nested error in the trace // script will trash errorInfo). What's really needed is // a general-purpose mechanism for saving and restoring // interpreter state. if (interp.errInProgress) { frame.dispose(); interp.errInProgress = true; } else { frame.dispose(); } } }