126. Read()

Liest DTMF-Ziffern eines Anrufers und weist die Eingabe einer Variablen zu.

Read(Variablenname[,Dateiname[,maxZiffern[,Option[,Versuche[,Timeout]]]]])

Liest eine mit # abgeschlossene Reihe von Ziffern von einem Teilnehmer, und legt sie in einer gegebenen Variablen ab.

Wenn Dateiname (ohne Endung!) angegeben ist, wird dem Anrufer diese Datei vor dem Einlesen vorgespielt.

maxZiffern bestimmt die maximal zu akzeptierende Anzahl von Ziffern. Ist der Parameter angegeben, beendet die Anwendung das Einlesen, nachdem maxZiffern Ziffern eingegeben wurden (ohne dass der Teilnehmer mit der #-Taste bestätigen muss). Standardeinstellung ist 0, was bedeutet, dass keine Begrenzung existiert und auf die Eingabe von # gewartet wird. Der größte akzeptierte Wert ist 255.

Die Option skip bewirkt eine sofortige Rückkehr, falls der Channel nicht aktiv ist. noanswer bewirkt Einlesen sogar bei einem inaktiven Channel.

Der Anrufer hat maximal Versuche Versuche, innerhalb von Timout Sekunden eine Eingabe zu machen. (Ein Timeout von 0 bedeutet unendlich.)

Liefert -1 zurück im Falle eines Auflegens oder Fehlers, sonst 0.

; eine maximal vierstellige Zahl einlesen (3 Versuche) und dem Anrufer ansagen:
exten => 123,1,Read(NUMMER,,4,3)
exten => 123,n,SayNumber(${NUMMER})
exten => 123,n,Goto(1)

Asterisk-Versionen: 

————————| 1.2 |————————| 1.4 |————————| 1.6 |————————

Interner Hilfetext zu dieser Applikation in Asterisk 1.4: 

  -= Info about application 'Read' =-

[Synopsis]
Read a variable

[Description]
  Read(variable[|filename][|maxdigits][|option][|attempts][|timeout])

Reads a #-terminated string of digits a certain number of times from the
user in to the given variable.
  filename   -- file to play before reading digits or tone with option i
  maxdigits  -- maximum acceptable number of digits. Stops reading after
                maxdigits have been entered (without requiring the user to
                press the '#' key).
                Defaults to 0 - no limit - wait for the user press the '#' key.
                Any value below 0 means the same. Max accepted value is 255.
  option     -- options are 's' , 'i', 'n'
                's' to return immediately if the line is not up,
                'i' to play  filename as an indication tone from your indications.conf
                'n' to read digits even if the line is not up.
  attempts   -- if greater than 1, that many attempts will be made in the
                event no data is entered.
  timeout    -- An integer number of seconds to wait for a digit response. If greater
                than 0, that value will override the default timeout.

Read should disconnect if the function fails or errors out.

Differenz des internen Hilfetexts von Asterisk 1.2 zu 1.4: 

--- in Asterisk 1.2
+++ in Asterisk 1.4
@@ -8,16 +8,19 @@

   Reads a #-terminated string of digits a certain number of times from the
   user in to the given variable.
-    filename   -- file to play before reading digits.
+    filename   -- file to play before reading digits or tone with option i
     maxdigits  -- maximum acceptable number of digits. Stops reading after
                   maxdigits have been entered (without requiring the user to
                   press the '#' key).
                   Defaults to 0 - no limit - wait for the user press the '#' key.
                   Any value below 0 means the same. Max accepted value is 255.
-    option     -- may be 'skip' to return immediately if the line is not up,
-                  or 'noanswer' to read digits even if the line is not up.
+    option     -- options are 's' , 'i', 'n'
+                  's' to return immediately if the line is not up,
+                  'i' to play  filename as an indication tone from your indications.conf
+                  'n' to read digits even if the line is not up.
     attempts   -- if greater than 1, that many attempts will be made in the
                   event no data is entered.
-    timeout    -- if greater than 0, that value will override the default timeout.
+    timeout    -- An integer number of seconds to wait for a digit response. If greater
+                  than 0, that value will override the default timeout.

   Read should disconnect if the function fails or errors out.

Differenz des internen Hilfetexts von Asterisk 1.4 zu 1.6: 

--- in Asterisk 1.4
+++ in Asterisk 1.6
@@ -4,11 +4,11 @@
   Read a variable

   [Description]
-    Read(variable[|filename][|maxdigits][|option][|attempts][|timeout])
+    Read(variable[,filename[&filename2...]][,maxdigits][,option][,attempts][,timeout])

   Reads a #-terminated string of digits a certain number of times from the
   user in to the given variable.
-    filename   -- file to play before reading digits or tone with option i
+    filename   -- file(s) to play before reading digits or tone with option i
     maxdigits  -- maximum acceptable number of digits. Stops reading after
                   maxdigits have been entered (without requiring the user to
                   press the '#' key).
@@ -20,7 +20,9 @@
                   'n' to read digits even if the line is not up.
     attempts   -- if greater than 1, that many attempts will be made in the
                   event no data is entered.
-    timeout    -- An integer number of seconds to wait for a digit response. If greater
-                  than 0, that value will override the default timeout.
-
-  Read should disconnect if the function fails or errors out.
+    timeout    -- The number of seconds to wait for a digit response. If greater
+                  than 0, that value will override the default timeout. Can be floating point.
+  This application sets the following channel variable upon completion:
+      READSTATUS - This is the status of the read operation.
+                   Possible values are:
+                   OK | ERROR | HANGUP | INTERRUPTED | SKIPPED | TIMEOUT

Siehe auch. Abschnitt 144, „SendDTMF()


AMOOCON 2010

Noch kein Ticket? Dann wird es Zeit. Nur noch wenige Tage.

Twitter

Flattr

Das gedruckte Buch

Werbung