aboutsummaryrefslogtreecommitdiffstats
path: root/main/asterisk-audio-konf/0003-member-ability-to-play-an-announcement-to-joiner.patch
blob: f59b8bff7c88697763fc99b42297c6a251080624 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
From 859a208c7ce995930068159cf512ec50d71b16b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Tue, 24 Aug 2010 17:40:06 +0300
Subject: [PATCH 2/2] member: ability to play an announcement to joiner

Parameter to playback a file after succesful conference join
(resources, conference existance and PIN verified), but before
actually dispatching the conference data.
---
 konference/Dialplan.txt |    1 +
 konference/member.c     |   25 +++++++++++++++++++++++++
 konference/member.h     |    1 +
 3 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/konference/Dialplan.txt b/konference/Dialplan.txt
index 17287dd..3784f32 100644
--- a/konference/Dialplan.txt
+++ b/konference/Dialplan.txt
@@ -64,6 +64,7 @@ exten => <ext>,<pri>,Konference(<confname>,<flags>,<optional args>,<more optiona
 	max_users=<int> : Limit conference participants to max_users
 	type=<string>: Type identifier
 	spy=<string>: Channel name to spy
+	welcome_prompt=<string>: File to playback after a successful join (PIN verified), but before connecting conference audio
 
 	3. Examples
 
diff --git a/konference/member.c b/konference/member.c
index 5370e73..080db81 100644
--- a/konference/member.c
+++ b/konference/member.c
@@ -829,6 +829,21 @@ int member_exec( struct ast_channel* chan, void* data )
 	) ;
 
 	//
+	// play welcome prompt
+	//
+	if (member->welcome_prompt) {
+		ast_stopstream(chan);
+		res = ast_streamfile(chan, member->welcome_prompt, chan->language);
+		if (!res) {
+			res = ast_waitstream(chan, "");
+			ast_stopstream(chan);
+		} else {
+			ast_log(LOG_WARNING, "Failed to play welcome prompt '%s' on channel '%s'",
+				member->welcome_prompt, chan->name);
+		}
+	}
+
+	//
 	// process loop for new member ( this runs in it's own thread )
 	//
 
@@ -1064,6 +1079,7 @@ struct ast_conf_member* create_member( struct ast_channel *chan, const char* dat
 	member->max_users = AST_CONF_MAX_USERS;
 	member->type = NULL;
 	member->spyee_channel_name = NULL;
+	member->welcome_prompt = NULL;
 
 	//
 	// initialize member with passed data values
@@ -1117,6 +1133,7 @@ struct ast_conf_member* create_member( struct ast_channel *chan, const char* dat
 		static const char arg_max_users[] = "max_users";
 		static const char arg_conf_type[] = "type";
 		static const char arg_chanspy[] = "spy";
+		static const char arg_welcomeprompt[] = "welcome_prompt";
 
 		char *value = token;
 		const char *key = strsep(&value, "=");
@@ -1162,6 +1179,11 @@ struct ast_conf_member* create_member( struct ast_channel *chan, const char* dat
 			member->spyee_channel_name = malloc( strlen( value ) + 1 ) ;
 			strcpy( member->spyee_channel_name, value ) ;
 			DEBUG("spyee channel name is %s\n", member->spyee_channel_name) ;
+		} else if ( strncasecmp(key, arg_welcomeprompt, sizeof(arg_welcomeprompt) - 1) == 0 )
+		{
+			member->welcome_prompt = malloc( strlen( value ) + 1 ) ;
+			strcpy( member->welcome_prompt, value ) ;
+			DEBUG("welcome prompt is %s\n", member->welcome_prompt) ;
 		} else
 		{
 			ast_log(LOG_WARNING, "unknown parameter %s with value %s\n", key, value) ;
@@ -1729,6 +1751,9 @@ struct ast_conf_member* delete_member( struct ast_conf_member* member )
 	// free the member's copy of the spyee channel name
 	free(member->spyee_channel_name);
 
+	// free the welcome prompt
+	free(member->welcome_prompt);
+
 	// clear all sounds
 	struct ast_conf_soundq *sound = member->soundq;
 	struct ast_conf_soundq *next;
diff --git a/konference/member.h b/konference/member.h
index 28eff6b..52b5164 100644
--- a/konference/member.h
+++ b/konference/member.h
@@ -69,6 +69,7 @@ struct ast_conf_member
 	char *type ;		// conference type
 	char* conf_name ;		// name of the conference that own this member
 	char *spyee_channel_name ; // spyee  channel name
+	char *welcome_prompt ;
 	int max_users ; // zero or max users for this conference
 
 	// voice flags
-- 
1.7.0.4