拨号方案中的星号随机音频

时间:2016-02-19 11:08:51

标签: asterisk

我想设置一个拨号方案,以便在一定时间内播放音频。 例如.. 播放音频文件,说通话时间是一分钟,然后播放另一个文件说明两分钟,然后另一个说十分钟。

1 个答案:

答案 0 :(得分:0)

为此你可以使用转到和功能RAND

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import java.util.ArrayList;
import java.util.Scanner;

public class TwoRectangles extends Application {

    public void start(Stage primaryStage) throws Exception {

        Pane pane = new Pane();
        double width = 400;
        double height = 400;

        ArrayList<Rectangle> rectangles = new ArrayList<>();
        Scanner input = new Scanner(System.in);

        for (int i = 1; i <= 2; i++) {
            System.out.print("Enter (x, y) of center, width, and height or rec " + i + ": ");
            Rectangle temp = new Rectangle(input.nextDouble(), input.nextDouble(), input.nextDouble(),
                input.nextDouble());
            temp.setFill(Color.TRANSPARENT);
            temp.setStroke(Color.BLACK);

            rectangles.add(temp);
        }

        Rectangle rec1 = rectangles.get(0);
        Rectangle rec2 = rectangles.get(1);

        String s = "";

        if (!(rec1.contains(rec2.getWidth(), rec2.getHeight()) 
            || rec2.contains(rec1.getWidth(), rec1.getHeight()))) {
            s = "One rectangle is contained in another.";
        } else if (rec1.intersects(rec2.getX(), rec2.getY(), rec2.getWidth(), rec2.getHeight())
            || rec2.intersects(rec1.getX(), rec1.getY(), rec1.getWidth(), rec1.getHeight())) {
            s = "One rectangle overlaps another." ;
        } else {
            s = "The rectangles do not overlap.";
        }

        Text text = new Text(width * 0.1, height * 0.9, s);
        pane.getChildren().add(text);
        pane.getChildren().addAll(rectangles);
        primaryStage.setTitle("rectangles..");
        primaryStage.setScene(new Scene(pane, width, height));
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

您也可以将文件命名为1.wav,2.wav等并使用播放($ {RAND(1,2)}或者您可以将其添加到musiconhold文件夹并随机播放MOH