Hi i have integrated twilio in application. In twilio every thing is working fine for me. But once the call ended am getting Error - 11750 TwiML response body too large. Here what i have did from my end.
def connect
twiml1 = Twilio::TwiML::Response.new do |r|
r.Say "You have joined the conference."
r.Dial do |d|
d.Conference "#{conference_title} #{call.id}",
waitUrl: " ",
muted: "false",
startConferenceOnEnter: "true",
endConferenceOnExit: "true",
maxParticipants: 5
end
end
render xml: twiml1.to_xml
end
Once the conference ended am doing some payment related to application requirement.
def call_status
if params["CallStatus"] == "completed"
request_call = RequestCall.find { |c| c.caller_sids.include?(params["CallSid"])}
if request_call.present?
#save call logs
call_log = CallLog.new(called: params[:Called], tostate: params[:CallerCountry], callercountry: params[:CallerCountry], callerzip: params[:CallerZip],
direction: params[:Direction], timestamp: params[:Timestamp], callbacksource: params[:CallbackSource], callerstate: params[:CallerState],
tozip: params[:ToZip], sequencenumber: params[:SequenceNumber], callsid: params[:CallSid], to: params[:To], calledzip: params[:CalledZip],
calledcity: params[:CalledCity], tocountry: params[:ToCountry], apiversion: params[:ApiVersion], callstatus: params[:CallStatus], duration: params[:Duration],
from: params[:From], callduration: params[:CallDuration], accountsid: params[:AccountSid], calledcountry: params[:CalledCountry], callercity: params[:CallerCity],
caller: params[:Caller], fromcountry: params[:FromCountry], tocity: params[:ToCity], fromcity: params[:FromCity], calledstate: params[:CalledState], fromzip: params[:FromZip],
fromstate: [:FromState], user_id: request_call.user_id, expert_id: request_call.expert_id, request_call_id: request_call.id)
call_log.save
#check caller length
if request_call.call_ended == false && request_call.call_id_length == true
# Check estimate time with total duration
if request_call.estimated_time.to_i == call_log.duration.to_i
release_payment = request_call.release_full_payment
elsif request_call.estimated_time.to_i < call_log.duration.to_i
make_payment = request_call.release_full_payment
express_item_id = request_call.express_item_id
extra_time = call_log.duration.to_i - request_call.estimated_time.to_i
pending_amount = request_call.price_to_pay(extra_time)
second_item = request_call.express_item(pending_amount)
if second_item.code == 200
express_payment = request_call.release_express_payment
end
render json: {status: true}
elsif request_call.estimated_time.to_i > call_log.duration.to_i
remaining_duration = request_call.estimated_time.to_i - call_log.duration.to_i
refund_amount = request_call.price_to_pay(remaining_duration)
refund = request_call.refund_partial_amount(refund_amount)
release_fund = request_call.release_full_payment
render json: {status: true}
end
request_call.transition_to!(:completed)
request_call.update(twilio_allocated_number: nil, twilio_access_code: nil, call_ended: true)
elsif request_call.call_ended == true && request_call.call_id_length == true
render json: {status: true}
elsif request_call.call_ended == false && request_call.call_id_length == false
#make payment
request_call.transition_to!(:completed)
request_call.update(twilio_allocated_number: nil, twilio_access_code: nil, call_ended: true, single_user: true)
render json: {status: true}
end
else
render json: {status: false}
end
else
render json: {status: false}
end
end
I don't know what i have did wrong in this. Please advice me.