When I receive a call, I output the CallSid
parameter and save it as a variable @incoming_Cid
to track the call throughout it's duration and manipulate it.
When I try to bridge the call in between a customer and an employee, I dial a conference. I'd like to use the @incoming_Cid
as the friendly name to make the conference unique every time.
Example:
puts params['CallSid']
@incoming_Cid = params['CallSid']
Twilio::TwiML::Response.new do |r|
r.Dial :action => '/greeting/handle-gather/techsupp/conference', :method => 'get' do |d|
d.Say 'Please wait while we connect you to one of our operators. '
d.Conference "#{incoming_Cid}"
end
end
Normally, I have the friendly name in ' ', but string interpolation requires " ". So I'm not sure if what I'm trying to do is correct/allowed?
Also, how can I output the sid
params of a dialed conference like described here.
You are definitely going in the right direction here. There are a few suggestions I would make to accomplish what you are going for. Here is my modified snippet:
puts params['CallSid']
@incoming_Cid = params['CallSid']
response = Twilio::TwiML::Response.new do |r|
r.Dial :action => '/greeting/handle-gather/techsupp/conference', :method => 'get' do |d|
d.Say 'Please wait while we connect you to one of our operators. '
d.Conference @incoming_Cid
end
end
puts response.text
The changes I made are assigning your TwiML::Response
to the response variable and outputting the TwiML text at the end which will be your generated XML response.
I also changed your d.Conference line to simply output @incoming_Cid
without putting it in quotes, which in this case should work as valid Ruby.
Hope this helps!