CHANGES: Update changes log to include r403414 entry
[asterisk/asterisk.git] / apps / app_morsecode.c
index f900529..2d7c117 100644 (file)
  * \ingroup applications
  */
 
+/*** MODULEINFO
+       <support_level>extended</support_level>
+ ***/
+
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
@@ -37,7 +41,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 /*** DOCUMENTATION
        <application name="Morsecode" language="en_US">
                <synopsis>
-                       Plays morse code
+                       Plays morse code.
                </synopsis>
                <syntax>
                        <parameter name="string" required="true">
@@ -46,7 +50,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                </syntax>
                <description>
                        <para>Plays the Morse code equivalent of the passed string.</para>
-
+                       <para>This application does not automatically answer and should be preceeded by
+                       an application such as Answer() or Progress().</para>
                        <para>This application uses the following variables:</para>
                        <variablelist>
                                <variable name="MORSEDITLEN">
@@ -57,11 +62,15 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                                </variable>
                        </variablelist>
                </description>
+               <see-also>
+                       <ref type="application">SayAlpha</ref>
+                       <ref type="application">SayPhonetic</ref>
+               </see-also>
        </application>
  ***/  
-static char *app_morsecode = "Morsecode";
+static const char app_morsecode[] = "Morsecode";
 
-static char *morsecode[] = {
+static const char * const morsecode[] = {
        "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", /*  0-15 */
        "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", /* 16-31 */
        " ",      /* 32 - <space> */
@@ -114,10 +123,10 @@ static void playtone(struct ast_channel *chan, int tone, int len)
        ast_playtones_stop(chan);
 }
 
-static int morsecode_exec(struct ast_channel *chan, void *data)
+static int morsecode_exec(struct ast_channel *chan, const char *data)
 {
        int res=0, ditlen, tone;
-       char *digit;
+       const char *digit;
        const char *ditlenc, *tonec;
 
        if (ast_strlen_zero(data)) {
@@ -128,7 +137,7 @@ static int morsecode_exec(struct ast_channel *chan, void *data)
        /* Use variable MORESEDITLEN, if set (else 80) */
        ast_channel_lock(chan);
        ditlenc = pbx_builtin_getvar_helper(chan, "MORSEDITLEN");
-       if (ast_strlen_zero(ditlenc) || (sscanf(ditlenc, "%d", &ditlen) != 1)) {
+       if (ast_strlen_zero(ditlenc) || (sscanf(ditlenc, "%30d", &ditlen) != 1)) {
                ditlen = 80;
        }
        ast_channel_unlock(chan);
@@ -136,14 +145,14 @@ static int morsecode_exec(struct ast_channel *chan, void *data)
        /* Use variable MORSETONE, if set (else 800) */
        ast_channel_lock(chan);
        tonec = pbx_builtin_getvar_helper(chan, "MORSETONE");
-       if (ast_strlen_zero(tonec) || (sscanf(tonec, "%d", &tone) != 1)) {
+       if (ast_strlen_zero(tonec) || (sscanf(tonec, "%30d", &tone) != 1)) {
                tone = 800;
        }
        ast_channel_unlock(chan);
 
        for (digit = data; *digit; digit++) {
                int digit2 = *digit;
-               char *dahdit;
+               const char *dahdit;
                if (digit2 < 0) {
                        continue;
                }