Posted to tcl by gloin at Tue Jul 13 18:35:14 GMT 2010view raw

  1. function MAKECALL ()
  2. {
  3. expect -c '
  4. set timeout -1
  5. spawn telnet localhost 5038
  6. expect "Asterisk Call Manager/1.1"
  7.  
  8. send "Action: login\r"
  9. send "Username: admin\r"
  10. send "Secret: 1Pass1\r"
  11. send "\r"
  12. expect "Message: Authentication accepted"
  13.  
  14. send "Action: Originate\r"
  15. send "Channel: SIP/ShoreTel/'${PHONENUMBER[$count]}'\r"
  16. send "Variable: Data='$PROBLEM'\r"
  17. send "Variable: CalledNumber='${PHONENUMBER[$count]}'\r"
  18. send "Context: alertcall\r"
  19. send "Priority: 1\r"
  20. send "\r"
  21.  
  22. expeo $? expect -c '
  23. set timeout -1
  24. spawn telnet localhost 5038
  25. expect "Asterisk Call Manager/1.1"
  26.  
  27. send "Action: login\r"
  28. send "Username: admin\r"
  29. send "Secret: 1Pass1\r"
  30. send "\r"
  31. expect "Message: Authentication accepted"
  32.  
  33. send "Action: Originate\r"
  34. send "Channel: SIP/ShoreTel/'${PHONENUMBER[$count]}'\r"
  35. send "Variable: Data='$PROBLEM'\r"
  36. send "Variable: CalledNumber='${PHONENUMBER[$count]}'\r"
  37. send "Context: alertcall\r"
  38. send "Priority: 1\r"
  39. send "\r"
  40.  
  41. expect {
  42. "AppData: custom/thankyou" {
  43. exit 0
  44. }
  45. "AppData: goodbye" {
  46. exit 1
  47. }
  48. }
  49. '
  50. }
  51.  
  52. MAKECALL
  53.  
  54. echo $?
  55.  

Comments

Posted by gloin at Tue Jul 13 18:39:58 GMT 2010 [text] [code]

Imagine lines 21-39 don't exist, sigh.