@@ -23,11 +23,13 @@ use tokio::{
2323use tokio_util:: sync:: CancellationToken ;
2424use tracing:: { debug, info, trace, warn} ;
2525
26+ #[ derive( Debug , Clone ) ]
2627pub struct EndpointOption {
2728 pub t1 : Duration ,
2829 pub t4 : Duration ,
2930 pub t1x64 : Duration ,
3031 pub ignore_out_of_dialog_option : bool ,
32+ pub callid_suffix : Option < String > ,
3133}
3234
3335impl Default for EndpointOption {
@@ -37,6 +39,7 @@ impl Default for EndpointOption {
3739 t4 : Duration :: from_secs ( 4 ) ,
3840 t1x64 : Duration :: from_millis ( 64 * 500 ) ,
3941 ignore_out_of_dialog_option : true ,
42+ callid_suffix : None ,
4043 }
4144 }
4245}
@@ -111,6 +114,7 @@ pub struct EndpointBuilder {
111114 transport_layer : Option < TransportLayer > ,
112115 cancel_token : Option < CancellationToken > ,
113116 timer_interval : Option < Duration > ,
117+ option : Option < EndpointOption > ,
114118}
115119
116120/// SIP Endpoint
@@ -175,6 +179,7 @@ impl EndpointInner {
175179 cancel_token : CancellationToken ,
176180 timer_interval : Option < Duration > ,
177181 allows : Vec < rsip:: Method > ,
182+ option : Option < EndpointOption > ,
178183 ) -> Arc < Self > {
179184 Arc :: new ( EndpointInner {
180185 allows : Mutex :: new ( Some ( allows) ) ,
@@ -186,7 +191,7 @@ impl EndpointInner {
186191 timer_interval : timer_interval. unwrap_or ( Duration :: from_millis ( 20 ) ) ,
187192 cancel_token,
188193 incoming_sender : Mutex :: new ( None ) ,
189- option : EndpointOption :: default ( ) ,
194+ option : option . unwrap_or_default ( ) ,
190195 } )
191196 }
192197
@@ -434,9 +439,13 @@ impl EndpointBuilder {
434439 transport_layer : None ,
435440 cancel_token : None ,
436441 timer_interval : None ,
442+ option : None ,
437443 }
438444 }
439-
445+ pub fn with_option ( & mut self , option : EndpointOption ) -> & mut Self {
446+ self . option = Some ( option) ;
447+ self
448+ }
440449 pub fn with_user_agent ( & mut self , user_agent : & str ) -> & mut Self {
441450 self . user_agent = user_agent. to_string ( ) ;
442451 self
@@ -471,13 +480,15 @@ impl EndpointBuilder {
471480 let allows = self . allows . to_owned ( ) ;
472481 let user_agent = self . user_agent . to_owned ( ) ;
473482 let timer_interval = self . timer_interval . to_owned ( ) ;
483+ let option = self . option . to_owned ( ) ;
474484
475485 let core = EndpointInner :: new (
476486 user_agent,
477487 transport_layer,
478488 cancel_token,
479489 timer_interval,
480490 allows,
491+ option,
481492 ) ;
482493
483494 Endpoint { inner : core }
0 commit comments