ruby - Retrieving CallSid for incoming call -
when ruby script makes outgoing calls through twilio, it's piece of cake me find, output, , reuse call sid later such :
@client = twilio::rest:client.new account_sid, auth_token
call = @client.account.calls.create({ :from=>'inc', :to=>'out', :url=>'url', :method=>'get'})
puts call.sid
this works fine outgoing calls make myself.
the issue when try call sid incoming calls.
get '/greeting' do
twilio::twiml::response.new |r|
r.say 'hello. welcome.'
r.gather :numdigits => '1', :action => '/greeting/handle-gather', :method => 'get' |g|
g.say 'for x, press 1. y, press 2. z, press 3.'
end
end.text
puts twilio::twiml::request.callsid
callsid = incoming_cid
end
the incoming_cid stored in mysql database later. i'm not sure if twilio::twiml::request.callsid
correct way request parameters twilio passes application.
how retrieve callsid incoming calls?
nevermind, issue been solved using ruby's params
instead of twilio http request object:
puts params['callsid']
Comments
Post a Comment