# Path: sippy/UaStateGeneric.py
# class UaStateGeneric(object):
#     sname = 'Generic'
#     ua = None
#     connected = False
#     dead = False
# 
#     def __init__(self, ua):
#         self.ua = ua
# 
#     def recvRequest(self, req):
#         return None
# 
#     def recvResponse(self, resp, tr):
#         return None
# 
#     def recvEvent(self, event):
#         return None
# 
#     def cancel(self, rtime, req):
#         return None
# 
#     def onStateChange(self, newstate):
#         pass
# 
#     def __str__(self):
#         return self.sname
# 
# Path: sippy/CCEvents.py
# class CCEventDisconnect(CCEventGeneric):
#     name = 'CCEventDisconnect'
#     pass
# 
# class CCEventRing(CCEventGeneric):
#     name = 'CCEventRing'
#     pass
# 
# class CCEventConnect(CCEventGeneric):
#     name = 'CCEventConnect'
#     pass
# 
# class CCEventFail(CCEventGeneric):
#     name = 'CCEventFail'
#     challenges = None
#     warning = None
# 
#     def getCopy(self):
#         cself = CCEventGeneric.getCopy(self)
#         if self.challenges != None:
#             cself.challenges = [x.getCopy() for x in self.challenges]
#         return cself
# 
#     def setWarning(self, eistr):
#         self.warning = SipHeader(body = SipWarning(text = eistr))
# 
# class CCEventRedirect(CCEventGeneric):
#     name = 'CCEventRedirect'
#     pass


from sippy.UaStateGeneric import UaStateGeneric
from sippy.CCEvents import CCEventDisconnect, CCEventRing, CCEventConnect, CCEventFail, CCEventRedirect
    from sippy.UaStateConnected import UaStateConnected
    from sippy.UaStateDisconnected import UaStateDisconnected
        return None

    def recvResponse(self, resp, tr):
        body = resp.getBody()
        code, reason = resp.getSCode()
        scode = (code, reason, body)
        if code < 200:
            self.ua.equeue.append(CCEventRing(scode, rtime = resp.rtime, origin = self.ua.origin))
            return None
        if code >= 200 and code < 300:
            event = CCEventConnect(scode, rtime = resp.rtime, origin = self.ua.origin)
            if body != None:
                if self.ua.on_remote_sdp_change != None:
                    cb_func = lambda x: self.ua.delayed_remote_sdp_update(event, x)
                    try:
                        self.ua.on_remote_sdp_change(body, cb_func, en_excpt = True)
                    except Exception as e:
                        event = CCEventFail((502, 'Bad Gateway'), rtime = event.rtime)
                        event.setWarning('Malformed SDP Body received from ' \
                          'downstream: "%s"' % str(e))
                        return self.updateFailed(event)
                    return (UaStateConnected,)
                else:
                    self.ua.rSDP = body.getCopy()
            else:
                self.ua.rSDP = None
            self.ua.equeue.append(event)
            return (UaStateConnected,)
        if code in (301, 302) and resp.countHFs('contact') > 0:
            scode = (code, reason, body, (resp.getHFBody('contact').getUri().getCopy(),))

# Path: sippy/UaStateGeneric.py
# class UaStateGeneric(object):
#     sname = 'Generic'
#     ua = None
#     connected = False
#     dead = False
# 
#     def __init__(self, ua):
#         self.ua = ua
# 
#     def recvRequest(self, req):
#         return None
# 
#     def recvResponse(self, resp, tr):
#         return None
# 
#     def recvEvent(self, event):
#         return None
# 
#     def cancel(self, rtime, req):
#         return None
# 
#     def onStateChange(self, newstate):
#         pass
# 
#     def __str__(self):
#         return self.sname
# 
# Path: sippy/CCEvents.py
# class CCEventDisconnect(CCEventGeneric):
#     name = 'CCEventDisconnect'
#     pass
# 
# class CCEventRing(CCEventGeneric):
#     name = 'CCEventRing'
#     pass
# 
# class CCEventConnect(CCEventGeneric):
#     name = 'CCEventConnect'
#     pass
# 
# class CCEventFail(CCEventGeneric):
#     name = 'CCEventFail'
#     challenges = None
#     warning = None
# 
#     def getCopy(self):
#         cself = CCEventGeneric.getCopy(self)
#         if self.challenges != None:
#             cself.challenges = [x.getCopy() for x in self.challenges]
#         return cself
# 
#     def setWarning(self, eistr):
#         self.warning = SipHeader(body = SipWarning(text = eistr))
# 
# class CCEventRedirect(CCEventGeneric):
#     name = 'CCEventRedirect'
#     pass


# Path: sippy/UacStateUpdating.py
from sippy.UaStateGeneric import UaStateGeneric
from sippy.CCEvents import CCEventDisconnect, CCEventRing, CCEventConnect, CCEventFail, CCEventRedirect
    from sippy.UaStateConnected import UaStateConnected
    from sippy.UaStateDisconnected import UaStateDisconnected

        return None

    def recvResponse(self, resp, tr):
        body = resp.getBody()
        code, reason = resp.getSCode()
        scode = (code, reason, body)
        if code < 200:
            self.ua.equeue.append(CCEventRing(scode, rtime = resp.rtime, origin = self.ua.origin))
            return None
        if code >= 200 and code < 300:
            event = CCEventConnect(scode, rtime = resp.rtime, origin = self.ua.origin)
            if body != None:
                if self.ua.on_remote_sdp_change != None:
                    cb_func = lambda x: self.ua.delayed_remote_sdp_update(event, x)
                    try:
                        self.ua.on_remote_sdp_change(body, cb_func, en_excpt = True)
                    except Exception as e:
                        event = CCEventFail((502, 'Bad Gateway'), rtime = event.rtime)
                        event.setWarning('Malformed SDP Body received from ' \
                          'downstream: "%s"' % str(e))
                        return self.updateFailed(event)
                    return (UaStateConnected,)
                else:
                    self.ua.rSDP = body.getCopy()
            else:
                self.ua.rSDP = None
            self.ua.equeue.append(event)
            return (UaStateConnected,)
        if code in (301, 302) and resp.countHFs('contact') > 0:
            scode = (code, reason, body, (resp.getHFBody('contact').getUri().getCopy(),))

            event = CCEventRedirect(scode, rtime = resp.rtime, origin = self.ua.origin)