HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/buyercall/buyercall/lib/__pycache__/util_bandwidth.cpython-310.pyc
o

�we@�@sLddlmZmZddlZddlmZddlZe�e	�Z
dd�Zddd�ZdS)	�)�session�current_appN)�	AESCipherc
Cs�z8|�d��dd��dd�}t�|��d��d�}|d}|d}tjd	}tjd
}||kr6||kr6WdSWdStyS}zt	�
d
�|��WYd}~dSd}~ww)N�
AuthorizationzBasic �� �ascii�:r��BANDWIDTH_CALLBACK_USERNAME�BANDWIDTH_CALLBACK_PASSWORDTFz6Bandwidth request authentication failed. Exception: {})�get�replace�base64�	b64decode�decode�split�app�config�	Exception�log�info�format)�auth_header�auth�auth_decoded�request_usr�request_pwd�
config_usr�
config_pwd�e�r!�>/home/arjun/projects/buyercall/buyercall/lib/util_bandwidth.py�authenticate_bw_request	s

��r#c
Cs�|}ddlm}ddlm}tjd}|�|�}t|�}|�|j	�}	|�|j
�}
|dkrKtjd}tjd}tjd}
tjd	}tjd
}tjd}n|�|j�}|jr[|�|j�}n|j}|j
}|j}
|j}|j}|||	|
|||
|||�	}|S)Nr)�PartnershipCpaasProviders)�	Bandwidth�CRYPTO_SECRET_KEY�mobile�SIP_BANDWIDTH_ACCOUNT_ID�SIP_BANDWIDTH_SITE_ID�SIP_BANDWIDTH_LOCATION_ID�"SIP_BANDWIDTH_VOICE_APPLICATION_ID� SIP_BANDWIDTH_SMS_APPLICATION_ID�SIP_BANDWIDTH_CNAM_PASSWORD)�'buyercall.blueprints.partnership.modelsr$�buyercall.lib.bandwidth_api_v2r%rr�!partnership_bandwidth_credentialsr�decrypt�cpaas_api_username�cpaas_api_password�cpaas_account_id�cpaas_cnam_password�
cpaas_site_id�cpaas_location_id�cpaas_sms_application_id�cpaas_voice_application_id)�partnership_id�request_type�tn_type�partnershipr$r%�encrypt_key�
partner_cpaas�cipher�decrypted_api_username�decrypted_api_password�decrypted_account_id�site_id�location_id�voice_application_id�sms_application_id�decrypted_cnam_password�clientr!r!r"�	bw_client sF






�rJ)NN)
�flaskrrrr�buyercall.lib.util_cryptor�logging�	getLogger�__name__rr#rJr!r!r!r"�<module>s