def handle_direct_transfer(self, ivr):
        try:
            destination_number = ivr.number
            self.custom_log(f"Transferring call to {destination_number}")
            retry_count = 0
            max_retries = 3
            call_start_time = None
            call_end_time = None
            recording_filename = None

            # Retry loop
            while retry_count < max_retries:
                self.custom_log(f"Attempt {retry_count + 1} to call {destination_number}")

                # Record the call with MixMonitor
                timestamp = int(time.time())
                recording_filename = f"/var/lib/asterisk/sounds/recordings/{self.caller_number}-{timestamp}.wav"
                self.agi.exec_command('MixMonitor', recording_filename)

                # Start the timer for the call
                call_start_time = time.time()

                # Dial the number with the 'g' option (continue after hangup)
                self.agi.exec_command('Dial', f'SIP/{destination_number}@{self.dialed_number},30,m,g')
                self.custom_log("AFTER CALL Line")
                dialstatus = self.agi.get_variable('DIALSTATUS')
                hangupcause = int(self.agi.get_variable('HANGUPCAUSE') or 0)
                self.custom_log(f"DIALSTATUS: {dialstatus}, HANGUPCAUSE: {hangupcause}")

                # Stop the timer and calculate call duration if the call was answered
                if dialstatus == 'ANSWER':
                    call_end_time = time.time()
                    call_duration = int(call_end_time - call_start_time)  # Duration in seconds

                    # Log the call details to the server after call finishes
                    self.send_call_log(line=ivr.line, call_duration=call_duration,
                                       recording_filename=recording_filename)

                    self.custom_log("Call was answered.")
                    return None  # End the call flow after call completes
                elif hangupcause == 21:  # Call Rejected
                    self.custom_log("Call was rejected by the callee.")
                    self.agi.appexec('Playback', 'call-rejected')
                    self.agi.hangup()
                    return None
                elif dialstatus == 'BUSY':
                    retry_count += 1
                    if retry_count < max_retries:
                        self.custom_log(f"Line is busy. Retrying ({retry_count}/{max_retries})...")
                        self.agi.appexec('Wait', '1')
                    else:
                        self.custom_log("Line is busy after 3 attempts.")
                        self.agi.appexec('Playback', 'line-busy')
                        self.agi.hangup()
                        return None
                elif dialstatus in ['NOANSWER', 'CHANUNAVAIL', 'CONGESTION']:
                    retry_count += 1
                    if retry_count < max_retries:
                        self.custom_log(
                            f"Call not answered or channel unavailable. Retrying ({retry_count}/{max_retries})...")
                        self.agi.appexec('Wait', '1')
                    else:
                        self.custom_log("Call could not be completed after 3 attempts.")
                        self.agi.appexec('Playback', 'cannot-complete')
                        self.agi.hangup()
                        return None
                else:
                    self.custom_log(f"Unhandled DIALSTATUS: {dialstatus}")
                    self.agi.hangup()
                    return None
            return None
        except Exception as e:
            self.custom_log(f"Error transferring call: {e}", level=logging.ERROR)
            raise


after successful call call is terminated by one of the members and we can't see any thing

<SIP/7691310941-00000030>AGI Tx >> 200 result=1
<SIP/7691310941-00000030>AGI Rx << VERBOSE "Attempt 1 to call 118" 1
 AGI.py: Attempt 1 to call 118
<SIP/7691310941-00000030>AGI Tx >> 200 result=1
<SIP/7691310941-00000030>AGI Rx << EXEC MixMonitor /var/lib/asterisk/sounds/recordings/989178651910-1727008491.wav
    -- AGI Script Executing Application: (MixMonitor) Options: (/var/lib/asterisk/sounds/recordings/989178651910-1727008491.wav)
<SIP/7691310941-00000030>AGI Tx >> 200 result=0
  == Begin MixMonitor Recording SIP/7691310941-00000030
<SIP/7691310941-00000030>AGI Rx << EXEC Dial SIP/118@7691310941,30,m,g
    -- AGI Script Executing Application: (Dial) Options: (SIP/118@7691310941,30,m,g)
  == Using SIP RTP CoS mark 5
    -- Called SIP/118@7691310941
    -- Started music on hold, class 'default', on channel 'SIP/7691310941-00000030'
       > 0x7f40b00580c0 -- Strict RTP learning complete - Locking on source address 185.98.113.210:42404
    -- SIP/7691310941-00000031 is ringing
       > 0x7f40a000d870 -- Strict RTP learning after remote address set to: 185.98.113.211:34408
    -- SIP/7691310941-00000031 is making progress passing it to SIP/7691310941-00000030
    -- SIP/7691310941-00000031 answered SIP/7691310941-00000030
    -- Stopped music on hold on SIP/7691310941-00000030
    -- Channel SIP/7691310941-00000031 joined 'simple_bridge' basic-bridge <22f0c806-90c5-4dc2-a402-bcd89b2570d5>
    -- Channel SIP/7691310941-00000030 joined 'simple_bridge' basic-bridge <22f0c806-90c5-4dc2-a402-bcd89b2570d5>
       > 0x7f40a000d870 -- Strict RTP switching to RTP target address 185.98.113.211:34408 as source
[Sep 22 12:34:56] NOTICE[381020]: chan_sip.c:29056 handle_request_register: Registration from '<sip:1954@62.60.173.146>' failed for '74.208.11.174:63236' - Wrong password
[Sep 22 12:34:58] NOTICE[381020]: chan_sip.c:29056 handle_request_register: Registration from '<sip:7494@62.60.173.146>' failed for '74.208.11.174:64470' - Wrong password
       > 0x7f40a000d870 -- Strict RTP learning complete - Locking on source address 185.98.113.211:34408
    -- Channel SIP/7691310941-00000030 left 'simple_bridge' basic-bridge <22f0c806-90c5-4dc2-a402-bcd89b2570d5>
    -- Channel SIP/7691310941-00000031 left 'simple_bridge' basic-bridge <22f0c806-90c5-4dc2-a402-bcd89b2570d5>
<SIP/7691310941-00000030>AGI Tx >> 200 result=-1
    -- <SIP/7691310941-00000030>AGI Script AGI.py completed, returning 4
  == Spawn extension (from-7691310941, s, 1) exited non-zero on 'SIP/7691310941-00000030'
  == MixMonitor close filestream (mixed)
  == End MixMonitor Recording SIP/7691310941-00000030