o
    y	i!                     @   s   d dl Z d dlZdd ZdS )    Nc                 C   s  zQd}| ||d}ddi}t j|||dd}|jdkr2td| d	|   td
|j  W dS td| d	|   td|j  td
|j  W dS  t jjyh   td| d	|   Y dS  t jj	y~   td| d	|   Y dS  t jj
y } ztd| d	|  dt|  W Y d}~dS d}~w ty } ztd|  dt|  W Y d}~dS d}~ww )z
    Main function to process call and send appropriate message
    
    Args:
        call_id: Call ID to process
        bid: Business ID for dynamic table naming
        data: Data to send
    z"http://10.0.0.109:4567/queue-calls)bidcall_iddatazContent-Typezapplication/json   )ZjsonheadersZtimeout   u!   ✅ Request sent successfully to z
 for bid: z
Response: u   ❌ Request failed to zStatus Code: u   ❌ Request timeout to u   ❌ Connection error to u   ❌ Request error to z: Nu.   ❌ Unexpected error sending request for bid: )requestsZpostZstatus_codelogginginfotexterror
exceptionsZTimeoutConnectionErrorZRequestExceptionstr	Exception)r   r   r   Zapi_urlZrequest_bodyr   Zresponsee r   services/call_rabbit.pysend_RabbitMessage   s>   	
.(r   )r   r	   r   r   r   r   r   <module>   s    