Advertisement
Guest User

Untitled

a guest
Feb 4th, 2021
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. 44459 => {
  2. Answer();
  3. Playback(you-entered);
  4. WaitEventInit(); // Initialize event queue
  5. GRPCSTTBackground(); // Initialize background recognition
  6.  
  7. Set(CALL_END_TIME=$[${GET_TIME_NSEC(MONOTONIC)} + 10]); // Set end time to a minute after now
  8. Set(SLEEP_TIME=$[${CALL_END_TIME} - ${GET_TIME_NSEC(MONOTONIC)}]); // Calculate maximum wait time
  9. while (${SLEEP_TIME} > 0) { // While not timed out yet
  10. WaitEvent(${SLEEP_TIME}); // Wait until next event or timeout
  11. if (${WAITEVENTSTATUS} == SUCCESS) {
  12. Set(CurrentUTCTime=${GET_TIME_NSEC(UTC)});
  13. Set(CurrentUTCTimeString=${STRFTIME(${CurrentUTCTime},GMT,%FT%T)}.${CurrentUTCTime:-9:});
  14. switch (${WAITEVENTNAME}) {
  15. case GRPCSTT_X_REQUEST_ID:
  16. Log(NOTICE,[${CurrentUTCTimeString}] x-request-id = ${WAITEVENTBODY});
  17. break;
  18. case GRPCSTT_UTF8:
  19. Log(NOTICE,[${CurrentUTCTimeString}] Phrase(UTF-8 encoded) = ${WAITEVENTBODY});
  20. break;
  21. default:
  22. }
  23. } else {
  24. Log(NOTICE,WaitEvent() WAITEVENTSTATUS == ${WAITEVENTSTATUS}; ${WAITEVENTBODY});
  25. }
  26. Set(SLEEP_TIME=$[${CALL_END_TIME} - ${GET_TIME_NSEC(MONOTONIC)}]); // Update maximum wait time
  27. }
  28. Hangup();
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement