
[XMc           @   s`  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z m Z d d l	 m
 Z
 m Z d d l m Z d d l m Z d d l m Z d d l m Z m Z m Z d d	 l m Z d d l Z d d
 l m Z m Z d d l m Z d Z i	 d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6Z i  Z  x$ e j!   D] \ Z" Z# e" e  e# <qZW[" [# i5 d d  6d! d" 6d# d$ 6d% d& 6d' d( 6d) d* 6d+ d, 6d- d. 6d/ d0 6d1 d2 6d3 d4 6d5 d6 6d7 d8 6d9 d: 6d; d< 6d= d> 6d? d@ 6dA dB 6dC dD 6dE dF 6dG dH 6dI dJ 6dK dL 6dM dN 6dO dP 6dQ dR 6dS dT 6dU dV 6dW dX 6dY dZ 6d[ d\ 6d] d^ 6d_ d` 6da db 6dc dd 6de df 6dg dh 6di dj 6dk dl 6dm dn 6do dp 6dq dr 6ds dt 6du dv 6dw dx 6dy dz 6d{ d| 6d} d~ 6d d 6d d 6d d 6d d 6dC d 6Z$ i d d 6d d 6d d 6Z% d   Z& d   Z' d   Z( e e d d d d   e(  Z( d   Z) e e d d d d   e)  Z) e*   Z+ d e* f d     YZ, d   Z- d d d     YZ. d d d  Z0 d   Z1 d d d d  Z2 d e3 f d     YZ4 d e4 f d     YZ5 d d d     YZ6 d e6 f d     YZ7 d e6 f d     YZ8 d e j9 f d     YZ: d e j; f d     YZ< d e f d     YZ= d d d     YZ> d e f d     YZ? d e f d     YZ@ d e< f d     YZA d e f d     YZB d d d     YZC d e f d     YZD d d d     YZE d eA f d     YZF d d d     YZG d S(   s   Session Initialization Protocol.

Documented in RFC 2543.
[Superceded by 3261]


This module contains a deprecated implementation of HTTP Digest authentication.
See L{twisted.cred.credentials} and L{twisted.cred._digest} for its new home.
iN(   t
   implementst	   Interface(   t   logt   util(   t
   deprecated(   t   Version(   t   md5(   t   protocolt   defert   reactor(   t   cred(   t   UsernameHashedPasswordt   UsernamePassword(   t   basici  t   is   call-idt   mt   contactt   es   content-encodingt   ls   content-lengtht   cs   content-typet   ft   fromt   st   subjectt   tt   tot   vt   viat   Tryingid   t   Ringingi   s   Call Is Being Forwardedi   t   Queuedi   s   Session Progressi   t   OKi   s   Multiple Choicesi,  s   Moved Permanentlyi-  s   Moved Temporarilyi.  s	   See Otheri/  s	   Use Proxyi1  s   Alternative Servicei|  s   Bad Requesti  t   Unauthorizedi  s   Payment Requiredi  t	   Forbiddeni  s	   Not Foundi  s   Method Not Allowedi  s   Not Acceptablei  s   Proxy Authentication Requiredi  s   Request Timeouti  t   Conflicti  t   Gonei  s   Length Requiredi  s   Request Entity Too Largei  s   Request-URI Too Largei  s   Unsupported Media Typei  s   Unsupported URI Schemei  s   Bad Extensioni  s   Extension Requiredi  s   Interval Too Briefi  s   Temporarily Unavailablei  s   Call/Transaction Does Not Existi  s   Loop Detectedi  s   Too Many Hopsi  s   Address Incompletei  t	   Ambiguousi  s	   Busy Herei  s   Request Terminatedi  s   Not Acceptable Herei  s   Request Pendingi  t   Undecipherablei  s   Internal Server Errori  s   Not Implementedi  s   Bad Gatewayi  s   Service Unavailablei  s   Server Time-outi  s   SIP Version not supportedi  s   Message Too Largei  s   Busy EverywhereiX  t   Declinei[  s   Does not exist anywherei\  i^  t   CSeqt   cseqs   Call-IDs   WWW-Authenticates   www-authenticatec         C   s/   d j  g  |  j d  D] } | j   ^ q  S(   sA    Capitalize a string, making sure to treat - as a word seperator t   -(   t   joint   splitt
   capitalize(   R   t   x(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   dashCapitalize{   s    c         C   s3   |  d |  d k o d k n r/ |  d d !S|  S(   Ni    it   "i   (    (   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   unq   s    $c         C   s   t    } | j |  | j d  | j |  | j d  | j |  | j   } |  d k r t    } | j |  | j d  | j |  | j d  | j |  | j   } n  | j d  S(   Nt   :s   md5-sesst   hex(   R   t   updatet   digestt   encode(   t   pszAlgt   pszUserNamet   pszRealmt   pszPasswordt   pszNoncet	   pszCNonceR   t   HA1(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   DigestCalcHA1   s     		t   Twistedi	   i    c         C   s.  t    } | j |  | j d  | j |  | d k rY | j d  | j |  n  | j   j d  }	 t    } | j |   | j d  | j |  | j d  | r| r| j |  | j d  | j |  | j d  | j |  | j d  n  | j |	  | j   j d  }
 |
 S(   NR1   s   auth-intR2   (   R   R3   R4   R5   (   R<   R:   t   pszNonceCountR;   t   pszQopt	   pszMethodt   pszDigestUrit
   pszHEntityR   t   HA2t   hash(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   DigestCalcResponse   s.    
		t   Viac        	   B   sY   e  Z d  Z e d d e d e d d d  Z d   Z d   Z	 e
 e e	  Z d   Z RS(   s  
    A L{Via} is a SIP Via header, representing a segment of the path taken by
    the request.

    See RFC 3261, sections 8.1.1.7, 18.2.2, and 20.42.

    @ivar transport: Network protocol used for this leg. (Probably either "TCP"
    or "UDP".)
    @type transport: C{str}
    @ivar branch: Unique identifier for this request.
    @type branch: C{str}
    @ivar host: Hostname or IP for this leg.
    @type host: C{str}
    @ivar port: Port used for this leg.
    @type port C{int}, or None.
    @ivar rportRequested: Whether to request RFC 3581 client processing or not.
    @type rportRequested: C{bool}
    @ivar rportValue: Servers wishing to honor requests for RFC 3581 processing
    should set this parameter to the source port the request was received
    from.
    @type rportValue: C{int}, or None.

    @ivar ttl: Time-to-live for requests on multicast paths.
    @type ttl: C{int}, or None.
    @ivar maddr: The destination multicast address, if any.
    @type maddr: C{str}, or None.
    @ivar hidden: Obsolete in SIP 2.0.
    @type hidden: C{bool}
    @ivar otherParams: Any other parameters in the header.
    @type otherParams: C{dict}
    t   UDPc
         K   s   | |  _  | |  _ | |  _ | |  _ | |  _ | |  _ | t k rm t j d t	 d d d |  _ t |  _ nT | d k r d |  _ t |  _ n3 | t k r d |  _ t |  _ n | |  _ t |  _ | |  _ |	 |  _ |
 |  _ d S(   s(  
        Set parameters of this Via header. All arguments correspond to
        attributes of the same name.

        To maintain compatibility with old SIP
        code, the 'rport' argument is used to determine the values of
        C{rportRequested} and C{rportValue}. If None, C{rportRequested} is set
        to True. (The deprecated method for doing this is to pass True.) If an
        integer, C{rportValue} is set to the given value.

        Any arguments not explicitly named here are collected into the
        C{otherParams} dict.
        s+   rport=True is deprecated since Twisted 9.0.t
   stackleveli   N(   t	   transportt   hostt   portt   ttlt   hiddent   receivedt   Truet   warningst   warnt   DeprecationWarningt   Nonet
   rportValuet   rportRequestedt   _absentt   Falset   brancht   maddrt   otherParams(   t   selfRK   RL   RJ   RM   RN   RO   t   rportRY   RZ   t   kw(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   __init__   s0    													c         C   s1   |  j  t k r t S|  j d k	 r) |  j Sd Sd S(   sG   
        Returns the rport value expected by the old SIP code.
        N(   RV   RP   RU   RT   (   R\   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt	   _getrport  s
    c         C   s   | |  _  t |  _ d S(   s   
        L{Base._fixupNAT} sets C{rport} directly, so this method sets
        C{rportValue} based on that.

        @param newRPort: The new rport value.
        @type newRPort: C{int}
        N(   RU   RX   RV   (   R\   t   newRPort(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt	   _setrport!  s    	c         C   s  d |  j  |  j |  j f } |  j r2 | d 7} n  x@ d D]8 } t |  |  } | d k	 r9 | d | | f 7} q9 q9 W|  j r | d 7} n& |  j d k	 r | d	 |  j f 7} n  |  j	 j
   } | j   xE | D]= \ } } | d k r | d
 | 7} q | d | | f 7} q W| S(   sI   
        Serialize this header for use in a request or response.
        s   SIP/2.0/%s %s:%ss   ;hiddenRM   RY   RZ   RO   s   ;%s=%ss   ;rports	   ;rport=%st   ;(   s   ttls   branchs   maddrs   receivedN(   RJ   RK   RL   RN   t   getattrRT   RV   RU   R]   R[   t   itemst   sort(   R\   R   t   nt   valuet   etct   kR   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   toString/  s$    		
N(   t   __name__t
   __module__t   __doc__t   PORTRT   RX   RW   R_   R`   Rb   t   propertyR]   Rk   (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyRG      s   	*		c         C   s  |  j  d  } | d | d } } | j  d d  \ } } | j   } i  } | j  d  \ } } }	 | d k s~ | d k r t d |   n  |	 | d	 <d
 | k r | j  d
  \ }
 } t |  | d <|
 | d <n
 | | d <x | D] } | j   j  d d  } t |  d k r+| d d } } n | \ } } | d k rSt | d <q n  | j  d d  } t |  d k r| d d } }  n' | \ } }  | d k rt |   }  n  |  | | <q Wt |   S(   sa   
    Parse a Via header.

    @return: The parsed version of this header.
    @rtype: L{Via}
    Rc   i    i   t    t   /t   SIPs   2.0s   wrong protocol or version: %rRJ   R1   RL   RK   t    RN   t   =R]   RM   N(   s   rports   ttl(   R+   t   stript
   ValueErrort   intt   lenRP   RT   RG   (   Rh   t   partst   sentt   paramst   protocolinfot   byt   resultt   pnamet   pversionRJ   RK   RL   t   pt   commentt   name(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   parseViaHeaderI  s<    


t   URLc           B   sS   e  Z d  Z d d d d d d d d d d d d  Z d   Z d   Z d   Z RS(   s
   A SIP URL.c         C   s   | |  _  | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ |
 |  _ | |  _ |	 |  _	 | d  k rr g  |  _ n	 | |  _ | d  k r i  |  _ n	 | |  _ d  S(   N(   t   usernameRK   t   passwordRL   RJ   t   usertypet   methodt   tagRM   RZ   RT   t   othert   headers(   R\   RK   R   R   RL   RJ   R   R   RM   RZ   R   R   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR_   w  s     											c         C   s  g  } | j  } | d  |  j d  k re | |  j  |  j d  k rX | d |  j  n  | d  n  | |  j  |  j d  k r | d |  j  n  |  j d  k r | d |  j  n  x@ d D]8 } t |  |  } | d  k r | d | | f  q q Wx |  j D] } | d |  qW|  j	 r| d  | d j
 g  |  j	 j   D]1 \ } } d t j |  ppt |  | f ^ qI  n  d j
 |  S(   Ns   sip:s   :%st   @s   :%ds   ;user=%sRJ   RM   RZ   R   R   s   ;%s=%ss   ;%st   ?t   &s   %s=%sRt   (   s	   transports   ttls   maddrs   methods   tag(   t   appendR   RT   R   RK   RL   R   Rd   R   R   R*   Re   t   specialCasest   getR.   (   R\   R   t   wRg   R   t   h(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyRk     s.     	
	
Wc         C   s
   |  j    S(   N(   Rk   (   R\   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   __str__  s    c         C   s&   d |  j  |  j |  j |  j |  j f S(   Ns   <URL %s:%s@%s:%r/%s>(   R   R   RK   RL   RJ   (   R\   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   __repr__  s    N(   Rl   Rm   Rn   RT   R_   Rk   R   R   (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR   t  s   				c         C   s  i  } |  j  d  s, t d |  d    n  |  d j d  } | d | d } } | j d d  } t |  d k r | \ } }	 | j d	 d  }
 t |
  d k r |
 d | d
 <q |
 d | d
 <|
 d | d <n
 | d }	 |	 j d	 d  } t |  d k r| d | d <n" | d | d <t | d  | d <| d k rR| | d <n  | d k rk| | d <n  xA| D]9} | | d k rd | k ri  | d <} | j d d  \ } } x9 | j d  D]% } | j d  \ } } | | | <qWn  | j d d  } t |  d k r9| j d g   j |  qrn  | \ } } | d k r^| | d <qr| d k r| d k rt |  } n  | | | <qr| j d g   j |  qrWt |   S(   sT   Return string into URL object.

    URIs are of of form 'sip:user@example.com'.
    s   sip:s   unsupported scheme: i   Rc   i    i   R   i   R1   R   R   RK   RL   iR   R   R   Ru   R   t   userR   RJ   RM   RZ   R   R   N(   s	   transports   ttls   maddrs   methods   tag(	   t
   startswithRw   R+   Ry   Rx   RT   t
   setdefaultR   R   (   t   urlRK   RL   t   dRz   t
   userdomainR|   t   udpartst   userpasst   hostportt   uppartst   hppartsR   R   R   t   headerRj   R   t   nvR   Rh   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   parseURL  sV    
c         C   s(   d |  _ d |  _ d |  _ i  |  _ d S(   s    Clean a URL from a Request line.N(   RT   RJ   RZ   RM   R   (   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   cleanRequestURL  s    			c         C   s`  |  j    }  |  j d  r: d t |  d | d | i  f Si  } |  j d d  \ } } | j    } | j d  r | d } n  | j d  r | d  } n  | j d	 d  \ } } t | d | d | } | j    } | r&xE | j d
  D]1 } | s q n  | j d  \ }	 }
 |
 | |	 <q Wn  | rSd | _ i  | _ d | _ d | _	 n  | | | f S(   s   Return (name, uri, params) for From/To/Contact header.

    @param clean: remove unnecessary info, usually for From and To headers.
    s   sip:Rt   RK   RL   t   <i   R/   it   >Rc   Ru   N(
   Rv   R   R   R+   t   endswithRT   RM   R   RJ   RZ   (   t   addressRK   RL   t   cleanR|   R   R   t   paramstringR   Rj   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   parseAddress  s2    			t   SIPErrorc           B   s   e  Z d d   Z RS(   c         C   sI   | d  k r t | } n  t j |  d | | f  | |  _ | |  _ d  S(   Ns   SIP error (%d): %s(   RT   t   statusCodest	   ExceptionR_   t   codet   phrase(   R\   R   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR_     s
    	N(   Rl   Rm   RT   R_   (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR     s   t   RegistrationErrorc           B   s   e  Z d  Z RS(   s   Registration was not possible.(   Rl   Rm   Rn   (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR     s   t   Messagec           B   sJ   e  Z d  Z d Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 RS(   s   A SIP message.c         C   s%   t  j   |  _ d |  _ d |  _ d  S(   NRt   i    (   R   t   OrderedDictR   t   bodyt   finished(   R\   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR_     s    	c         C   s\   | j    } t j | |  } | d k r< t |  |  _ n  |  j j | g   j |  d  S(   Ns   content-length(   t   lowert   longHeadersR   Rx   t   lengthR   R   R   (   R\   R   Rh   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt	   addHeader#  s
    c         C   s   |  j  | 7_  d  S(   N(   R   (   R\   t   data(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   bodyDataReceived*  s    c         C   s@   |  j  d  k r3 |  j  t |  j  k r3 t d  n  d |  _ d  S(   Ns   wrong body lengthi   (   R   RT   Ry   R   Rw   R   (   R\   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   creationFinished-  s    'c         C   s   d |  j    } xW |  j j   D]F \ } } x7 | D]/ } | d t j |  pW t |  | f 7} q3 Wq  W| d 7} | |  j 7} | S(   Ns   %s
s   %s: %s
s   
(   t   _getHeaderLineR   Re   R   R   R.   R   (   R\   R   Rg   t   vsR   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyRk   2  s    1
c         C   s
   t   d  S(   N(   t   NotImplementedError(   R\   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR   ;  s    N(   Rl   Rm   Rn   RT   R   R_   R   R   R   Rk   R   (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR     s   						t   Requestc           B   s,   e  Z d  Z d d  Z d   Z d   Z RS(   s   A Request for a URIs   SIP/2.0c         C   sQ   t  j |   | |  _ t | t  r1 | |  _ n t |  |  _ t |  j  d  S(   N(   R   R_   R   t
   isinstanceR   t   uriR   R   (   R\   R   R   t   version(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR_   C  s    	c         C   s#   d t  |   |  j |  j j   f S(   Ns   <SIP Request %d:%s %s>(   t   idR   R   Rk   (   R\   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR   L  s    c         C   s   d |  j  |  j j   f S(   Ns   %s %s SIP/2.0(   R   R   Rk   (   R\   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR   O  s    (   Rl   Rm   Rn   R_   R   R   (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR   ?  s   		t   Responsec           B   s/   e  Z d  Z d d d  Z d   Z d   Z RS(   s   A Response to a URI Requests   SIP/2.0c         C   s<   t  j |   | |  _ | d  k r/ t | } n  | |  _ d  S(   N(   R   R_   R   RT   R   R   (   R\   R   R   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR_   V  s
    	c         C   s   d t  |   |  j f S(   Ns   <SIP Response %d:%s>(   R   R   (   R\   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR   ]  s    c         C   s   d |  j  |  j f S(   Ns   SIP/2.0 %s %s(   R   R   (   R\   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR   `  s    N(   Rl   Rm   Rn   RT   R_   R   R   (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR   S  s   	t   MessagesParserc           B   s   e  Z d  Z d Z d Z d Z d Z d Z d   Z d d  Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d d  Z d   Z RS(   s   A SIP messages parser.

    Expects dataReceived, dataDone repeatedly,
    in that order. Shouldn't be connected to actual transport.
    s   SIP/2.0i   t	   firstlinei    c         C   s   | |  _  |  j   d  S(   N(   t   messageReceivedt   reset(   R\   t   messageReceivedCallback(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR_   r  s    	Rt   c         C   s5   d |  _  d  |  _ d |  _ d  |  _ |  j |  d  S(   NR   i    (   t   stateRT   R   t   bodyReceivedt   messaget   setLineMode(   R\   t   remainingData(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR   v  s
    				c         C   s   d |  _  |  j   d  S(   Nt   invalid(   R   t
   setRawMode(   R\   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   invalidMessage}  s    	c         C   s   |  j    |  j d k r d  S|  j d k r: |  j   d  S|  j d  k rV |  j   n( |  j |  j k  ru |  j   n	 t d  d  S(   NR   R   s   this should never happen(   t   clearLineBufferR   R   R   RT   t   messageDoneR   t   RuntimeError(   R\   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   dataDone  s    

c         C   s9   y t  j j |  |  Wn t j   |  j   n Xd  S(   N(   R   t   LineReceivert   dataReceivedR   t   errR   (   R\   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR     s
    
c         C   s
   t   d S(   s    Expected to create self.message.N(   R   (   R\   t   line(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   handleFirstLine  s    c         C   s   |  j    d  S(   N(   R   (   R\   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   lineLengthExceeded  s    c         C   s  |  j  d k r$x, | j d  s0 | j d  r= | d } q W| sH d  Sy | j d d  \ } } } Wn t k
 r |  j   d  SX| d k r |  j r y t |  } Wn t k
 r |  j   d  SXt | |  |  _ n8 | d k r	|  j	 r	t
 | |  |  _ n |  j   d  Sd |  _  d  S|  j  d k s9t  | ry | j d	 d  \ } } Wn t k
 ry|  j   d  SX|  j j | | j    | j   d
 k ry t | j    |  _ Wqt k
 r|  j   d  SXqn0 d |  _  |  j d k r	|  j   d  S|  j   d  S(   NR   s   
s   i   Rq   i   s   SIP/2.0R   R1   s   content-lengthR   i    (   R   R   R+   Rw   R   t   acceptResponsesRx   R   R   t   acceptRequestsR   t   AssertionErrorR   t   lstripR   R   R   R   (   R\   R   t   at   bR   R   R   Rh   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   lineReceived  sT    !


	

	
c         C   sC   |  j  d k s t  |  j j   |  j |  j  |  j |  d  S(   NR   (   R   R   R   R   R   R   (   R\   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR     s    c         C   s   |  j  d k s t  |  j  d k r( d  S|  j d  k rJ |  j j |  n t |  } |  j |  j } | | k r |  j j | |   |  j | |  d  S|  j | 7_ |  j j |  |  j |  j k r |  j   n  d  S(   NR   R   (   s   bodys   invalid(	   R   R   R   RT   R   R   Ry   R   R   (   R\   R   t   dataLent   expectedLen(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   rawDataReceived  s    (   Rl   Rm   Rn   R   R   R   R   t   debugR_   R   R   R   R   R   R   R   R   R   (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR   d  s    							4t   Basec           B   sk   e  Z d  Z e Z e Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z d   Z d	   Z RS(
   s'   Base class for SIP clients and servers.c         C   s   g  |  _  t |  j  |  _ d  S(   N(   t   messagesR   t
   addMessaget   parser(   R\   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR_     s    	c         C   s   |  j  j |  d  S(   N(   R   R   (   R\   t   msg(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR     s    c         C   s   |  j  j |  |  j  j   x| |  j D]q } |  j | |  |  j rf t j d | j   | f  n  t	 | t
  r |  j | |  q' |  j | |  q' Wg  |  j (d  S(   Ns   Received %r from %r(   R   R   R   R   t	   _fixupNATR   R   R   Rk   R   R   t   handle_requestt   handle_response(   R\   R   t   addrR   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   datagramReceived  s    	 c         C   s   | \ } } t  | j d d  } | j | k rp | | _ | j | k rV | | _ n  | j   | j d d <n; | j t k r | | _ | | _ | j   | j d d <n  d  S(   NR   i    (   R   R   RK   RO   RL   R]   Rk   RP   (   R\   R   t   .2t   srcHostt   srcPortt	   senderVia(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR   	  s    				c         C   sm   t  | j d d  } | j p& | j } | j pA | j pA |  j } t d | d |  } |  j | |  d S(   sF   Deliver response.

        Destination is based on topmost Via header.R   i    RK   RL   N(	   R   R   RO   RK   R]   RL   Ro   R   t   sendMessage(   R\   t   responseMessaget   destViaRK   RL   t   destAddr(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   deliverResponse  s
    c         C   s>   t  |  } x+ d D]# } | j j | g   | j | <q W| S(   s'   Create a response to a request message.R   R   R   s   call-idR(   (   s   viaR   R   s   call-idR(   (   R   R   R   (   R\   R   t   requestt   responseR   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   responseFromRequest!  s    !c         C   sv   | j  d k r t d  n  |  j rD t j d | j   | f  n  |  j  j | j   | j | j	 pk |  j
 f  d S(   s   Send a message.

        @param destURL: C{URL}. This should be a *physical* URL, not a logical one.
        @param message: The message to send.
        t   udps   only UDP currently supporteds   Sending %r to %rN(   R   N(   RJ   RT   R   R   R   R   Rk   t   writeRK   RL   Ro   (   R\   t   destURLR   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR   )  s
    	 c         C   s
   t   d S(   sz   Override to define behavior for requests received

        @type message: C{Message}
        @type addr: C{tuple}
        N(   R   (   R\   R   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR   5  s    c         C   s
   t   d S(   s|   Override to define behavior for responses received.

        @type message: C{Message}
        @type addr: C{tuple}
        N(   R   (   R\   R   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR   =  s    (   Rl   Rm   Rn   Ro   RX   R   R_   R   R   R   R   R   R   R   R   (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR     s   								t   IContactc           B   s   e  Z d  Z RS(   s   A user of a registrar or proxy(   Rl   Rm   Rn   (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR  F  s   t   Registrationc           B   s   e  Z d    Z RS(   c         C   s   | |  _  | |  _ d  S(   N(   t   secondsToExpiryt
   contactURL(   R\   R  R  (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR_   K  s    	(   Rl   Rm   R_   (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR  J  s   t	   IRegistryc           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   s5   Allows registration of logical->physical URL mapping.c         C   s   d S(   s   Register the physical address of a logical URL.

        @return: Deferred of C{Registration} or failure with RegistrationError.
        N(    (   t	   domainURLt
   logicalURLt   physicalURL(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   registerAddressR  s    c         C   s   d S(   s   Unregister the physical address of a logical URL.

        @return: Deferred of C{Registration} or failure with RegistrationError.
        N(    (   R  R	  R
  (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   unregisterAddressX  s    c         C   s   d S(   s   Get registration info for logical URL.

        @return: Deferred of C{Registration} object or failure of LookupError.
        N(    (   R	  (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   getRegistrationInfo^  s    (   Rl   Rm   Rn   R  R  R  (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR  O  s   		t   ILocatorc           B   s   e  Z d  Z d   Z RS(   s2   Allow looking up physical address for logical URL.c         C   s   d S(   s   Return physical URL of server for logical URL of user.

        @param logicalURL: a logical C{URL}.
        @return: Deferred which becomes URL or fails with LookupError.
        N(    (   R	  (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt
   getAddressh  s    (   Rl   Rm   Rn   R  (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR  e  s   t   Proxyc           B   sq   e  Z d  Z e Z d
 Z d
 e d  Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z d   Z d	   Z RS(   s
   SIP proxy.c         C   s/   | p t  j   |  _ | |  _ t j |   d S(   s   Create new instance.

        @param host: our hostname/IP as set in Via headers.
        @param port: our port as set in Via headers.
        N(   t   sockett   getfqdnRK   RL   R   R_   (   R\   RK   RL   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR_   w  s    	c         C   s   t  d |  j d |  j  S(   s*   Return value of Via header for this proxy.RK   RL   (   RG   RK   RL   (   R\   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   getVia  s    c            s   t    d  j d   } | d  k r1   j } n  y |  |  } WnX t k
 ru }   j   j | j    nR t j	     j   j d    n) X| d  k	 r | j
    f d    n  d  S(   Ns   handle_%s_requesti  c            s     j    j |  j    S(   N(   R   R   R   (   R   (   R\   R   (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   <lambda>  s    (   Rd   R   RT   t   handle_request_defaultR   R   R   R   R   R   t
   addErrback(   R\   R   R   R   R   R   (    (   R\   R   s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR     s    
c            s   | \ } }   f d   }   j    } | j   | j d k rQ t j d  d S| j d j d | j    t | j d d d d \ } } }	   j j |  }
 |
 j	   j
 |  |
 j   j |  d S(	   s   Default request handler.

        Default behaviour for OPTIONS and unknown methods for proxies
        is to forward message on to the client.

        Since at the moment we are stateless proxy, thats basically
        everything.
        c            s'   |  j    | j d d <  j |  |  S(   NR   i    (   Rk   R   R   (   R   R   (   R\   (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   _mungContactHeader  s    R   s   Dropping looped message.Ni    R   R   i   (   R  Rk   R   R   R   t   insertR   t   locatorR  t   addCallbackR   R  t   _cantForwardRequest(   R\   R   R   R   R   R  t	   viaHeaderR   R   t   tagsR   (    (   R\   s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR    s    		&c         C   s8   | j  t  | j d d =|  j |  j d |   d  S(   NR   i    i  (   t   trapt   LookupErrorR   R   R   (   R\   t   errorR   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR    s    c         C   sm   t  | j d d  } | j p& | j } | j pA | j pA |  j } t d | d |  } |  j | |  d S(   sF   Deliver response.

        Destination is based on topmost Via header.R   i    RK   RL   N(	   R   R   RO   RK   R]   RL   Ro   R   R   (   R\   R   R   RK   RL   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR     s
    c         C   s>   t  |  } x+ d D]# } | j j | g   | j | <q W| S(   s'   Create a response to a request message.R   R   R   s   call-idR(   (   s   vias   tos   froms   call-ids   cseq(   R   R   R   (   R\   R   R   R   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR     s    !c         C   s   t  | j d d  } | j | j f |  j |  j f k rL t j d  d S| j d d =| j d s{ |  j | |  d S|  j |  d S(   s   Default response handler.R   i    s&   Dropping incorrectly addressed messageN(   R   R   RK   RL   R   R   t   gotResponseR   (   R\   R   R   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR     s    $c         C   s   d S(   s8   Called with responses that are addressed at this server.N(    (   R\   R   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR!    s    N(   Rl   Rm   Rn   Ro   RT   R  R_   R  R   R  R  R   R   R   R!  (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR  p  s   
							t   IAuthorizerc           B   s   e  Z d    Z d   Z RS(   c         C   s   d S(   s   Generate a challenge the client may respond to.

        @type peer: C{tuple}
        @param peer: The client's address

        @rtype: C{str}
        @return: The challenge string
        N(    (   t   peer(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   getChallenge  s    c         C   s   d S(   s]   Create a credentials object from the given response.

        @type response: C{str}
        N(    (   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   decode  s    (   Rl   Rm   R$  R%  (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR"    s   	
t   BasicAuthorizerc           B   s3   e  Z d  Z e e  d   Z d   Z d   Z RS(   s   Authorizer for insecure Basic (base64-encoded plaintext) authentication.

    This form of authentication is broken and insecure.  Do not use it.
    c         C   s   t  j d d t d d d S(   sK   
        This method exists solely to issue a deprecation warning.
        sE   twisted.protocols.sip.BasicAuthorizer was deprecated in Twisted 9.0.0t   categoryRI   i   N(   RQ   RR   RS   (   R\   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR_     s    c         C   s   d  S(   N(   RT   (   R\   R#  (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR$    s    c         C   s   xF t  d  D], } y | d | j d  } Wn q XPq Wt d   | j d d  } t |  d k rw t |   St d   d  S(   Ni   Ru   t   base64i  R1   i   i   (   t   rangeR%  R   R+   Ry   R   (   R\   R   R   t   credsR   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR%    s    
(   Rl   Rm   Rn   R    R"  R_   R$  R%  (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR&    s
   
		t   DigestedCredentialsc           B   s    e  Z d  Z d   Z d   Z RS(   s3   Yet Another Simple Digest-MD5 authentication schemec         C   s8   t  j d d t d d | |  _ | |  _ | |  _ d  S(   NsI   twisted.protocols.sip.DigestedCredentials was deprecated in Twisted 9.0.0R'  RI   i   (   RQ   RR   RS   R   t   fieldst
   challenges(   R\   R   R,  R-  (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR_     s    		c      	   C   s-  d } |  j  j d  } |  j  j d  } |  j  j d  } |  j  j d  } |  j  j d  } |  j  j d d  } |  j  j d	 d
  }	 |  j  j d  }
 |
 |  j k r t S|  j |
 =|  j j d d  \ } } | d  k r d | } n  t t | | | | | |  | | | |	 | | d   } | | k S(   Nt   REGISTERR   R   t   noncet   cnoncet   nct	   algorithmt   MD5s   qop-optionst   autht   opaqueR   i   s   sip:(	   R,  R   R-  RX   R   R+   RT   RF   R=   (   R\   R   R   R   R   R/  R0  R1  t   algot   qopR5  R   t   domaint   expected(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   checkPassword&  s&    
(   Rl   Rm   Rn   R_   R:  (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR+    s   	
t   DigestAuthorizerc           B   sE   e  Z d  Z e e  d   Z d   Z d   Z d   Z d   Z	 RS(   i   c         C   s&   t  j d d t d d i  |  _ d  S(   NsF   twisted.protocols.sip.DigestAuthorizer was deprecated in Twisted 9.0.0R'  RI   i   (   RQ   RR   RS   t   outstanding(   R\   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR_   E  s
    c         C   s?   t  g  t d  D] } t j t j  ^ q  } d | } | S(   Ni   s   %d%d%d(   t   tupleR)  t   randomt	   randranget   syst   maxint(   R\   t   _R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   generateNonceP  s    1
c         C   s   t  t j t j   S(   N(   t   strR>  R?  R@  RA  (   R\   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   generateOpaqueU  s    c         C   sF   |  j    } |  j   } | |  j | <d j d | d | d d f  S(   Nt   ,s
   nonce="%s"s   opaque="%s"s   qop-options="auth"s   algorithm="MD5"(   RC  RE  R<  R*   (   R\   R#  R   t   o(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR$  X  s    c         C   s   d j  | j    } | j d  } t g  g  | D] } | j d d  ^ q1 D]* \ } } | j   t | j    f ^ qM  } y | d } Wn t k
 r t d   n Xy t | | |  j	  SWn t d   n Xd  S(   NRq   RF  Ru   i   R   i  i  (
   R*   t
   splitlinesR+   t   dictRv   R0   t   KeyErrorR   R+  R<  (   R\   R   Rz   R   Rj   R   R4  R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR%  c  s    \(
   Rl   Rm   t   CHALLENGE_LIFETIMER    R"  R_   RC  RE  R$  R%  (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR;  @  s   
				t   RegisterProxyc           B   s   e  Z d  Z d Z d Z i  Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z d   Z d   Z d	   Z d
   Z d   Z d   Z d   Z RS(   sf   A proxy that allows registration for a specific domain.

    Unregistered users won't be handled.
    c         O   sB   t  j |  | |  i  |  _ d |  j k r> t   |  j d <n  d  S(   NR4   (   R  R_   t   liveChallengest   authorizersR;  (   R\   t   argsR^   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR_   }  s    	c         C   s   | \ } } d  S(   N(    (   R\   R   R   RK   RL   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   handle_ACK_request  s    	c         C   sm   | \ } } |  j  d k r1 |  j | | |  n8 | j j d  sV |  j | | |  S|  j | | |  Sd S(   sW   Handle a registration request.

        Currently registration is not proxied.
        t   authorizationN(   t   portalRT   t   registerR   t   has_keyt   unauthorizedt   login(   R\   R   R   RK   RL   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   handle_REGISTER_request  s    	c   	      C   s   |  j  d |  } x |  j j   D] \ } } | j | | f  } | d  k rk d | j   |  j f } n d | j   | |  j f } | j j d g   j	 |  q" W|  j
 |  d  S(   Ni  s   %s realm="%s"s   %s %s,realm="%s"s   www-authenticate(   R   RN  t	   iteritemsR$  RT   t   titleRK   R   R   R   R   (	   R\   R   RK   RL   R   t   schemeR4  t   chalRh   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyRU    s     c         C   s  | j  d d j d  d  } |  j j | d j    } | r y | j | d  } Wn= t k
 rl   qt j	   |  j
 |  j d |   qX| j d |  j 7_ |  j j | d  t  j |  j | | |  j |  j | | |  j t j	  n |  j
 |  j d |   d  S(   NRQ  i    i   i  R   i  (   R   R+   RT   RN  R   R   R%  R   R   R   R   R   R   RK   RR  RV  R  R  t   _cbLoginR  t   _ebLogin(   R\   R   RK   RL   Rz   R   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyRV    s     
c         C   s&   | \ } } } |  j  | | |  d  S(   N(   RS  (   R\   t   .1R   RK   RL   R   R   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR\    s    c         C   s*   | j  t j j  |  j | | |  d  S(   N(   R  R
   R   t   UnauthorizedLoginRU  (   R\   t   failureR   RK   RL   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR]    s    c   
      C   s  t  | j d d d d \ } } } d } | j j d  rR | j d d } n  | j j d d g  d d k r |  j | | |  n | d k	 r t  | d | d	 | \ } } } |  j j | j | |  }	 n |  j j	 |  }	 |	 j
 |  j |  j d
 | f d | f d S(   s   Allow all users to registerR   i    R   i   R   t   expirest   0RK   RL   t   callbackArgst   errbackArgsN(   R   R   RT   RT  R   t
   unregistert   registryR  R   R  t   addCallbackst   _cbRegistert   _ebRegister(
   R\   R   RK   RL   R   t   toURLR|   R   R  R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyRS    s    &"!	c         C   su   |  j  d |  } | j d  k rT | j d | j j    | j d d | j  n  | j d d  |  j |  d  S(   Ni   R   Ra  s   %ds   content-lengthRb  (   R   R  RT   R   Rk   R  R   (   R\   t   registrationR   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyRh    s    c         C   s   | j  t t  d  S(   N(   R  R   R  (   R\   R   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyRi    s    c   	      C   s   y t  | j d d  } Wn* t k
 rG |  j |  j d |   nw X| d k r | d k ri d } n t |  \ } } } |  j j | j | |  } | j	 |  j
 |  j |  j |  n  d  S(   NRa  i    i  t   *(   Rx   R   Rw   R   R   R   Rf  R  R   R  t   _cbUnregisterR  t   _ebUnregister(	   R\   R   Rj  R   Ra  R  R   R|   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyRe    s    	c         C   sX   |  j  d |  } | j j d g   j | j j    | j d d  |  j |  d  S(   Ni   R   Ra  Rb  (   R   R   R   R   R  Rk   R   R   (   R\   Rk  R   R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyRm    s    %c         C   s   d  S(   N(    (   R\   Rk  R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyRn    s    N(   Rl   Rm   Rn   RT   RR  Rf  RN  R_   RP  RW  RU  RV  R\  R]  RS  Rh  Ri  Re  Rm  Rn  (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyRL  q  s"   												t   InMemoryRegistryc           B   sQ   e  Z d  Z e e e  d   Z d   Z d   Z d   Z	 d   Z
 d   Z RS(   s,   A simplistic registry for a specific domain.c         C   s   | |  _  i  |  _ d  S(   N(   R8  t   users(   R\   R8  (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR_     s    	c         C   st   | j  |  j k r% t j t d   S|  j j | j  r] |  j | j \ } } t j |  St j t d   Sd  S(   Ns   unknown domains   no such user(	   RK   R8  R   t   failR  Rp  RT  R   t   succeed(   R\   t   userURIt   dcR   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR  	  s    c         C   s   | j  |  j k r% t j t d   S|  j j | j  r| |  j | j \ } } t j t	 t
 | j   t j    |   St j t d   Sd  S(   Ns   unknown domains   no such user(   RK   R8  R   Rq  R  Rp  RT  R   Rr  R  Rx   t   getTimet   time(   R\   Rs  Rt  R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR    s    ,c         C   se   y |  j  | \ } } Wn! t k
 r: t j t d   SX| j   |  j  | =t j t d |   S(   Ns   no such useri    (   Rp  RJ  R   Rq  R  t   cancelRr  R  (   R\   R   Rt  R   (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   _expireRegistration  s    

c         C   s  | j  |  j k r2 t j d  t j t d   S| j  |  j k rd t j d  t j t d   S|  j j | j	  r |  j | j	 \ } } | j
 d  n t j d |  j | j	  } t j d | j   | j   f  | | f |  j | j	 <t j t t | j   t j    |   S(   Ns(   Registration for domain we don't handle.i  i  s   Registered %s at %s(   RK   R8  R   R   R   Rq  R   Rp  RT  R   R   R	   t	   callLaterRx  Rk   Rr  R  Rx   Ru  Rv  (   R\   R  R	  R
  Rt  t   old(    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR  %  s    #c         C   s   |  j  | j  S(   N(   Rx  R   (   R\   R  R	  R
  (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyR  5  s    (   Rl   Rm   Rn   R    R  R  R_   R  R  Rx  R  R  (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyRo     s   						
	(    (    (    (    (    (    (H   Rn   R  Rv  R@  R>  RQ   t   zope.interfaceR    R   t   twisted.pythonR   R   t   twisted.python.deprecateR   t   twisted.python.versionsR   t   twisted.python.hashlibR   t   twisted.internetR   R   R	   t   twistedR
   t   twisted.cred.errort   twisted.cred.credentialsR   R   t   twisted.protocolsR   Ro   t   shortHeadersR   Re   Rj   R   R   R   R.   R0   R=   RF   t   objectRW   RG   R   R   RT   R   R   R   R   R   R   R   R   R   R   R   t   DatagramProtocolR   R  R  R  R  R  R"  R&  R+  R;  RL  Ro  (    (    (    s9   /usr/lib/python2.7/dist-packages/twisted/protocols/sip.pyt   <module>   s   <



			!	$!		+86	"	&Wo)'1