lib/mock/twilio/webhooks/calls.rb in mock-twilio-1.1.0 vs lib/mock/twilio/webhooks/calls.rb in mock-twilio-1.2.0
- old
+ new
@@ -4,17 +4,17 @@
module Twilio
module Webhooks
class Calls < Base
URL = "/api/v1/twilio_calls/participant_status_changes"
- def self.trigger(sid)
+ def self.trigger(sid, participant_status)
# Wait simulation from twilio
sleep DELAY.sample
request_url = Mock::Twilio.proto + "://" + Mock::Twilio.forwarded_host + URL
- data = call_data(sid)
+ data = call_data(sid, participant_status)
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_data(sid)
+ def self.call_data(sid, participant_status)
{
:AccountSid=> twilio_client.account_sid,
:ApiVersion=> "2010-04-01",
:CallbackSource=> "call-progress-events",
:CallDuration=> "0",
@@ -48,10 +48,10 @@
:CallerCity=> "no value",
:CallerCountry=> "US",
:CallerState=> "CA",
:CallerZip=> "no value",
:CallSid=> sid,
- :CallStatus=> "ringing",
+ :CallStatus=> participant_status,
:Direction=> "outbound-api",
:Duration=> "0",
:From=> "+18111111111",
:FromCity=> "no value",
:FromCountry=> "US",