File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -135,8 +135,19 @@ impl Context {
135
135
Ok ( ( ) )
136
136
}
137
137
138
- async fn emit_end_call_if_unaccepted ( wait : u64 ) {
138
+ async fn emit_end_call_if_unaccepted (
139
+ context : Context ,
140
+ wait : u64 ,
141
+ call_id : MsgId ,
142
+ ) -> Result < ( ) > {
139
143
sleep ( Duration :: from_secs ( wait) ) . await ;
144
+ let call = context. load_call_by_root_id ( call_id) . await ?;
145
+ if !call. accepted {
146
+ context. emit_event ( EventType :: CallEnded {
147
+ msg_id : call. msg . id ,
148
+ } ) ;
149
+ }
150
+ Ok ( ( ) )
140
151
}
141
152
142
153
pub ( crate ) async fn handle_call_msg (
@@ -153,7 +164,11 @@ impl Context {
153
164
msg_id : call. msg . id ,
154
165
} ) ;
155
166
let wait = call. remaining_ring_seconds ( ) ;
156
- task:: spawn ( Context :: emit_end_call_if_unaccepted ( wait. try_into ( ) ?) ) ;
167
+ task:: spawn ( Context :: emit_end_call_if_unaccepted (
168
+ self . clone ( ) ,
169
+ wait. try_into ( ) ?,
170
+ call. msg . id ,
171
+ ) ) ;
157
172
}
158
173
}
159
174
SystemMessage :: CallAccepted => {
You can’t perform that action at this time.
0 commit comments