File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -67,14 +67,22 @@ impl Context {
67
67
let chat = Chat :: load_from_db ( self , chat_id) . await ?;
68
68
ensure ! ( chat. typ == Chattype :: Single && !chat. is_self_talk( ) ) ;
69
69
70
- let mut msg = Message {
70
+ let mut call = Message {
71
71
viewtype : Viewtype :: Text ,
72
72
text : "Calling..." . into ( ) ,
73
73
..Default :: default ( )
74
74
} ;
75
- msg. param . set_cmd ( SystemMessage :: OutgoingCall ) ;
76
- msg. id = send_msg ( self , chat_id, & mut msg) . await ?;
77
- Ok ( msg. id )
75
+ call. param . set_cmd ( SystemMessage :: OutgoingCall ) ;
76
+ call. id = send_msg ( self , chat_id, & mut call) . await ?;
77
+
78
+ let wait = RINGING_SECONDS ;
79
+ task:: spawn ( Context :: emit_end_call_if_unaccepted (
80
+ self . clone ( ) ,
81
+ wait. try_into ( ) ?,
82
+ call. id ,
83
+ ) ) ;
84
+
85
+ Ok ( call. id )
78
86
}
79
87
80
88
/// Accept an incoming call.
@@ -176,6 +184,7 @@ impl Context {
176
184
msg_id : call. msg . id ,
177
185
} ) ;
178
186
} else {
187
+ call. msg . clone ( ) . mark_call_as_accepted ( self ) . await ?;
179
188
self . emit_event ( EventType :: OutgoingCallAccepted {
180
189
msg_id : call. msg . id ,
181
190
} ) ;
You can’t perform that action at this time.
0 commit comments