FreeSWITCH电话会议控制内置接口
FreeSWITCH电话会议控制内置接口
```markdown
` Contents [hide]
1 General
2 Conference configuration
2.1 <advertise>
2.2 <caller-controls>
2.3 <chat-permissions>
2.4 <profiles>
2.4.1 Conference Parameters
3 Conference Dialplan Application
3.1 Syntax
3.2 Examples
3.2.1 Adding Callers To The Conference With DTMFs
3.2.2 Announcing Caller Count While In Conference
3.2.3 Propagate Out-of-Band DTMF to Conference Members
3.2.4 Dialplan to Have Callers Speak Their Names Before Joining the Conference and Announce Name to Other Participants
4 Conference_set_auto_outcall Dialplan Application
4.1 Syntax
4.2 Example
5 API Reference
5.1 agc
5.2 bgdial
5.3 chkrecord
5.4 deaf
5.5 dial
5.6 dtmf
5.7 energy
5.8 enforce_floor
5.9 enter_sound
5.10 exit_sound
5.11 floor
5.12 file_seek
5.13 get
5.14 hup
5.15 kick
5.16 list
5.17 lock
5.18 mute
5.19 nopin
5.20 norecord
5.21 pause
5.22 pause_play
5.23 pin
5.24 play
5.25 record
5.26 recording
5.27 relate
5.28 resume
5.29 say
5.30 saymember
5.31 set
5.32 stop
5.33 tmute
5.34 transfer
5.35 undeaf
5.36 unlock
5.37 unmute
5.38 volume_in
5.39 volume_out
5.40 xml_list
6 Event Socket Use
7 Channel variables set by mod_conference
7.1 conference_last_matching_digits
7.2 conference_member_id
7.3 conference_moderator
7.4 conference_name
7.5 conference_recording
7.6 conference_uuid
7.7 last_transferred_conference
8 Channel variables to control mod_conference behavior
8.1 conference_auto_outcall_announce
8.2 conference_auto_outcall_caller_id_name
8.3 conference_auto_outcall_caller_id_number
8.4 conference_auto_outcall_flags
8.5 conference_auto_outcall_maxwait
8.6 conference_auto_outcall_prefix
8.7 conference_auto_outcall_profile
8.8 conference_auto_outcall_timeout
8.9 conference_controls
8.10 conference_enforce_security
8.11 conference_enter_sound
8.12 conference_exit_sound
9 Sound files
10 See Also
General
```markdown
The mod_conference module provides multi-user conference features. You can create as many conferences as you like, as long as there still are free system resources (i.e. memory, CPU power) left.
`Conferences are created according to configuration within the dialplan.
Conferences created in the dialplan use profiles that are defined in conf/autoload_configs/conference.conf.xml, if you are using the standard configuration with mod_dialplan_xml.
Community member Stanislav Sinyagin has posted a nice personal blog entry on how he got his conference bridge all configured.
Conference configuration
The configuration has the following structure, each "[... config here ...]" should be replaced with a configuration.
Reserved Group Names none - Use this name to prevent installing caller-controls for callers to a conference. default - Use this name to utilize the hard-coded set of controls built-in to mod_conference. Do NOT name a custom set of conference-controls "default" as they will be overridden with the hard-coded set. The behavior of the "default" group is defined below:
Example Configuration Limitations Be aware that the caller-controls are applied across the entire conference. You cannot enter one member of the conference using caller-controls ABC and then enter a second member using caller-controls XYZ. A conference can be controlled through Jabber/XMPP. This profile exists as part of the conference entity so you can have multiple profiles to limit access. When the conference publishes its presence (above) to a Jabber server, anyone on a federated server can talk to it and issue commands by typing messages via their favorite Jabber client (even if that is another FreeSWITCH™ box). To send commands to ConferenceA, from your jabber client send a message to conf+ConferenceA@freeswitch.mydomain.com Note: As of revision 3789 all commands except list have been disabled "until there is security" Another Note: After spending much time trying to get control of mod_conference via Openfire XMPP server, asked around, and "bougyman" suggested that XMPP muc functionality is very limited at present (January 2012). So watch this space. Here is an example configuration You can specify a number of different profiles in the profiles section, these will let you apply a number of settings to a conference. Please note that the profiles are not conference rooms, but settings applied to conference rooms. The dialplan section in this document will describe how you create conference rooms and apply these settings. The profiles section has this structure: You can have any number of tags, and each can have any number of tags (as long as there are parameters to configure ;-) ). Conference Parameters You may specify the parameters listed below. Keep in mind that if TTS is enabled all audio-file params beginning with 'say:' will be considered text to say with TTS. Name Description Example value Played for announce-count Requires TTS. If the number of members equals or exceeds this value, the conference will speak the count after a new member joins. 5 auto-gain-level Enables Automatic Gain Control (AGC). If the parameter is set to 'true', then the default AGC value is used. If set to a number it will override the default value. 1100 auto-record Put a value in for this parameter in order to toggle recording every conference call. Within mod_conference there is a special parameter named ${conference_name}. All channel variables are accessible as well. NOTE: auto-record doesn't begin recording until two parties are on the line. Example 1: /var/myNFSshare/${conference_name}_${strftime(%Y-%m-%d-%H-%M-%S)}.wav Example 2: shout://user:pass@server.com/live.mp3 caller-controls Name of the caller control group to use for this profile. One of those specified in the section. The profile named "default" will be used if none is specified. somekeys moderator-controls Name of the moderator control group to use for this profile. One of those specified in the section. The profile named "default" will be used if none is specified. somekeys cdr-log-dir Target directory for conference CDRs to be written. Use "auto" to store in $PREFIX/log/conference_cdr. An absolute path is acceptable as is a relative path. A relative path will yield $PREFIX/log/ for the conference CDR directory. auto caller-id-name Default Caller ID Name for outbound calls originated by mod_conference. FreeSWITCH caller-id-number Default Caller ID Number for outbound calls originated by mod_conference. 8777423583 comfort-noise Sets the volume level of background white noise to add to the conference. 1-10000, "true" (defaults to 1400), 0 for no CN (total silence) conference-flags Can be any combination of wait-mod, audio-always, video-bridge, video-floor-only and rfc-4579. wait-mod is used to force conference participants to wait (with music) for a member with the 'moderator' flag set to enter the conference. The moderator member-flag is set in the dialplan where the call is sent to the conference. This might be used in conjunction with an IVR where the moderators are authenticated with an extra pass-code. The flag audio-always will always mix audios of all members. By default it only mix audios of members who are considered "talking". wait-mod domain ??? $${domain} energy-level Energy level required for audio to be sent to the other users. The energy level is a threshold of 'voice energy' that must be present before audio is bridged into the conference. Useful if a participant is in a noisy environment, so you only hear background noise when they speak. 0 disables the detection and will bridge all packets even if they are only background noise. 300 interval Number of milliseconds per frame. Which may be different from ptime in SIP SDP, or driver with TDM. Higher numbers require less CPU but can degrade conversation quality, so experimentation with your setup is best. The default is good for conversation quality. 20 max-members Sets a maximum number of participants in conferences with this setting in its profile. 20 member-flags Can be any combination of: mute, deaf, mute-detect, dist-dtmf, moderator, nomoh, endconf, mintwo, video-bridge, ghost and join-only. mute joins the member to the conference muted (unable to speak into the conference bridge). deaf blocks audio from the conference to the member and implies mute as well; caller-controls can be used to toggle these settings after joining the conference. dist-dtmf passes DTMF TouchTone™ audio to the conference instead of intercepting it as a command. moderator gives greater control over the conference and should not be set within the XML profile, but rather from the dialplan. nomoh disables music-on-hold; this is recommended as m.o.h. would disrupt the conference. endconf terminates a conference when a member with this flag leaves; if more than one member has the endconf flag set, the conference will be terminated when the last endconf member leaves. mintwo terminates the conference if only one participant exists. The ghost user is not counted as a conference member. With join-only a user cannot create a conference (as a first member), one can only join the conference which is already ongoing. nomoh pin Pin code that must be entered before user is allowed to enter the conference. 12345 moderator-pin Pin code that must be entered before moderator is allowed to enter the conference. 12345 pin-retries Max number of times the user or moderator can be asked for PIN 3 rate Audio sample rate. 8000 sound-prefix Set a default path here so you can use relative paths in the other sound params. /soundfiles suppress-events For use with the event socket. This parameter specifies which events will NOT be sent to the socket when getting CUSTOM conference::maintenance events. add-member terminate-on-silence Specifies the number of contiguous seconds of silence after which the conference will automatically terminate and disconnect all members. 300 timer-name ??? ??? tts-engine Text-To-Speech (TTS) Engine to use cepstral tts-voice TTS Voice to use david verbose-events Maximum verbosity for transcripting. Events related to the conference will send more data. Specifically the events will include all the channel variables on each conference event. true ack-sound File to play to acknowledge success. beep.wav User alone-sound File to play if you are alone in the conference yactopitc.wav User bad-pin-sound File to play to when the pin is invalid invalid-pin.wav User enter-sound File to play when you join the conference. welcome.wav All exit-sound File to play when you leave the conference. exit.wav All is-locked-sound File to play when the conference is locked during the call to the members in the conference. is-locked.wav All is-unlocked-sound File to play when the conference is unlocked during the call is-unlocked.wav All kicked-sound File to play when you are kicked from the conference. kicked.wav User locked-sound File to play when the conference is locked and someone goes to join locked.wav All max-members-sound If max-members has been reached, this sound plays instead of allowing new users to the conference. max-members.wav ??? moh-sound the given sound file/resource will be played only when the conference size is 1 member. It will loop over and over until the member count is 2 or more. When the conference goes back to 1 member it will play again. idlemusic.wav All muted-sound File to play when member is muted. muted.wav User mute-detect-sound If the mute-detect member-flag has been set, this sound plays when the user talks while muted. mute-detect.wav User nack-sound File to play to acknowledge failure. ??? What is it acknowledging ??? beeperr.wav User perpetual-sound The given sound file/resource will be played on a loop forever. This can be used to broadcast sales or emergency messages to callers. announcement.wav All pin-sound File to prompt the user to enter the conference pin code. pin.wav User unmuted-sound File to play when member is unmuted. unmuted.wav User join-only-sound File to play when member with join-only flag tries to create the conference (join as the first). no_reources_try_later.wav User ivr-dtmf-timeout milliseconds. Inter-digit timeout between DTMF digits that form a command sequence. 500 ivr-input-timeout How many ms to wait for the first DTMF, zero = forever 0 endconf-grace-time Defines how much time all members have before the conference is terminated when the last member with endconf leaves. Default = 0. 600 min-required-recording-participants Minimum number of conference participants required for their audio to be heard in a recording and for auto recording to start. This can be either 2 (the default) or 1. 2
Conference Dialplan Application
The conference dialplan application is used to create/join conferences and to bind a profile to them. Syntax The first time a conference name (confname) is used, it will be created on demand, and the pin will be set to what ever is specified at that time: the pin in the data string if specified, or if not, the "pin" setting in the conference profile, and if that is also unspecified, then there is no pin protection. Any later attempt to join the conference must specify the same pin number, if one existed when it was created. "profile" should be one of those that you specified in the conference configuration. If the data value starts with "bridge:", then it is a bridging conference. The conference name should not be already in use. You can specify the special literal value of "uuid" for the conference name, and a a session-specific unique id will be generated for you. Conferences stay alive until the number of members reaches the minimum number, and then falls below that. The minimum for bridging conferences is 2, and for other dynamically created conferences is 1. Examples Action data Description confname profile is "default", no flags or pin confname+1234 profile is "default", pin is 1234 confname@profilename+1234 profile is "profilename", pin=1234, no flags confname+1234+flags{mute} profile is "default", pin=1234, one flag confname++flags{endconf|moderator} profile is "default", no p.i.n., multiple flags bridge:confname a "bridging" conference bridge:uuid a "bridging" conference with UUID assigned as conference name *Note that while some parameters are optional, their order is very important Or a simple example in an action tag: Bridging conference example that plays ringback while other party is bridged in: Adding Callers To The Conference With DTMFs By combining several elements - the dialplan, API calls, bind_digit_action - you can create a simple system for a caller to add another user to the conference. See Conference_Add_Call_Example for the code and explanation. Announcing Caller Count While In Conference See Conference_Announce_Count_Inline for a simple example of how to allow a caller to receive an announcement of how many members are in the conference. Propagate Out-of-Band DTMF to Conference Members By default, out-of-band DTMF signals (RFC 2833?) are absorbed by the conference. However, there are two ways to accomplish this: Set the dist-dtmf member flag in the conference configuration XML, eg: With this parameter set, all of the caller controls such as modifying volume will be disabled and DTMF will simply pass through to all other members of the conference. There is also an api call that will allow your application to send DTMF to a single conference member or all members: dtmf-string <[member_id|all|last]>
Dialplan to Have Callers Speak Their Names Before Joining the Conference and Announce Name to Other Participants >
Conference_set_auto_outcall Dialplan Application
Use conference_set_auto_outcall to have mod_conference call one or more endpoints when a conference starts. To have it call more than one endpoint, just repeat the conference_set_auto_outcall action in the dialplan. Syntax Example Here is an example of using conference_set_auto_outcall with some of the other conference_auto_outcall_* parameters to start a conference when someone dials 12345. Extensions 1000 and 1001 will be dialed when the conference starts.
<action application="answer"></action>
<action application="set" data="conference_auto_outcall_timeout=5"></action>
<action application="set" data="conference_auto_outcall_flags=none"></action>
<action application="set" data="conference_auto_outcall_caller_id_name=$${effective_caller_id_name}"></action>
<action application="set" data="conference_auto_outcall_caller_id_number=$${effective_caller_id_number}"></action>
<action application="set" data="conference_auto_outcall_profile=default"></action>
<action application="conference_set_auto_outcall" data="user/1000@$${domain}"></action>
<action application="conference_set_auto_outcall" data="user/1001@$${domain}"></action>
<action application="conference" data="$1@default"></action>
</condition>
API Reference
agc Adjust conference automatic gain control. conference agc [on [level]|off] Examples: Disable agc: conference testconf agc off
+OK AGC DISABLED Enable agc w/ default level: conference testconf agc on
OK AGC ENABLED 1100 Enable agc w/ specific level: conference testconf agc on 1120
OK AGC ENABLED 1120 Query agc status: conference testconf agc
+OK CURRENT AGC LEVEL IS 1100 bgdial Background dial a destination via a specific endpoint (i.e. call mom from the conference). Similar to dial. conference bgdial [{dial string options}]<endpoint_module_name>/ [<callerid_number> [<callerid_name>]] chkrecord Query record status of conference. Alternatively, "recording check" syntax may be used. conference chkrecord Examples: Not recorded: conference testconf chkrecord
Conference is not being recorded Recorded: conference testconf chkrecord
Record file /tmp/foo.wav Auto recorded: conference testconf chkrecord
Record file /tmp/foo.wav (Auto) deaf Make a conference member deaf. conference deaf <[member_id|all|last|non_moderator]> dial Dial a destination via a specific endpoint (ie. call mom from the conference). conference dial [{dial string options}]<endpoint_module_name>/ [<callerid_number> [<callerid_name>]] See here for the list of dial string options available: Channel Variables If the caller id values are not set, the variables in conference.conf.xml will be used. Specifically, the value for caller-id-number will be used for the number and the value for caller-id-name will be used for the name. If the conference will be dynamically created as a result of this api call (ie this will be the first participant in the conference) - and the caller id name and number is not provided in the api call - the number and name will be "00000000" and "FreeSWITCH". This appears to be unaffected by the variables in conference.conf.xml. conference testconf dial {originate_timeout=30}sofia/default/1000@softswitch 1234567890 FreeSWITCH_Conference The above api call will dial out of a conference named "testconf" to the user located at the specified endpoint with a 30 second timeout. The endpoint will see the call as coming from "FreeSWITCH_Conference" with a caller id of 1234567890.
Also worth noting: values provided in the dial string will overwrite the callerid_number and callerid_name variables provided at the end of the api call. conference testconf dial {origination_caller_id_name=DialStringName,originate_timeout=30}sofia/default/1000@softswitch 1234567890 FreeSWITCH_Conference The above api call is almost the same as the previous api call, except the endpoint will see "DialStringName" as the caller id name instead of "FreeSWITCH_Conference". dtmf Send DTMF to any member of the conference. conference dtmf <[member_id|all|last|non_moderator]>
conference testconf dtmf all 134 energy Adjusts the conference energy level for a specific member. conference energy <[member_id|all|last|non_moderator]> [] enforce_floor Give floor status to member. conference enforce_floor <member_id|last> enter_sound Changes the sound played while entering the conference conference enter_sound enter_sound on|off|none|file exit_sound Changes the sound played while leaving the conference conference exit_sound enter_sound on|off|none|file floor Toggle floor status of member. That is, give floor to member if no member has it and take away floor if member has floor. conference floor <member_id|last> file_seek See conference playback. +/- value is relative position in milliseconds. Unsigned value is absolute position in milliseconds. conference file_seek [+-] get Get runtime parameter of a given conference. conference get <parameter_name> Valid <parameter_name>: run_time (conference time, in seconds) count max_members rate profile_name sound_prefix caller_id_name caller_id_number is_locked endconf_grace_time (in seconds) uuid wait_mod Output: current value of a given parameter: for run_time, count, max_members, rate, endconf_grace_time: a number (converted to string). for is_locked: string "locked" if locked or empty if not. for wait_mod: string "true" if set or empty if not. for others: string value. It can be also used in a dialplan: hup Kick without the kick sound conference hup <[member_id|all|last|non_moderator]> kick Kicks a specific member or all members from a conference. conference kick <[member_id|all|last|non_moderator]> list Lists a specific conference member or all members. conference list [delim ]
conference list [delim ] Output: First line Conference (<member_count> member[s][ locked]) “locked” - The lock/unlock status of the conference. Each following line is a comma-separated list for each conference leg with the following items: id of participant(starts at 1 after FS restart) Register string of participant UUID of participant's call leg Caller id name Caller id number Status (hear|speak|talking|video|floor) “hear” - The mute/unmute status of the member. “speak” - The “deaf /undeaf” status of the member. “talking” - The input channel is currently providing some amount of sound energy into conference. “video” - Providing video? “floor” - This member currently owns the floor. Volume In setting Detected energy Volume Out setting Energy Level setting A handy way to test in an XML dialplan if a conference is active and allow a late caller to join: If the conference is not active, the second "condition" test will fail and bypass this dialplan extension entry. If the conference is active the caller will join it with the 'nomoh' flag set. lock Lock a conference so no new members will be allowed to enter. conference lock mute Mutes a specific member in a conference. conference mute <[member_id|all|last|non_moderator]> nopin Removes a pin for a specific conference. conference nopin norecord conference testconf norecord all Or, conference testconf norecord /tmp/foo.wav pause Pause a conference recording. See also recording API for alternative syntax. conference pause <file_path> pause_play Pause conference playback. conference pause_play pin Sets or changes a pin number for a specific conference. conference pin <pin#> Please note that if you set a conference pin and then issue a command like conference dial sofia/default/123456@softswitch 123456 will not be challenged with a pin, he will just join the conference named . play Play an audio file in a conference to all members or to a specific member. You can stop that same audio with the Stop command below. conference play <file_path> [|<member_id>] record conference testconf record /tmp/foo.wav recording Alternative syntax for all recording related commands: conference recording start <file_path> conference recording check conference recording stop <file_path>|all conference recording pause <file_path> conference recording resume <file_path> relate Mute or Deaf a specific member to another member. conference relate <member_id> <other_member_id> [nospeak|nohear|clear] Examples: conference my_conf relate 1 2 nospeak Member 1 may now no longer speak to member 2, i.e. member 2 now cannot hear member 1. conference my_conf relate 1 2 clear Member 1 may now speak to member 2 again
conference my_conf relate 1 2 nohear Member 1 now cannot hear member 2 conference my_conf relate 1 2 clear Member 1 can now hear member 2 again resume Resume recording. See also recording API for alternative syntax. conference resume <file_path> say Say text in a conference to all members. conference say saymember Say text to a specific member in a conference. conference saymember <member_id> set Set runtime parameter of a given conference. conference set <parameter_name> Valid <parameter_name>: max_members sound_prefix caller_id_name caller_id_number endconf_grace_time Output: previous value of a given parameter. It can be also used in a dialplan: stop Stops any queued audio from playing. See also recording API for alternative syntax. conference stop <[current|all]> [<member_id>] tmute Toggles mutes on/off for a specific member in a conference. conference tmute <[member_id|all|last|non_moderator]> transfer Transfer a member from one conference to another conference. conference transfer <conference_name> <member_id> To transfer a member to another extension use the api transfer command with the uuid of their session. undeaf Allow a specific member to hear again. conference undeaf <[member_id|all|last|non_moderator]> unlock Unlock a conference so that new members can enter. conference unlock unmute Unmute a specific member of a conference. conference unmute <[member_id|all|last|non_moderator]> volume_in Adjusts the input volume for a specific conference member. This changes the loudness of the specified member's microphone into the conference. conference volume_in <[member_id|all|last|non_moderator]> [] volume_out Adjusts the output volume for a specific conference member. This changes the loudness of the conference out to the specified member's earpiece. conference volume_out <[member_id|all|last|non_moderator]> [] xml_list Lists all or a specific conference members in XML format. conference xml_list Event Socket Use
You can subscribe to the following to receive conference events: conference::maintenance The "suppress-events" parameter can be added to the conference profile to prevent events from firing. e.g. if you're not interested in start or stop talking events: ...other options... The events that can be suppressed are: add-member, del-member, energy-level, volume-level, gain-level, dtmf, stop-talking, start-talking, mute-member, unmute-member, kick-member, dtmf-member, energy-level-member, volume-in-member, volume-out-member, play-file, play-file-member, speak-text, speak-text-member, lock, unlock, transfer, bgdial-result and floor-change. Channel variables set by mod_conference
conference_last_matching_digits Contains the last matching digits that the user on this channel sent into the conference. Usage:
conference_member_id Contains the conference_member_id value for any conference to which the channel may be connected.
conference_moderator Is true if the channel is connected to a conference as a moderator.
conference_name The name of the last conference joined by this channel. Usage:
conference_recording Contains the file name of the conference recording for the conference to which the channel is connected.
conference_uuid Every instance of a conference has its own UUID. This channel variable stores the conference UUID for the most recent conference in which the channel was a member. It is set as soon as the channel enters the conference, and will show up in XML CDRs and uuid_dump calls, as well as any events that show channel variables.
last_transferred_conference Contains the name of the last conference that this channel was connected to. Usage:
Channel variables to control mod_conference behavior
conference_auto_outcall_announce File name of audio message to play to conference member joining conference via the conference_set_auto_outcall application. Because the conference would be originating an outbound call to a member this typically would be a greeting with an explanation that the recipient will be joining a conference call.
Usage:
conference_auto_outcall_caller_id_name Caller ID name to use when dialing endpoints to join the conference via the conference_set_auto_outcall application. Usage:
conference_auto_outcall_caller_id_number Caller ID number to use when dialing endpoints to join the conference via the conference_set_auto_outcall application. Usage:
conference_auto_outcall_flags Conference flags to set for members joining conference via the conference_set_auto_outcall application Usage:
conference_auto_outcall_maxwait Maximum time in seconds that the channel that initiated the conference_set_auto_outcall will wait for members to join the conference. Usage:
conference_auto_outcall_prefix The value of conference_auto_outcall_prefix is prepended to each of conference_set_auto_outcall values, of which there can be more than one. Usage:
conference_auto_outcall_profile Conference profile to use for members joining the conference via the conference_set_auto_outcall application. Usage:
conference_auto_outcall_timeout Originate timeout to use when joining a member to a conference via conference_set_auto_outcall. Usage:
conference_controls Set this variable to specify which conference control set to use when transferring a caller into a conference. This allows you, for example, to have a control set for the conference moderator and another control set for regular conference members. The control set for the moderator could include the ability to mute or kick people, for example. NOTE: You must create the desired conference control set. Also, if this is not set then the default conference control set is used for the conference member. Usage:
conference_enforce_security Allows the conference security to be overridden. This applies in two different scenarios, one for inbound and one for outbound. By default, conference security is always applied to inbound calls and is always skipped for outbound calls. This channel variable allows the behavior to be modified.
Usage: Inbound Outbound originate {conference_enforce_security=true}sofia/internal/1001 &conference(3000)
conference_enter_sound When set, this channel variable will override the enter-sound param on conference profile for any conferences into which the call leg is transferred. Usage:
conference_exit_sound
Usage:
Sound files
Just about any format is supported, but currently it must be at the sample rate of the conference (no resampling is done). Since disk is cheaper than CPU, use a wav. Asterisk ships with some useful free sound files for conferences.
上海老李,QQ:1354608370,FreeSWITCH QQ群: