Call.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php
  2. /**
  3. * For more information, see the `Call Instance Resource <http://www.twilio.com/docs/api/rest/call#instance>`_ documentation.
  4. *
  5. * .. php:attr:: sid
  6. *
  7. * A 34 character string that uniquely identifies this resource.
  8. *
  9. * .. php:attr:: parent_call_sid
  10. *
  11. * A 34 character string that uniquely identifies the call that created this leg.
  12. *
  13. * .. php:attr:: date_created
  14. *
  15. * The date that this resource was created, given as GMT in RFC 2822 format.
  16. *
  17. * .. php:attr:: date_updated
  18. *
  19. * The date that this resource was last updated, given as GMT in RFC 2822 format.
  20. *
  21. * .. php:attr:: account_sid
  22. *
  23. * The unique id of the Account responsible for creating this call.
  24. *
  25. * .. php:attr:: to
  26. *
  27. * The phone number that received this call. e.g., +16175551212 (E.164 format)
  28. *
  29. * .. php:attr:: from
  30. *
  31. * The phone number that made this call. e.g., +16175551212 (E.164 format)
  32. *
  33. * .. php:attr:: phone_number_sid
  34. *
  35. * If the call was inbound, this is the Sid of the IncomingPhoneNumber that
  36. * received the call. If the call was outbound, it is the Sid of the
  37. * OutgoingCallerId from which the call was placed.
  38. *
  39. * .. php:attr:: status
  40. *
  41. * A string representing the status of the call. May be `QUEUED`, `RINGING`,
  42. * `IN-PROGRESS`, `COMPLETED`, `FAILED`, `BUSY` or `NO_ANSWER`.
  43. *
  44. * .. php:attr:: stat_time
  45. *
  46. * The start time of the call, given as GMT in RFC 2822 format. Empty if the call has not yet been dialed.
  47. *
  48. * .. php:attr:: end_time
  49. *
  50. * The end time of the call, given as GMT in RFC 2822 format. Empty if the call did not complete successfully.
  51. *
  52. * .. php:attr:: duration
  53. *
  54. * The length of the call in seconds. This value is empty for busy, failed, unanswered or ongoing calls.
  55. *
  56. * .. php:attr:: price
  57. *
  58. * The charge for this call in USD. Populated after the call is completed. May not be immediately available.
  59. *
  60. * .. php:attr:: direction
  61. *
  62. * A string describing the direction of the call. inbound for inbound
  63. * calls, outbound-api for calls initiated via the REST API or
  64. * outbound-dial for calls initiated by a <Dial> verb.
  65. *
  66. * .. php:attr:: answered_by
  67. *
  68. * If this call was initiated with answering machine detection, either human or machine. Empty otherwise.
  69. *
  70. * .. php:attr:: forwarded_from
  71. *
  72. * If this call was an incoming call forwarded from another number, the
  73. * forwarding phone number (depends on carrier supporting forwarding).
  74. * Empty otherwise.
  75. *
  76. * .. php:attr:: caller_name
  77. *
  78. * If this call was an incoming call from a phone number with Caller ID Lookup enabled, the caller's name. Empty otherwise.
  79. */
  80. class Services_Twilio_Rest_Call extends Services_Twilio_InstanceResource {
  81. /**
  82. * Hang up the call
  83. */
  84. public function hangup() {
  85. $this->update('Status', 'completed');
  86. }
  87. /**
  88. * Redirect the call to a new URL
  89. *
  90. * :param string $url: the new URL to retrieve call flow from.
  91. */
  92. public function route($url) {
  93. $this->update('Url', $url);
  94. }
  95. protected function init($client, $uri) {
  96. $this->setupSubresources(
  97. 'notifications',
  98. 'recordings',
  99. 'feedback'
  100. );
  101. }
  102. }