View Javadoc

1   /*
2    * Copyright  2004-2005 Stefan Reuter
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   *
16   */
17  package net.sf.asterisk.fastagi.command;
18  
19  /***
20   * Turns on music on hold on the current channel.<br>
21   * Always returns 0.
22   * 
23   * @author srt
24   * @version $Id: SetMusicOnCommand.java,v 1.3 2005/03/11 19:50:35 srt Exp $
25   */
26  public class SetMusicOnCommand extends AGICommand
27  {
28      /***
29       * Serial version identifier.
30       */
31      private static final long serialVersionUID = 3762248656229053753L;
32  
33      /***
34       * The music on hold class to play music from.
35       */
36      private String musicOnHoldClass;
37  
38      /***
39       * Creates a new SetMusicOnCommand playing music from the default music on
40       * hold class.
41       */
42      public SetMusicOnCommand()
43      {
44          this.musicOnHoldClass = null;
45      }
46  
47      /***
48       * Creates a new SetMusicOnCommand playing music from the default music on
49       * hold class.
50       * 
51       * @param musicOnHoldClass the music on hold class to play music from.
52       */
53      public SetMusicOnCommand(String musicOnHoldClass)
54      {
55          this.musicOnHoldClass = musicOnHoldClass;
56      }
57  
58      /***
59       * Returns the music on hold class to play music from.
60       * 
61       * @return the music on hold class to play music from or <code>null</code>
62       *         for the default class.
63       */
64      public String getMusicOnHoldClass()
65      {
66          return musicOnHoldClass;
67      }
68  
69      /***
70       * Sets the music on hold class to play music from.
71       * 
72       * @param musicOnHoldClass the music on hold class to play music from or
73       *            <code>null</code> for the default class.
74       */
75      public void setMusicOnHoldClass(String musicOnHoldClass)
76      {
77          this.musicOnHoldClass = musicOnHoldClass;
78      }
79  
80      public String buildCommand()
81      {
82          return "SET MUSIC ON"
83                  + (musicOnHoldClass == null ? "" : " "
84                          + escapeAndQuote(musicOnHoldClass));
85      }
86  }