Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
- Add Logistics component with progress tracking - Add OrderDetail component for order information - Support data-driven steps and actions - Add blue color scale to widget SCSS - Fix node overflow and progress bar rendering issues - Add English translations for dashboard components Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
59 lines
1.7 KiB
Ruby
59 lines
1.7 KiB
Ruby
class Api::V1::Accounts::ConferenceController < Api::V1::Accounts::BaseController
|
|
before_action :set_voice_inbox_for_conference
|
|
|
|
def token
|
|
render json: Voice::Provider::Twilio::TokenService.new(
|
|
inbox: @voice_inbox,
|
|
user: Current.user,
|
|
account: Current.account
|
|
).generate
|
|
end
|
|
|
|
def create
|
|
conversation = fetch_conversation_by_display_id
|
|
ensure_call_sid!(conversation)
|
|
|
|
conference_service = Voice::Provider::Twilio::ConferenceService.new(conversation: conversation)
|
|
conference_sid = conference_service.ensure_conference_sid
|
|
conference_service.mark_agent_joined(user: current_user)
|
|
|
|
render json: {
|
|
status: 'success',
|
|
id: conversation.display_id,
|
|
conference_sid: conference_sid,
|
|
using_webrtc: true
|
|
}
|
|
end
|
|
|
|
def destroy
|
|
conversation = fetch_conversation_by_display_id
|
|
Voice::Provider::Twilio::ConferenceService.new(conversation: conversation).end_conference
|
|
render json: { status: 'success', id: conversation.display_id }
|
|
end
|
|
|
|
private
|
|
|
|
def ensure_call_sid!(conversation)
|
|
return conversation.identifier if conversation.identifier.present?
|
|
|
|
incoming_sid = params.require(:call_sid)
|
|
|
|
conversation.update!(identifier: incoming_sid)
|
|
incoming_sid
|
|
end
|
|
|
|
def set_voice_inbox_for_conference
|
|
@voice_inbox = Current.account.inboxes.find(params[:inbox_id])
|
|
authorize @voice_inbox, :show?
|
|
end
|
|
|
|
def fetch_conversation_by_display_id
|
|
cid = params[:conversation_id]
|
|
raise ActiveRecord::RecordNotFound, 'conversation_id required' if cid.blank?
|
|
|
|
conversation = @voice_inbox.conversations.find_by!(display_id: cid)
|
|
authorize conversation, :show?
|
|
conversation
|
|
end
|
|
end
|