Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. ;Simple speech recognition
  2. exten => 1234,1,Answer()
  3. exten => 1234,n,agi(speech-recog.agi,en-US)
  4. exten => 1234,n,Verbose(1,The text you just said is: ${utterance})
  5. exten => 1234,n,Verbose(1,The probability to be right is: ${confidence})
  6. exten => 1234,n,Hangup()
  7.  
  8. ;Speech recognition demo also using googletts.agi for text to speech synthesis:
  9. exten => 1235,1,Answer()
  10. exten => 1235,n,agi(googletts.agi,"Say something in English, when done press the pound key.",en)
  11. exten => 1235,n(record),agi(speech-recog.agi,en-US)
  12. exten => 1235,n,Verbose(1,Script returned: ${confidence} , ${utterance})
  13.  
  14. ;Check the probability of a successful recognition:
  15. exten => 1235,n,GotoIf($["${confidence}" > "0.8"]?playback:retry)
  16.  
  17. ;Playback the text
  18. exten => 1235,n(playback),agi(googletts.agi,"The text you just said was...",en)
  19. exten => 1235,n,agi(googletts.agi,"${utterance}",en)
  20. exten => 1235,n,goto(end)
  21.  
  22. ;Retry in case speech recognition wasn't successful:
  23. exten => 1235,n(retry),agi(googletts.agi,"Can you please repeat more clearly?",en)
  24. exten => 1235,n,goto(record)
  25.  
  26. exten => 1235,n(fail),agi(googletts.agi,"Failed to get speech data.",en)
  27. exten => 1235,n(end),Hangup()
  28.  
  29. ;Voice dialing example
  30. exten => 1236,1,Answer()
  31. exten => 1236,n,agi(googletts.agi,"PLease say the number you want to dial.",en)
  32. exten => 1236,n(record),agi(speech-recog.agi,en-US)
  33. exten => 1236,n,GotoIf($["${confidence}" > "0.8"]?success:retry)
  34.  
  35. exten => 1236,n(success),goto(${utterance},1)
  36.  
  37. exten => 1236,n(retry),agi(googletts.agi,"Can you please repeat?",en)
  38. exten => 1236,n,goto(record)
  39.  
  40. Under the folder wolfram you can find a sample agi script that in combination with speech-recog.agi
  41. sends queries to WolframAlpha and returs the answers as a dialplan variable. See wolfram/README for
  42. details and dialplan examples.
  43.  
  44. -------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement