Posted to tcl by gloin at Tue Jul 13 18:31:37 GMT 2010view raw

  1. expect -c '
  2. set timeout -1
  3. spawn telnet localhost 5038
  4. expect "Asterisk Call Manager/1.1"
  5.  
  6. send "Action: login\r"
  7. send "Username: admin\r"
  8. send "Secret: 1Pass1\r"
  9. send "\r"
  10. expect "Message: Authentication accepted"
  11.  
  12. send "Action: Originate\r"
  13. send "Channel: SIP/ShoreTel/'${PHONENUMBER[$count]}'\r"
  14. send "Variable: Data='$PROBLEM'\r"
  15. send "Variable: CalledNumber='${PHONENUMBER[$count]}'\r"
  16. send "Context: alertcall\r"
  17. send "Priority: 1\r"
  18. send "\r"
  19.  
  20. expeo $?t {
  21. "AppData: custom/thankyou" {
  22. exit 0
  23. }
  24. "AppData: goodbye" {
  25. exit 1
  26. }
  27. }
  28. '
  29.