241
241
enum park_args {
242
242
OPT_ARG_COMEBACK ,
243
243
OPT_ARG_TIMEOUT ,
244
+ OPT_ARG_MUSICONHOLD ,
244
245
OPT_ARG_ARRAY_SIZE /* Always the last element of the enum */
245
246
};
246
247
@@ -250,6 +251,7 @@ enum park_flags {
250
251
MUXFLAG_NOANNOUNCE = (1 << 2 ),
251
252
MUXFLAG_COMEBACK_OVERRIDE = (1 << 3 ),
252
253
MUXFLAG_TIMEOUT_OVERRIDE = (1 << 4 ),
254
+ MUXFLAG_MUSICONHOLD = (1 << 5 ),
253
255
};
254
256
255
257
AST_APP_OPTIONS (park_opts , {
@@ -258,6 +260,7 @@ AST_APP_OPTIONS(park_opts, {
258
260
AST_APP_OPTION ('s' , MUXFLAG_NOANNOUNCE ),
259
261
AST_APP_OPTION_ARG ('c' , MUXFLAG_COMEBACK_OVERRIDE , OPT_ARG_COMEBACK ),
260
262
AST_APP_OPTION_ARG ('t' , MUXFLAG_TIMEOUT_OVERRIDE , OPT_ARG_TIMEOUT ),
263
+ AST_APP_OPTION_ARG ('m' , MUXFLAG_MUSICONHOLD , OPT_ARG_MUSICONHOLD ),
261
264
});
262
265
263
266
static int apply_option_timeout (int * var , char * timeout_arg )
@@ -275,7 +278,8 @@ static int apply_option_timeout (int *var, char *timeout_arg)
275
278
return 0 ;
276
279
}
277
280
278
- static int park_app_parse_data (const char * data , int * disable_announce , int * use_ringing , int * randomize , int * time_limit , char * * comeback_override , char * * lot_name )
281
+ static int park_app_parse_data (const char * data , int * disable_announce , int * use_ringing , int * randomize , int * time_limit ,
282
+ char * * comeback_override , char * * lot_name , char * * musicclass )
279
283
{
280
284
char * parse ;
281
285
struct ast_flags flags = { 0 };
@@ -308,6 +312,10 @@ static int park_app_parse_data(const char *data, int *disable_announce, int *use
308
312
}
309
313
}
310
314
315
+ if (ast_test_flag (& flags , MUXFLAG_MUSICONHOLD )) {
316
+ * musicclass = ast_strdup (opts [OPT_ARG_MUSICONHOLD ]);
317
+ }
318
+
311
319
if (ast_test_flag (& flags , MUXFLAG_RINGING )) {
312
320
* use_ringing = 1 ;
313
321
}
@@ -481,8 +489,8 @@ struct park_common_datastore *get_park_common_datastore_copy(struct ast_channel
481
489
return data_copy ;
482
490
}
483
491
484
- struct ast_bridge * park_common_setup (struct ast_channel * parkee , struct ast_channel * parker ,
485
- const char * lot_name , const char * comeback_override ,
492
+ static struct ast_bridge * park_common_setup2 (struct ast_channel * parkee , struct ast_channel * parker ,
493
+ const char * lot_name , const char * comeback_override , const char * musicclass ,
486
494
int use_ringing , int randomize , int time_limit , int silence_announcements )
487
495
{
488
496
struct ast_bridge * parking_bridge ;
@@ -518,11 +526,22 @@ struct ast_bridge *park_common_setup(struct ast_channel *parkee, struct ast_chan
518
526
519
527
/* Apply relevant bridge roles and such to the parking channel */
520
528
parking_channel_set_roles (parkee , lot , use_ringing );
529
+ /* If requested, override the MOH class */
530
+ if (!ast_strlen_zero (musicclass )) {
531
+ ast_channel_set_bridge_role_option (parkee , "holding_participant" , "moh_class" , musicclass );
532
+ }
521
533
setup_park_common_datastore (parkee , ast_channel_uniqueid (parker ), comeback_override , randomize , time_limit ,
522
534
silence_announcements );
523
535
return parking_bridge ;
524
536
}
525
537
538
+ struct ast_bridge * park_common_setup (struct ast_channel * parkee , struct ast_channel * parker ,
539
+ const char * lot_name , const char * comeback_override ,
540
+ int use_ringing , int randomize , int time_limit , int silence_announcements )
541
+ {
542
+ return park_common_setup2 (parkee , parker , lot_name , comeback_override , NULL , use_ringing , randomize , time_limit , silence_announcements );
543
+ }
544
+
526
545
struct ast_bridge * park_application_setup (struct ast_channel * parkee , struct ast_channel * parker , const char * app_data ,
527
546
int * silence_announcements )
528
547
{
@@ -532,12 +551,13 @@ struct ast_bridge *park_application_setup(struct ast_channel *parkee, struct ast
532
551
533
552
RAII_VAR (char * , comeback_override , NULL , ast_free );
534
553
RAII_VAR (char * , lot_name_app_arg , NULL , ast_free );
554
+ RAII_VAR (char * , musicclass , NULL , ast_free );
535
555
536
556
if (app_data ) {
537
- park_app_parse_data (app_data , silence_announcements , & use_ringing , & randomize , & time_limit , & comeback_override , & lot_name_app_arg );
557
+ park_app_parse_data (app_data , silence_announcements , & use_ringing , & randomize , & time_limit , & comeback_override , & lot_name_app_arg , & musicclass );
538
558
}
539
559
540
- return park_common_setup (parkee , parker , lot_name_app_arg , comeback_override , use_ringing ,
560
+ return park_common_setup2 (parkee , parker , lot_name_app_arg , comeback_override , musicclass , use_ringing ,
541
561
randomize , time_limit , silence_announcements ? * silence_announcements : 0 );
542
562
543
563
}
0 commit comments