mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-07 07:55:16 +02:00
fix: remove org check
This commit is contained in:
parent
07558ec785
commit
2a306b0982
2 changed files with 1 additions and 33 deletions
|
|
@ -4,7 +4,6 @@ from sqlalchemy.future import select
|
|||
|
||||
from api.db.base_client import BaseDBClient
|
||||
from api.db.models import OrganizationConfigurationModel
|
||||
from api.enums import OrganizationConfigurationKey
|
||||
|
||||
|
||||
class OrganizationConfigurationClient(BaseDBClient):
|
||||
|
|
@ -95,29 +94,3 @@ class OrganizationConfigurationClient(BaseDBClient):
|
|||
"""Get the value of a configuration, returning default if not found."""
|
||||
config = await self.get_configuration(organization_id, key)
|
||||
return config.value if config else default
|
||||
|
||||
async def get_organization_id_by_telephony_domain(
|
||||
self, domain: str
|
||||
) -> Optional[int]:
|
||||
"""Find organization ID by domain_id in telephony configuration.
|
||||
|
||||
Args:
|
||||
domain: The telephony domain to search for (e.g., Cloudonix domain_id)
|
||||
|
||||
Returns:
|
||||
Organization ID if found, None otherwise
|
||||
"""
|
||||
async with self.async_session() as session:
|
||||
result = await session.execute(
|
||||
select(OrganizationConfigurationModel).where(
|
||||
OrganizationConfigurationModel.key
|
||||
== OrganizationConfigurationKey.TELEPHONY_CONFIGURATION.value,
|
||||
)
|
||||
)
|
||||
configs = result.scalars().all()
|
||||
|
||||
for config in configs:
|
||||
if config.value and config.value.get("domain_id") == domain:
|
||||
return config.organization_id
|
||||
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -1453,16 +1453,11 @@ async def handle_cloudonix_cdr(request: Request):
|
|||
|
||||
# Extract call_id to find workflow run
|
||||
call_id = cdr_data.get("session").get("token")
|
||||
logger.info(f"Cloudonix CDR data for call id {call_id} - {cdr_data}")
|
||||
if not call_id:
|
||||
logger.warning("Cloudonix CDR missing call_id field")
|
||||
return {"status": "error", "message": "Missing call_id field"}
|
||||
|
||||
# Find organization by domain_id in telephony configuration
|
||||
organization_id = await db_client.get_organization_id_by_telephony_domain(domain)
|
||||
if not organization_id:
|
||||
logger.warning(f"No organization found with Cloudonix domain: {domain}")
|
||||
return {"status": "error", "message": "Organization not found for domain"}
|
||||
|
||||
# Find workflow run by call_id in gathered_context
|
||||
workflow_run = await db_client.get_workflow_run_by_call_id(call_id)
|
||||
if not workflow_run:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue