
    \dd                     h    d dl Z d dlZd dlmZ d dl  G d dej                  j                        Zy)    N)sha1)*c                       e Zd ZdZdZej                  j                  d        Zej                  j                  d        Z	d Z
y)TelphinViewz/pub/voip/telphinNc                 B     | j                   di t        j                  S N )_processrequestargsselfs    ./modules/voip/views/telphin.pygetzTelphinView.get       t}},w||,,    c                 B     | j                   di t        j                  S r   )r
   r   formr   s    r   postzTelphinView.post   r   r   c                    t         j                  d|        t        j                  j	                  t
        j                  j	                  d      g d      | _        |j	                  d      }| j                  r|rt         j                  |       |dv r | j                  j                  ||d          n|dk(  r%| j                  j                  ||d   |d	   
       nW|dk(  rR| j                  j                  ||d   |d	   
      }|j	                  d      r| j                  j                  ||       | j                  d      S )NzTelphin request: token)zplugin.ext_secretparentzplugin.ext_key)idfields	EventType)zdial-inzdial-outCallFlowanswer
CallStatus)call_statushangupRecID)channel_callzresponse.html)gdebugmodelsCmfPluginTelphinr   r   r   telphin	voip_callvoip_call_startvoip_call_endvoip_recordrender_with_params)r   kwargs
event_typer"   s       r   r
   zTelphinView._process   s   	#F8,-..22gll6F6Fw6O Yk2 lZZ,
<<JGGJ44&&vvj/ABx',,VVJ5GU[\hUi,jx'#||99&&BTbhiubv9w::g&LL,,V,,O&&77r   )__name__
__module____qualname____url__r'   cmfviewsactionr   r   r
   r	   r   r   r   r      sK    !GGYY- - 	YY- -8r   r   )	base64hmachashlibr   cmf.includer3   r4   BaseViewr   r	   r   r   <module>r;      s'       8#))$$ 8r   