There are two call tables: calls1 and calls2. The relationship between the tables is as follows:
calls1.outer_phone = calls2.caller_phone
Several lines from calls2 can correspond to one line in calls1. The task is as follows: pull out all calls with calls1 in conjunction with calls2, but from calls2 there is only one call (if there is one) with which abs (calls2.call_time-calls1.call_time) <= 10 minutes and you only need to take the one closest to calls1.call_time call
Here's how it should turn out: 
Here is my request, but this is not what is needed:
SELECT "calls1".*, "calls2"."id" as "call_id", "calls2"."calltime" as "call_calltime", ABS(DATE_PART('minute', "calls1"."call_time" - "calls2"."calltime" )) FROM "calls1" left join "calls2" ON calls1.outer_phone=calls2.caller_phone WHERE ("calls1"."id" in (1,2,3)) AND (ABS(DATE_PART('minute', calls1.call_time-calls2.calltime ))<=10)