/
app_meetme.c
8268 lines (7264 loc) · 247 KB
/
app_meetme.c
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 1999 - 2007, Digium, Inc.
*
* Mark Spencer <markster@digium.com>
*
* SLA Implementation by:
* Russell Bryant <russell@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
/*! \file
*
* \brief Meet me conference bridge and Shared Line Appearances
*
* \author Mark Spencer <markster@digium.com>
* \author (SLA) Russell Bryant <russell@digium.com>
*
* \ingroup applications
*/
/*! \li \ref app_meetme.c uses configuration file \ref meetme.conf
* \addtogroup configuration_file Configuration Files
*/
/*!
* \page meetme.conf meetme.conf
* \verbinclude meetme.conf.sample
*/
/*** MODULEINFO
<depend>dahdi</depend>
<defaultenabled>no</defaultenabled>
<support_level>extended</support_level>
<replacement>app_confbridge</replacement>
***/
#include "asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <dahdi/user.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/config.h"
#include "asterisk/app.h"
#include "asterisk/dsp.h"
#include "asterisk/musiconhold.h"
#include "asterisk/manager.h"
#include "asterisk/cli.h"
#include "asterisk/say.h"
#include "asterisk/utils.h"
#include "asterisk/translate.h"
#include "asterisk/ulaw.h"
#include "asterisk/astobj2.h"
#include "asterisk/devicestate.h"
#include "asterisk/dial.h"
#include "asterisk/causes.h"
#include "asterisk/paths.h"
#include "asterisk/data.h"
#include "asterisk/test.h"
#include "asterisk/stasis.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/stasis_message_router.h"
#include "asterisk/json.h"
#include "enter.h"
#include "leave.h"
/*** DOCUMENTATION
<application name="MeetMe" language="en_US">
<synopsis>
MeetMe conference bridge.
</synopsis>
<syntax>
<parameter name="confno">
<para>The conference number</para>
</parameter>
<parameter name="options">
<optionlist>
<option name="a">
<para>Set admin mode.</para>
</option>
<option name="A">
<para>Set marked mode.</para>
</option>
<option name="b">
<para>Run AGI script specified in <variable>MEETME_AGI_BACKGROUND</variable>
Default: <literal>conf-background.agi</literal>.</para>
<note><para>This does not work with non-DAHDI channels in the same
conference).</para></note>
</option>
<option name="c">
<para>Announce user(s) count on joining a conference.</para>
</option>
<option name="C">
<para>Continue in dialplan when kicked out of conference.</para>
</option>
<option name="d">
<para>Dynamically add conference.</para>
</option>
<option name="D">
<para>Dynamically add conference, prompting for a PIN.</para>
</option>
<option name="e">
<para>Select an empty conference.</para>
</option>
<option name="E">
<para>Select an empty pinless conference.</para>
</option>
<option name="F">
<para>Pass DTMF through the conference.</para>
</option>
<option name="G">
<argument name="x" required="true">
<para>The file to playback</para>
</argument>
<para>Play an intro announcement in conference.</para>
</option>
<option name="i">
<para>Announce user join/leave with review.</para>
</option>
<option name="I">
<para>Announce user join/leave without review.</para>
</option>
<option name="k">
<para>Close the conference if there's only one active participant left at exit.</para>
</option>
<option name="l">
<para>Set listen only mode (Listen only, no talking).</para>
</option>
<option name="m">
<para>Set initially muted.</para>
</option>
<option name="M" hasparams="optional">
<para>Enable music on hold when the conference has a single caller. Optionally,
specify a musiconhold class to use. If one is not provided, it will use the
channel's currently set music class, or <literal>default</literal>.</para>
<argument name="class" required="true" />
</option>
<option name="n">
<para>Disable the denoiser. By default, if <literal>func_speex</literal> is loaded, Asterisk
will apply a denoiser to channels in the MeetMe conference. However, channel
drivers that present audio with a varying rate will experience degraded
performance with a denoiser attached. This parameter allows a channel joining
the conference to choose not to have a denoiser attached without having to
unload <literal>func_speex</literal>.</para>
</option>
<option name="o">
<para>Set talker optimization - treats talkers who aren't speaking as
being muted, meaning (a) No encode is done on transmission and (b)
Received audio that is not registered as talking is omitted causing no
buildup in background noise.</para>
</option>
<option name="p" hasparams="optional">
<para>Allow user to exit the conference by pressing <literal>#</literal> (default)
or any of the defined keys. Dial plan execution will continue at the next
priority following MeetMe. The key used is set to channel variable
<variable>MEETME_EXIT_KEY</variable>.</para>
<argument name="keys" required="true" />
<note>
<para>Option <literal>s</literal> has priority for <literal>*</literal>
since it cannot change its activation code.</para>
</note>
</option>
<option name="P">
<para>Always prompt for the pin even if it is specified.</para>
</option>
<option name="q">
<para>Quiet mode (don't play enter/leave sounds).</para>
</option>
<option name="r">
<para>Record conference (records as <variable>MEETME_RECORDINGFILE</variable>
using format <variable>MEETME_RECORDINGFORMAT</variable>. Default filename is
<literal>meetme-conf-rec-${CONFNO}-${UNIQUEID}</literal> and the default format is
wav.</para>
</option>
<option name="s">
<para>Present menu (user or admin) when <literal>*</literal> is received
(send to menu).</para>
</option>
<option name="t">
<para>Set talk only mode. (Talk only, no listening).</para>
</option>
<option name="T">
<para>Set talker detection (sent to manager interface and meetme list).</para>
</option>
<option name="v" hasparams="optional">
<para>Announce when a user is joining or leaving the conference. Use the voicemail greeting as the announcement.
If the i or I options are set, the application will fall back to them if no voicemail greeting can be found.</para>
<argument name="mailbox@[context]" required="true">
<para>The mailbox and voicemail context to play from. If no context provided, assumed context is default.</para>
</argument>
</option>
<option name="w" hasparams="optional">
<para>Wait until the marked user enters the conference.</para>
<argument name="secs" required="true" />
</option>
<option name="x">
<para>Leave the conference when the last marked user leaves.</para>
</option>
<option name="X">
<para>Allow user to exit the conference by entering a valid single digit
extension <variable>MEETME_EXIT_CONTEXT</variable> or the current context
if that variable is not defined.</para>
<note>
<para>Option <literal>s</literal> has priority for <literal>*</literal>
since it cannot change its activation code.</para>
</note>
</option>
<option name="1">
<para>Do not play message when first person enters</para>
</option>
<option name="S">
<para>Kick the user <replaceable>x</replaceable> seconds <emphasis>after</emphasis> he entered into
the conference.</para>
<argument name="x" required="true" />
</option>
<option name="L" argsep=":">
<para>Limit the conference to <replaceable>x</replaceable> ms. Play a warning when
<replaceable>y</replaceable> ms are left. Repeat the warning every <replaceable>z</replaceable> ms.
The following special variables can be used with this option:</para>
<variablelist>
<variable name="CONF_LIMIT_TIMEOUT_FILE">
<para>File to play when time is up.</para>
</variable>
<variable name="CONF_LIMIT_WARNING_FILE">
<para>File to play as warning if <replaceable>y</replaceable> is defined. The
default is to say the time remaining.</para>
</variable>
</variablelist>
<argument name="x" />
<argument name="y" />
<argument name="z" />
</option>
</optionlist>
</parameter>
<parameter name="pin" />
</syntax>
<description>
<para>Enters the user into a specified MeetMe conference. If the <replaceable>confno</replaceable>
is omitted, the user will be prompted to enter one. User can exit the conference by hangup, or
if the <literal>p</literal> option is specified, by pressing <literal>#</literal>.</para>
<note><para>The DAHDI kernel modules and a functional DAHDI timing source (see dahdi_test)
must be present for conferencing to operate properly. In addition, the chan_dahdi channel driver
must be loaded for the <literal>i</literal> and <literal>r</literal> options to operate at
all.</para></note>
</description>
<see-also>
<ref type="application">MeetMeCount</ref>
<ref type="application">MeetMeAdmin</ref>
<ref type="application">MeetMeChannelAdmin</ref>
</see-also>
</application>
<application name="MeetMeCount" language="en_US">
<synopsis>
MeetMe participant count.
</synopsis>
<syntax>
<parameter name="confno" required="true">
<para>Conference number.</para>
</parameter>
<parameter name="var" />
</syntax>
<description>
<para>Plays back the number of users in the specified MeetMe conference.
If <replaceable>var</replaceable> is specified, playback will be skipped and the value
will be returned in the variable. Upon application completion, MeetMeCount will hangup
the channel, unless priority <literal>n+1</literal> exists, in which case priority progress will
continue.</para>
</description>
<see-also>
<ref type="application">MeetMe</ref>
</see-also>
</application>
<application name="MeetMeAdmin" language="en_US">
<synopsis>
MeetMe conference administration.
</synopsis>
<syntax>
<parameter name="confno" required="true" />
<parameter name="command" required="true">
<optionlist>
<option name="e">
<para>Eject last user that joined.</para>
</option>
<option name="E">
<para>Extend conference end time, if scheduled.</para>
</option>
<option name="k">
<para>Kick one user out of conference.</para>
</option>
<option name="K">
<para>Kick all users out of conference.</para>
</option>
<option name="l">
<para>Unlock conference.</para>
</option>
<option name="L">
<para>Lock conference.</para>
</option>
<option name="m">
<para>Unmute one user.</para>
</option>
<option name="M">
<para>Mute one user.</para>
</option>
<option name="n">
<para>Unmute all users in the conference.</para>
</option>
<option name="N">
<para>Mute all non-admin users in the conference.</para>
</option>
<option name="r">
<para>Reset one user's volume settings.</para>
</option>
<option name="R">
<para>Reset all users volume settings.</para>
</option>
<option name="s">
<para>Lower entire conference speaking volume.</para>
</option>
<option name="S">
<para>Raise entire conference speaking volume.</para>
</option>
<option name="t">
<para>Lower one user's talk volume.</para>
</option>
<option name="T">
<para>Raise one user's talk volume.</para>
</option>
<option name="u">
<para>Lower one user's listen volume.</para>
</option>
<option name="U">
<para>Raise one user's listen volume.</para>
</option>
<option name="v">
<para>Lower entire conference listening volume.</para>
</option>
<option name="V">
<para>Raise entire conference listening volume.</para>
</option>
</optionlist>
</parameter>
<parameter name="user" />
</syntax>
<description>
<para>Run admin <replaceable>command</replaceable> for conference <replaceable>confno</replaceable>.</para>
<para>Will additionally set the variable <variable>MEETMEADMINSTATUS</variable> with one of
the following values:</para>
<variablelist>
<variable name="MEETMEADMINSTATUS">
<value name="NOPARSE">
Invalid arguments.
</value>
<value name="NOTFOUND">
User specified was not found.
</value>
<value name="FAILED">
Another failure occurred.
</value>
<value name="OK">
The operation was completed successfully.
</value>
</variable>
</variablelist>
</description>
<see-also>
<ref type="application">MeetMe</ref>
</see-also>
</application>
<application name="MeetMeChannelAdmin" language="en_US">
<synopsis>
MeetMe conference Administration (channel specific).
</synopsis>
<syntax>
<parameter name="channel" required="true" />
<parameter name="command" required="true">
<optionlist>
<option name="k">
<para>Kick the specified user out of the conference he is in.</para>
</option>
<option name="m">
<para>Unmute the specified user.</para>
</option>
<option name="M">
<para>Mute the specified user.</para>
</option>
</optionlist>
</parameter>
</syntax>
<description>
<para>Run admin <replaceable>command</replaceable> for a specific
<replaceable>channel</replaceable> in any conference.</para>
</description>
</application>
<application name="SLAStation" language="en_US">
<synopsis>
Shared Line Appearance Station.
</synopsis>
<syntax>
<parameter name="station" required="true">
<para>Station name</para>
</parameter>
</syntax>
<description>
<para>This application should be executed by an SLA station. The argument depends
on how the call was initiated. If the phone was just taken off hook, then the argument
<replaceable>station</replaceable> should be just the station name. If the call was
initiated by pressing a line key, then the station name should be preceded by an underscore
and the trunk name associated with that line button.</para>
<para>For example: <literal>station1_line1</literal></para>
<para>On exit, this application will set the variable <variable>SLASTATION_STATUS</variable> to
one of the following values:</para>
<variablelist>
<variable name="SLASTATION_STATUS">
<value name="FAILURE" />
<value name="CONGESTION" />
<value name="SUCCESS" />
</variable>
</variablelist>
</description>
</application>
<application name="SLATrunk" language="en_US">
<synopsis>
Shared Line Appearance Trunk.
</synopsis>
<syntax>
<parameter name="trunk" required="true">
<para>Trunk name</para>
</parameter>
<parameter name="options">
<optionlist>
<option name="M" hasparams="optional">
<para>Play back the specified MOH <replaceable>class</replaceable>
instead of ringing</para>
<argument name="class" required="true" />
</option>
</optionlist>
</parameter>
</syntax>
<description>
<para>This application should be executed by an SLA trunk on an inbound call. The channel calling
this application should correspond to the SLA trunk with the name <replaceable>trunk</replaceable>
that is being passed as an argument.</para>
<para>On exit, this application will set the variable <variable>SLATRUNK_STATUS</variable> to
one of the following values:</para>
<variablelist>
<variable name="SLATRUNK_STATUS">
<value name="FAILURE" />
<value name="SUCCESS" />
<value name="UNANSWERED" />
<value name="RINGTIMEOUT" />
</variable>
</variablelist>
</description>
</application>
<function name="MEETME_INFO" language="en_US">
<synopsis>
Query a given conference of various properties.
</synopsis>
<syntax>
<parameter name="keyword" required="true">
<para>Options:</para>
<enumlist>
<enum name="lock">
<para>Boolean of whether the corresponding conference is locked.</para>
</enum>
<enum name="parties">
<para>Number of parties in a given conference</para>
</enum>
<enum name="activity">
<para>Duration of conference in seconds.</para>
</enum>
<enum name="dynamic">
<para>Boolean of whether the corresponding conference is dynamic.</para>
</enum>
</enumlist>
</parameter>
<parameter name="confno" required="true">
<para>Conference number to retrieve information from.</para>
</parameter>
</syntax>
<description />
<see-also>
<ref type="application">MeetMe</ref>
<ref type="application">MeetMeCount</ref>
<ref type="application">MeetMeAdmin</ref>
<ref type="application">MeetMeChannelAdmin</ref>
</see-also>
</function>
<manager name="MeetmeMute" language="en_US">
<synopsis>
Mute a Meetme user.
</synopsis>
<syntax>
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
<parameter name="Meetme" required="true" />
<parameter name="Usernum" required="true" />
</syntax>
<description>
</description>
</manager>
<manager name="MeetmeUnmute" language="en_US">
<synopsis>
Unmute a Meetme user.
</synopsis>
<syntax>
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
<parameter name="Meetme" required="true" />
<parameter name="Usernum" required="true" />
</syntax>
<description>
</description>
</manager>
<manager name="MeetmeList" language="en_US">
<synopsis>
List participants in a conference.
</synopsis>
<syntax>
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
<parameter name="Conference" required="false">
<para>Conference number.</para>
</parameter>
</syntax>
<description>
<para>Lists all users in a particular MeetMe conference.
MeetmeList will follow as separate events, followed by a final event called
MeetmeListComplete.</para>
</description>
</manager>
<manager name="MeetmeListRooms" language="en_US">
<synopsis>
List active conferences.
</synopsis>
<syntax>
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
</syntax>
<description>
<para>Lists data about all active conferences.
MeetmeListRooms will follow as separate events, followed by a final event called
MeetmeListRoomsComplete.</para>
</description>
</manager>
<managerEvent language="en_US" name="MeetmeJoin">
<managerEventInstance class="EVENT_FLAG_CALL">
<synopsis>Raised when a user joins a MeetMe conference.</synopsis>
<syntax>
<parameter name="Meetme">
<para>The identifier for the MeetMe conference.</para>
</parameter>
<parameter name="Usernum">
<para>The identifier of the MeetMe user who joined.</para>
</parameter>
<channel_snapshot/>
</syntax>
<see-also>
<ref type="managerEvent">MeetmeLeave</ref>
<ref type="application">MeetMe</ref>
</see-also>
</managerEventInstance>
</managerEvent>
<managerEvent language="en_US" name="MeetmeLeave">
<managerEventInstance class="EVENT_FLAG_CALL">
<synopsis>Raised when a user leaves a MeetMe conference.</synopsis>
<syntax>
<xi:include xpointer="xpointer(/docs/managerEvent[@name='MeetmeJoin']/managerEventInstance/syntax/parameter)" />
<channel_snapshot/>
<parameter name="Duration">
<para>The length of time in seconds that the Meetme user was in the conference.</para>
</parameter>
</syntax>
<see-also>
<ref type="managerEvent">MeetmeJoin</ref>
</see-also>
</managerEventInstance>
</managerEvent>
<managerEvent language="en_US" name="MeetmeEnd">
<managerEventInstance class="EVENT_FLAG_CALL">
<synopsis>Raised when a MeetMe conference ends.</synopsis>
<syntax>
<xi:include xpointer="xpointer(/docs/managerEvent[@name='MeetmeJoin']/managerEventInstance/syntax/parameter[@name='Meetme'])" />
</syntax>
<see-also>
<ref type="managerEvent">MeetmeJoin</ref>
</see-also>
</managerEventInstance>
</managerEvent>
<managerEvent language="en_US" name="MeetmeTalkRequest">
<managerEventInstance class="EVENT_FLAG_CALL">
<synopsis>Raised when a MeetMe user has started talking.</synopsis>
<syntax>
<xi:include xpointer="xpointer(/docs/managerEvent[@name='MeetmeJoin']/managerEventInstance/syntax/parameter)" />
<channel_snapshot/>
<parameter name="Duration">
<para>The length of time in seconds that the Meetme user has been in the conference at the time of this event.</para>
</parameter>
<parameter name="Status">
<enumlist>
<enum name="on"/>
<enum name="off"/>
</enumlist>
</parameter>
</syntax>
</managerEventInstance>
</managerEvent>
<managerEvent language="en_US" name="MeetmeTalking">
<managerEventInstance class="EVENT_FLAG_CALL">
<synopsis>Raised when a MeetMe user begins or ends talking.</synopsis>
<syntax>
<xi:include xpointer="xpointer(/docs/managerEvent[@name='MeetmeJoin']/managerEventInstance/syntax/parameter)" />
<channel_snapshot/>
<xi:include xpointer="xpointer(/docs/managerEvent[@name='MeetmeTalkRequest']/managerEventInstance/syntax/parameter)" />
</syntax>
</managerEventInstance>
</managerEvent>
<managerEvent language="en_US" name="MeetmeMute">
<managerEventInstance class="EVENT_FLAG_CALL">
<synopsis>Raised when a MeetMe user is muted or unmuted.</synopsis>
<syntax>
<xi:include xpointer="xpointer(/docs/managerEvent[@name='MeetmeJoin']/managerEventInstance/syntax/parameter)" />
<channel_snapshot/>
<xi:include xpointer="xpointer(/docs/managerEvent[@name='MeetmeTalkRequest']/managerEventInstance/syntax/parameter)" />
</syntax>
</managerEventInstance>
</managerEvent>
***/
#define CONFIG_FILE_NAME "meetme.conf"
#define SLA_CONFIG_FILE "sla.conf"
#define STR_CONCISE "concise"
/*! each buffer is 20ms, so this is 640ms total */
#define DEFAULT_AUDIO_BUFFERS 32
/*! String format for scheduled conferences */
#define DATE_FORMAT "%Y-%m-%d %H:%M:%S"
enum {
ADMINFLAG_MUTED = (1 << 1), /*!< User is muted */
ADMINFLAG_SELFMUTED = (1 << 2), /*!< User muted self */
ADMINFLAG_KICKME = (1 << 3), /*!< User has been kicked */
/*! User has requested to speak */
ADMINFLAG_T_REQUEST = (1 << 4),
ADMINFLAG_HANGUP = (1 << 5), /*!< User will be leaving the conference */
};
#define MEETME_DELAYDETECTTALK 300
#define MEETME_DELAYDETECTENDTALK 1000
#define AST_FRAME_BITS 32
enum volume_action {
VOL_UP,
VOL_DOWN
};
enum entrance_sound {
ENTER,
LEAVE
};
enum recording_state {
MEETME_RECORD_OFF,
MEETME_RECORD_STARTED,
MEETME_RECORD_ACTIVE,
MEETME_RECORD_TERMINATE
};
#define CONF_SIZE 320
enum {
/*! user has admin access on the conference */
CONFFLAG_ADMIN = (1 << 0),
/*! If set the user can only receive audio from the conference */
CONFFLAG_MONITOR = (1 << 1),
/*! If set asterisk will exit conference when key defined in p() option is pressed */
CONFFLAG_KEYEXIT = (1 << 2),
/*! If set asterisk will provide a menu to the user when '*' is pressed */
CONFFLAG_STARMENU = (1 << 3),
/*! If set the use can only send audio to the conference */
CONFFLAG_TALKER = (1 << 4),
/*! If set there will be no enter or leave sounds */
CONFFLAG_QUIET = (1 << 5),
/*! If set, when user joins the conference, they will be told the number
* of users that are already in */
CONFFLAG_ANNOUNCEUSERCOUNT = (1 << 6),
/*! Set to run AGI Script in Background */
CONFFLAG_AGI = (1 << 7),
/*! Set to have music on hold when user is alone in conference */
CONFFLAG_MOH = (1 << 8),
/*! If set, the channel will leave the conference if all marked users leave */
CONFFLAG_MARKEDEXIT = (1 << 9),
/*! If set, the MeetMe will wait until a marked user enters */
CONFFLAG_WAITMARKED = (1 << 10),
/*! If set, the MeetMe will exit to the specified context */
CONFFLAG_EXIT_CONTEXT = (1 << 11),
/*! If set, the user will be marked */
CONFFLAG_MARKEDUSER = (1 << 12),
/*! If set, user will be ask record name on entry of conference */
CONFFLAG_INTROUSER = (1 << 13),
/*! If set, the MeetMe will be recorded */
CONFFLAG_RECORDCONF = (1<< 14),
/*! If set, the user will be monitored if the user is talking or not */
CONFFLAG_MONITORTALKER = (1 << 15),
CONFFLAG_DYNAMIC = (1 << 16),
CONFFLAG_DYNAMICPIN = (1 << 17),
CONFFLAG_EMPTY = (1 << 18),
CONFFLAG_EMPTYNOPIN = (1 << 19),
CONFFLAG_ALWAYSPROMPT = (1 << 20),
/*! If set, treat talking users as muted users */
CONFFLAG_OPTIMIZETALKER = (1 << 21),
/*! If set, won't speak the extra prompt when the first person
* enters the conference */
CONFFLAG_NOONLYPERSON = (1 << 22),
/*! If set, user will be asked to record name on entry of conference
* without review */
CONFFLAG_INTROUSERNOREVIEW = (1 << 23),
/*! If set, the user will be initially self-muted */
CONFFLAG_STARTMUTED = (1 << 24),
/*! Pass DTMF through the conference */
CONFFLAG_PASS_DTMF = (1 << 25),
CONFFLAG_SLA_STATION = (1 << 26),
CONFFLAG_SLA_TRUNK = (1 << 27),
/*! If set, the user should continue in the dialplan if kicked out */
CONFFLAG_KICK_CONTINUE = (1 << 28),
CONFFLAG_DURATION_STOP = (1 << 29),
CONFFLAG_DURATION_LIMIT = (1 << 30),
};
/* These flags are defined separately because we ran out of bits that an enum can be used to represent.
If you add new flags, be sure to do it in the same way that these are. */
/*! Do not write any audio to this channel until the state is up. */
#define CONFFLAG_NO_AUDIO_UNTIL_UP (1ULL << 31)
#define CONFFLAG_INTROMSG (1ULL << 32) /*!< If set play an intro announcement at start of conference */
#define CONFFLAG_INTROUSER_VMREC (1ULL << 33)
/*! If there's only one person left in a conference when someone leaves, kill the conference */
#define CONFFLAG_KILL_LAST_MAN_STANDING (1ULL << 34)
/*! If set, don't enable a denoiser for the channel */
#define CONFFLAG_DONT_DENOISE (1ULL << 35)
enum {
OPT_ARG_WAITMARKED = 0,
OPT_ARG_EXITKEYS = 1,
OPT_ARG_DURATION_STOP = 2,
OPT_ARG_DURATION_LIMIT = 3,
OPT_ARG_MOH_CLASS = 4,
OPT_ARG_INTROMSG = 5,
OPT_ARG_INTROUSER_VMREC = 6,
OPT_ARG_ARRAY_SIZE = 7,
};
AST_APP_OPTIONS(meetme_opts, BEGIN_OPTIONS
AST_APP_OPTION('A', CONFFLAG_MARKEDUSER ),
AST_APP_OPTION('a', CONFFLAG_ADMIN ),
AST_APP_OPTION('b', CONFFLAG_AGI ),
AST_APP_OPTION('c', CONFFLAG_ANNOUNCEUSERCOUNT ),
AST_APP_OPTION('C', CONFFLAG_KICK_CONTINUE),
AST_APP_OPTION('D', CONFFLAG_DYNAMICPIN ),
AST_APP_OPTION('d', CONFFLAG_DYNAMIC ),
AST_APP_OPTION('E', CONFFLAG_EMPTYNOPIN ),
AST_APP_OPTION('e', CONFFLAG_EMPTY ),
AST_APP_OPTION('F', CONFFLAG_PASS_DTMF ),
AST_APP_OPTION_ARG('G', CONFFLAG_INTROMSG, OPT_ARG_INTROMSG ),
AST_APP_OPTION_ARG('v', CONFFLAG_INTROUSER_VMREC , OPT_ARG_INTROUSER_VMREC),
AST_APP_OPTION('i', CONFFLAG_INTROUSER ),
AST_APP_OPTION('I', CONFFLAG_INTROUSERNOREVIEW ),
AST_APP_OPTION('k', CONFFLAG_KILL_LAST_MAN_STANDING ),
AST_APP_OPTION_ARG('M', CONFFLAG_MOH, OPT_ARG_MOH_CLASS ),
AST_APP_OPTION('m', CONFFLAG_STARTMUTED ),
AST_APP_OPTION('n', CONFFLAG_DONT_DENOISE ),
AST_APP_OPTION('o', CONFFLAG_OPTIMIZETALKER ),
AST_APP_OPTION('P', CONFFLAG_ALWAYSPROMPT ),
AST_APP_OPTION_ARG('p', CONFFLAG_KEYEXIT, OPT_ARG_EXITKEYS ),
AST_APP_OPTION('q', CONFFLAG_QUIET ),
AST_APP_OPTION('r', CONFFLAG_RECORDCONF ),
AST_APP_OPTION('s', CONFFLAG_STARMENU ),
AST_APP_OPTION('T', CONFFLAG_MONITORTALKER ),
AST_APP_OPTION('l', CONFFLAG_MONITOR ),
AST_APP_OPTION('t', CONFFLAG_TALKER ),
AST_APP_OPTION_ARG('w', CONFFLAG_WAITMARKED, OPT_ARG_WAITMARKED ),
AST_APP_OPTION('X', CONFFLAG_EXIT_CONTEXT ),
AST_APP_OPTION('x', CONFFLAG_MARKEDEXIT ),
AST_APP_OPTION('1', CONFFLAG_NOONLYPERSON ),
AST_APP_OPTION_ARG('S', CONFFLAG_DURATION_STOP, OPT_ARG_DURATION_STOP),
AST_APP_OPTION_ARG('L', CONFFLAG_DURATION_LIMIT, OPT_ARG_DURATION_LIMIT),
END_OPTIONS );
static const char * const app = "MeetMe";
static const char * const app2 = "MeetMeCount";
static const char * const app3 = "MeetMeAdmin";
static const char * const app4 = "MeetMeChannelAdmin";
static const char * const slastation_app = "SLAStation";
static const char * const slatrunk_app = "SLATrunk";
/* Lookup RealTime conferences based on confno and current time */
static int rt_schedule;
static int fuzzystart;
static int earlyalert;
static int endalert;
static int extendby;
/*! Log participant count to the RealTime backend */
static int rt_log_members;
#define MAX_CONFNUM 80
#define MAX_PIN 80
#define OPTIONS_LEN 100
/* Enough space for "<conference #>,<pin>,<admin pin>" followed by a 0 byte. */
#define MAX_SETTINGS (MAX_CONFNUM + MAX_PIN + MAX_PIN + 3)
enum announcetypes {
CONF_HASJOIN,
CONF_HASLEFT
};
struct announce_listitem {
AST_LIST_ENTRY(announce_listitem) entry;
char namerecloc[PATH_MAX]; /*!< Name Recorded file Location */
char language[MAX_LANGUAGE];
struct ast_channel *confchan;
int confusers;
int vmrec;
enum announcetypes announcetype;
};
/*! \brief The MeetMe Conference object */
struct ast_conference {
ast_mutex_t playlock; /*!< Conference specific lock (players) */
ast_mutex_t listenlock; /*!< Conference specific lock (listeners) */
char confno[MAX_CONFNUM]; /*!< Conference */
struct ast_channel *chan; /*!< Announcements channel */
struct ast_channel *lchan; /*!< Listen/Record channel */
int fd; /*!< Announcements fd */
int dahdiconf; /*!< DAHDI Conf # */
int users; /*!< Number of active users */
int markedusers; /*!< Number of marked users */
int maxusers; /*!< Participant limit if scheduled */
int endalert; /*!< When to play conf ending message */
time_t start; /*!< Start time (s) */
int refcount; /*!< reference count of usage */
enum recording_state recording:2; /*!< recording status */
unsigned int isdynamic:1; /*!< Created on the fly? */
unsigned int locked:1; /*!< Is the conference locked? */
unsigned int gmuted:1; /*!< Is the conference globally muted? (all non-admins) */
pthread_t recordthread; /*!< thread for recording */
ast_mutex_t recordthreadlock; /*!< control threads trying to start recordthread */
pthread_attr_t attr; /*!< thread attribute */
char *recordingfilename; /*!< Filename to record the Conference into */
char *recordingformat; /*!< Format to record the Conference in */
char pin[MAX_PIN]; /*!< If protected by a PIN */
char pinadmin[MAX_PIN]; /*!< If protected by a admin PIN */
char uniqueid[32];
long endtime; /*!< When to end the conf if scheduled */
const char *useropts; /*!< RealTime user flags */
const char *adminopts; /*!< RealTime moderator flags */
const char *bookid; /*!< RealTime conference id */
struct ast_frame *transframe[32];
struct ast_frame *origframe;
struct ast_trans_pvt *transpath[32];
struct ao2_container *usercontainer;
AST_LIST_ENTRY(ast_conference) list;
/* announce_thread related data */
pthread_t announcethread;
ast_mutex_t announcethreadlock;
unsigned int announcethread_stop:1;
ast_cond_t announcelist_addition;
AST_LIST_HEAD_NOLOCK(, announce_listitem) announcelist;
ast_mutex_t announcelistlock;
};
static AST_LIST_HEAD_STATIC(confs, ast_conference);
static unsigned int conf_map[1024] = {0, };
struct volume {
int desired; /*!< Desired volume adjustment */
int actual; /*!< Actual volume adjustment (for channels that can't adjust) */
};
/*! \brief The MeetMe User object */
struct ast_conf_user {
int user_no; /*!< User Number */
struct ast_flags64 userflags; /*!< Flags as set in the conference */
int adminflags; /*!< Flags set by the Admin */
struct ast_channel *chan; /*!< Connected channel */
int talking; /*!< Is user talking */
int dahdichannel; /*!< Is a DAHDI channel */
char usrvalue[50]; /*!< Custom User Value */
char namerecloc[PATH_MAX]; /*!< Name Recorded file Location */
time_t jointime; /*!< Time the user joined the conference */
time_t kicktime; /*!< Time the user will be kicked from the conference */
struct timeval start_time; /*!< Time the user entered into the conference */
long timelimit; /*!< Time limit for the user to be in the conference L(x:y:z) */
long play_warning; /*!< Play a warning when 'y' ms are left */
long warning_freq; /*!< Repeat the warning every 'z' ms */
const char *warning_sound; /*!< File to play as warning if 'y' is defined */
const char *end_sound; /*!< File to play when time is up. */
struct volume talk;
struct volume listen;
AST_LIST_ENTRY(ast_conf_user) list;
};
enum sla_which_trunk_refs {
ALL_TRUNK_REFS,
INACTIVE_TRUNK_REFS,
};
enum sla_trunk_state {
SLA_TRUNK_STATE_IDLE,
SLA_TRUNK_STATE_RINGING,
SLA_TRUNK_STATE_UP,
SLA_TRUNK_STATE_ONHOLD,
SLA_TRUNK_STATE_ONHOLD_BYME,
};
enum sla_hold_access {
/*! This means that any station can put it on hold, and any station
* can retrieve the call from hold. */
SLA_HOLD_OPEN,
/*! This means that only the station that put the call on hold may
* retrieve it from hold. */
SLA_HOLD_PRIVATE,
};
struct sla_trunk_ref;
struct sla_station {
AST_RWLIST_ENTRY(sla_station) entry;
AST_DECLARE_STRING_FIELDS(
AST_STRING_FIELD(name);
AST_STRING_FIELD(device);
AST_STRING_FIELD(autocontext);
);
AST_LIST_HEAD_NOLOCK(, sla_trunk_ref) trunks;
struct ast_dial *dial;
/*! Ring timeout for this station, for any trunk. If a ring timeout
* is set for a specific trunk on this station, that will take
* priority over this value. */
unsigned int ring_timeout;
/*! Ring delay for this station, for any trunk. If a ring delay
* is set for a specific trunk on this station, that will take
* priority over this value. */
unsigned int ring_delay;
/*! This option uses the values in the sla_hold_access enum and sets the
* access control type for hold on this station. */
unsigned int hold_access:1;
/*! Mark used during reload processing */
unsigned int mark:1;
};
/*!
* \brief A reference to a station
*
* This struct looks near useless at first glance. However, its existence
* in the list of stations in sla_trunk means that this station references
* that trunk. We use the mark to keep track of whether it needs to be
* removed from the sla_trunk's list of stations during a reload.
*/
struct sla_station_ref {
AST_LIST_ENTRY(sla_station_ref) entry;
struct sla_station *station;
/*! Mark used during reload processing */
unsigned int mark:1;
};
struct sla_trunk {
AST_DECLARE_STRING_FIELDS(
AST_STRING_FIELD(name);
AST_STRING_FIELD(device);
AST_STRING_FIELD(autocontext);
);
AST_LIST_HEAD_NOLOCK(, sla_station_ref) stations;
/*! Number of stations that use this trunk */
unsigned int num_stations;
/*! Number of stations currently on a call with this trunk */
unsigned int active_stations;
/*! Number of stations that have this trunk on hold. */
unsigned int hold_stations;
struct ast_channel *chan;
unsigned int ring_timeout;
/*! If set to 1, no station will be able to join an active call with
* this trunk. */
unsigned int barge_disabled:1;