Code Duplication    Length = 13-17 lines in 2 locations

doorpi/sipphone/pjsua_lib/SipPhoneCallCallBack.py 2 locations

@@ 79-95 (lines=17) @@
76
                'remote_uri': self.call.info().remote_uri
77
            })
78
79
        if self.call.info().state == pj.CallState.DISCONNECTED:
80
            call_slot = self.call.info().conf_slot
81
82
            # If conf_slot is not greater than -1, the call has not yet been accepted
83
            if call_slot > -1:
84
                DoorPi().event_handler('OnCallStateDisconnect', __name__, {
85
                    'remote_uri': self.call.info().remote_uri
86
                })
87
                self.Lib.conf_disconnect(call_slot, 0)
88
                self.Lib.conf_disconnect(0, call_slot)
89
                logger.debug("disconneted Media from call_slot %s",str(call_slot))
90
                DoorPi().event_handler('AfterCallStateDisconnect', __name__, {
91
                    'remote_uri': self.call.info().remote_uri
92
                })
93
            else:
94
                DoorPi().event_handler('OnCallStateDismissed', __name__, {
95
                    'remote_uri': self.call.info().remote_uri
96
                })
97
98
@@ 64-76 (lines=13) @@
61
            'state': self.call.info().state_text
62
        })
63
64
        if self.call.info().state in [pj.CallState.CONFIRMED] \
65
        and self.call.info().media_state == pj.MediaState.ACTIVE:
66
            DoorPi().event_handler('OnCallStateConnect', __name__, {
67
                'remote_uri': self.call.info().remote_uri
68
            })
69
            call_slot = self.call.info().conf_slot
70
            # Connect the call to each side
71
            self.Lib.conf_connect(call_slot, 0)
72
            self.Lib.conf_connect(0, call_slot)
73
            logger.debug("conneted Media to call_slot %s",str(call_slot))
74
75
            DoorPi().event_handler('AfterCallStateConnect', __name__, {
76
                'remote_uri': self.call.info().remote_uri
77
            })
78
79
        if self.call.info().state == pj.CallState.DISCONNECTED: