lib/mock/twilio/webhooks/call_status_updates.rb in mock-twilio-1.0.0 vs lib/mock/twilio/webhooks/call_status_updates.rb in mock-twilio-1.1.0
- old
+ new
@@ -4,17 +4,17 @@
module Twilio
module Webhooks
class CallStatusUpdates < Base
URL = "/api/v1/twilio_calls/voice_responses"
- def self.trigger(sid, conference_uuid)
+ def self.trigger(sid, conference_uuid, answered_by)
# Wait simulation from twilio
sleep DELAY.sample
request_url = Mock::Twilio.proto + "://" + Mock::Twilio.forwarded_host + URL
- data = call_status_updates_data(sid, conference_uuid)
+ data = call_status_updates_data(sid, conference_uuid, answered_by)
signature = build_signature_for_request(request_url, data)
response = webhook_client.request(Mock::Twilio.host,
Mock::Twilio.port,
@@ -31,11 +31,11 @@
when 400..600
raise Webhooks::RestError, Mock::Twilio::ErrorHandler.new(response).raise
end
end
- def self.call_status_updates_data(sid, conference_uuid)
+ def self.call_status_updates_data(sid, conference_uuid, answered_by)
{
:AccountSid=> twilio_client.account_sid,
:ApiVersion=> "2010-04-01",
:CallbackSource=> "call-progress-events",
:CallDuration=> "0",
@@ -66,10 +66,10 @@
:ToCountry=> "US",
:ToState=> "FL",
:ToZip=> "33605",
:StirStatus=> "B",
:StirVerstat=> "TN-Validation-Passed-B",
- :AnsweredBy=> "unknown",
+ :AnsweredBy=> answered_by,
:conference_uuid=> conference_uuid
}
end
end
end