97
97
<para>Plays a dtmf digit on the specified channel.</para>
98
98
</description>
99
99
</manager>
100
+ <manager name="SendFlash" language="en_US">
101
+ <synopsis>
102
+ Send a hook flash on a specific channel.
103
+ </synopsis>
104
+ <syntax>
105
+ <xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
106
+ <parameter name="Channel" required="true">
107
+ <para>Channel name to send hook flash to.</para>
108
+ </parameter>
109
+ <parameter name="Receive" required="false">
110
+ <para>Emulate receiving a hook flash on this channel instead of sending it out.</para>
111
+ </parameter>
112
+ </syntax>
113
+ <description>
114
+ <para>Sends a hook flash on the specified channel.</para>
115
+ </description>
116
+ </manager>
100
117
***/
101
118
102
119
enum read_option_flags {
@@ -218,12 +235,41 @@ static int manager_play_dtmf(struct mansession *s, const struct message *m)
218
235
return 0 ;
219
236
}
220
237
238
+ static int manager_send_flash (struct mansession * s , const struct message * m )
239
+ {
240
+ const char * channel = astman_get_header (m , "Channel" );
241
+ const char * receive_s = astman_get_header (m , "Receive" );
242
+ struct ast_channel * chan ;
243
+
244
+ if (!(chan = ast_channel_get_by_name (channel ))) {
245
+ astman_send_error (s , m , "Channel not found" );
246
+ return 0 ;
247
+ }
248
+
249
+ if (ast_true (receive_s )) {
250
+ struct ast_frame f = { AST_FRAME_CONTROL , };
251
+ f .subclass .integer = AST_CONTROL_FLASH ;
252
+ ast_queue_frame (chan , & f );
253
+ } else {
254
+ struct ast_frame f = { AST_FRAME_CONTROL , };
255
+ f .subclass .integer = AST_CONTROL_FLASH ;
256
+ ast_channel_lock (chan );
257
+ ast_write (chan , & f );
258
+ ast_channel_unlock (chan );
259
+ }
260
+
261
+ chan = ast_channel_unref (chan );
262
+ astman_send_ack (s , m , "Flash successfully queued" );
263
+ return 0 ;
264
+ }
265
+
221
266
static int unload_module (void )
222
267
{
223
268
int res ;
224
269
225
270
res = ast_unregister_application (senddtmf_name );
226
271
res |= ast_manager_unregister ("PlayDTMF" );
272
+ res |= ast_manager_unregister ("SendFlash" );
227
273
228
274
return res ;
229
275
}
@@ -233,6 +279,7 @@ static int load_module(void)
233
279
int res ;
234
280
235
281
res = ast_manager_register_xml ("PlayDTMF" , EVENT_FLAG_CALL , manager_play_dtmf );
282
+ res |= ast_manager_register_xml ("SendFlash" , EVENT_FLAG_CALL , manager_send_flash );
236
283
res |= ast_register_application_xml (senddtmf_name , senddtmf_exec );
237
284
238
285
return res ;
0 commit comments