transfer-attended.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #
  2. import inc_const as const
  3. PJSUA = ["--null-audio", # UA0
  4. "--null-audio", # UA1
  5. "--null-audio" # UA2
  6. ]
  7. PJSUA_EXPECTS = [
  8. # A calls B
  9. [0, "", "m"],
  10. [0, "", "$PJSUA_URI[1]"],
  11. [0, const.STATE_CALLING, ""],
  12. [1, const.EVENT_INCOMING_CALL, "a"],
  13. [1, "", "200"],
  14. [0, const.STATE_CONFIRMED, ""],
  15. [1, const.STATE_CONFIRMED, ""],
  16. # B holds A
  17. [1, "", "H"],
  18. [0, const.MEDIA_HOLD, ""],
  19. [1, const.MEDIA_HOLD, ""],
  20. # B calls C
  21. [1, "", "m"],
  22. [1, "", "$PJSUA_URI[2]"],
  23. [1, const.STATE_CALLING, ""],
  24. [2, const.EVENT_INCOMING_CALL, "a"],
  25. [2, "", "200"],
  26. [1, const.STATE_CONFIRMED, ""],
  27. [2, const.STATE_CONFIRMED, ""],
  28. # B holds C
  29. [1, "", "]"],
  30. [1, "", "H"],
  31. [2, const.MEDIA_HOLD, ""],
  32. [1, const.MEDIA_HOLD, ""],
  33. [1, "", "]"],
  34. # B transfer A to C
  35. [1, "", "X"],
  36. [1, "", "1"],
  37. [0, "Call .* is being transferred", ""],
  38. [1, "Subscription state .* ACCEPTED", ""],
  39. [0, const.STATE_CALLING, ""],
  40. [2, "Call .* is being replaced", ""],
  41. [1, "call transferred successfully", ""],
  42. [0, const.MEDIA_ACTIVE, ""],
  43. [2, const.MEDIA_ACTIVE, ""],
  44. [1, const.STATE_DISCONNECTED, ""]
  45. ]
  46. PJSUA_CLI_EXPECTS = [
  47. # A calls B
  48. [0, "", "call new $PJSUA_URI[1]"],
  49. [0, const.STATE_CALLING, ""],
  50. [1, const.EVENT_INCOMING_CALL, "call answer 200"],
  51. [0, const.STATE_CONFIRMED, ""],
  52. [1, const.STATE_CONFIRMED, ""],
  53. # B holds A
  54. [1, "", "call hold"],
  55. [0, const.MEDIA_HOLD, ""],
  56. [1, const.MEDIA_HOLD, ""],
  57. # B calls C
  58. [1, "", "call new $PJSUA_URI[2]"],
  59. [1, const.STATE_CALLING, ""],
  60. [2, const.EVENT_INCOMING_CALL, "call answer 200"],
  61. [1, const.STATE_CONFIRMED, ""],
  62. [2, const.STATE_CONFIRMED, ""],
  63. # B holds C
  64. [1, "", "call next"],
  65. [1, "", "call hold"],
  66. [2, const.MEDIA_HOLD, ""],
  67. [1, const.MEDIA_HOLD, ""],
  68. [1, "", "call next"],
  69. # B transfer A to C
  70. [1, "", "call transfer_replaces 1"],
  71. [0, "Call .* is being transferred", ""],
  72. [1, "Subscription state .* ACCEPTED", ""],
  73. [0, const.STATE_CALLING, ""],
  74. [2, "Call .* is being replaced", ""],
  75. [1, "call transferred successfully", ""],
  76. [0, const.MEDIA_ACTIVE, ""],
  77. [2, const.MEDIA_ACTIVE, ""],
  78. [1, const.STATE_DISCONNECTED, ""]
  79. ]