Asterisk cmd ConfBridge

ConfBridge

Synopsis

ConfBridge conferencing bridge

Description

ConfBridge([confno][,options]): Enters the user into a specified ConfBridge conference

10.x

ConfBridge has undergone many changes for the version released with Asterisk 10.x. The documentation for this new *version* can be found here. (Someone should add it to Voip-Info)

Asterisk cmd ConfBridge


ConfBridge is an application for Asterisk starting with the 1.6.2.* series. ConfBridge is very similar in features to MeetMe, but unlike MeetMe, ConfBridge does not perform audio mixing using DAHDI. Instead, audio mixing is performed within the internals of Asterisk.

To get an up2date description of ConfBridge for your used Asterisk version execute core show application ConfBridge at the Asterisk CLI.

The option string may contain zero or more of the following characters:
  • 'a' — Set admin mode
  • 'A' — Set marked mode
  • 'c' — Announce user(s) count on joining a conference.
  • 'm' — Set initially muted.
  • 'M' — 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 'default'
  • '1' — Do not play message when first person enters
  • 's' — Present menu (user or admin) when '#' is received (send to menu)
  • 'w' — Wait until the marked user enters the conference
  • 'q' — Quiet mode (don't play enter/leave sounds).

The join sound can be set using the 'CONFBRIDGE_JOIN_SOUND' variable and
the leave sound can be set using the 'CONFBRIDGE_LEAVE_SOUND' variable.
These can be unique to the caller.

NOTE: This application will not automatically answer the channel.

Muteing

When a participant is "muted" this means that the participant's audio is ignored. Nevertheless the muted participant still receives the mixed audio stream.

Differences with MeetMe

It is no longer possible to assign a PIN to a conference as you would with MeetMe(123,d,321) - instead this must be done outside of the ConfBridge application. Because of possible clashes if two people run the code at the same time, it is not possible to use the CONFBRIDGE_INFO(parties) function and the code must, at least in part, be run in a MacroExclusive() application. Sample code to implement this is shown below:

Remember, since Asterisk 1.6 using Macro() is deprecated, which should be considered before using Macroexclusive()!
Think of using LOCK(), TRYLOCK() and UNLOCK().

;
[general]
static=yes
writeprotect=yes
autofallthrough=yes
extenpatternmatchnew=no
clearglobalvars=no
;
[globals]
;
; Minimum and maximum lengths for the conference room and PIN
CONF_NUM_MAXLEN=10
CONF_NUM_MINLEN=4
CONF_PIN_MAXLEN=10
CONF_PIN_MINLEN=4


[default]
exten => conf,1,Goto(conference,s,1)

[conference]
;
; Do the niceties first
exten => s,1,NoOp(AdHoc conferencing)
same => n,Ringing()
same => n,Answer(500)
;
; Welcome the caller and ask them for the conference number
same => n,Read(CONFID,custom/conf-adhoc&custom/conf-adhoc-enterconf,,,3,5)
same => n,Set(CONFID=${FILTER(0-9,${CONFID})})
same => n,Playback(custom/conf-thankyou)
;
; Hangup if they entered nothing
same => n,GotoIf($["${CONFID}" = ""]?hangup)
;
; Read the PIN
same => n,Read(CONFPIN,custom/conf-enterpin,,,3,5)
same => n,Set(CONFPIN=${FILTER(0-9,${CONFPIN})})
same => n,GotoIf($["${CONFPIN}" = ""]?hangup)
same => n,Playback(custom/conf-thankyou)
;
; Now run the macro which will work out if this is a new conference (and therefore set the PIN)
; or whether this is an existing conference (and therefore check the PIN against the set one).
same => n,MacroExclusive(validateconference,${CONFID},${CONFPIN},TMP_CONFOK)
;
; If we didn't get a '1' back, crash out.
same => n,GotoIf($["${TMP_CONFOK}" != "1"]?hangup
;
; Otherwise, enter the conference.
same => n,ConfBridge(${CONFID})
;
same => n(hangup),NoOp()
same => n,Hangup()


[macro-validateconference]
; ALWAYS run this with MacroExclusive!
; ARG1 = Conference number
; ARG2 = PIN
; ARG3 = Name of variable to populate with the return value
;
; Returns either 0 or 1 depending on whether the confnum/pin
; are valid. Uses GROUP_COUNT rather than CONFBRIDGE_INFO(parties)
; since we can only put a user into the conference outside of this
; macro and then there's always the possibility of somebody
; resetting the PIN...
;
; It is assumed that ARG1, ARG2 and ARG3 have been validated before we got here
; (i.e. that they've been filtered).

exten => s,1,NoOp()
;
; Bomb if number/pin don't meet the minimum requirements.
; Note that the pin could, quite legitimately be empty, so there's little
; point in checking for an empty variable.
same => n,GotoIf($[${LEN(${ARG1})} < ${CONF_NUM_MINLEN}]?exiterr)
same => n,GotoIf($[${LEN(${ARG1})} > ${CONF_NUM_MAXLEN}]?exiterr)
same => n,GotoIf($[${LEN(${ARG2})} < ${CONF_PIN_MINLEN}]?exiterr)
same => n,GotoIf($[${LEN(${ARG2})} > ${CONF_PIN_MAXLEN}]?exiterr)
;
; Check to see if we've already got somebody in the conference (or about
; to be in the conference. If so, then skip to the code where we just
; check that the pin is valid.
same => n,GotoIf($[${GROUP_COUNT(${ARG1}@conference)} > 0]?checkpin)
;
; If we're here, there's nobody in the conference room, so we need to
; add the PIN to the database to use by subsequent members
same => n,Set(DB(conf/${ARG1}/pin)=${ARG2})
same => n,Set(${ARG3}=1)
same => n,Set(GROUP(conference)=${ARG1})
same => n,MacroExit()
;
; And now the checking of the PIN
same => n(checkpin),NoOp()
same => n,GotoIf($["${DB(conf/${ARG1}/pin)}" != "${ARG2}"]?exiterr)
;
; PINs match
same => n,Set(${ARG3}=1)
same => n,Set(GROUP(conference)=${ARG1})
same => n,MacroExit()
;
; PINs don't match
same => n(exiterr),NoOp()
same => n,Set(${ARG3}=0)
same => n,MacroExit()
NOTE that the code above is not complete - it would be nice to tell the caller if the conference number and PIN didn't meet the requirements, for example.


A modified version of the above.

This allows setting more of the Confbridge options available in 10.x and sets the first (creating) user as admin.

From extensions.conf


[External-Conf]
exten=s,1,NoOP(External Conference Caller Coming In)
exten=s,n,Read(CONFnum,custom/6004,4,,2,5)
exten=s,n,Goto(CONFERENCE,${CONFnum},1)

[CONFERENCE]
exten=_19XX,1,NoOp(Dynamic Conferences)
same=n,Set(CONFnum=${EXTEN})
same=n,Set(CONFnum=${FILTER(0-9,${CONFnum})})
same=n,GotoIf($["${CONFnum}" = ""]?CONFERENCE,${EXTEN},hangup)
same=n,Playback(custom/6000)
same=n,SayDigits(${CONFnum})
same=n,NoOP(Type Conference PIN)
same=n,Read(CONFpin,custom/6002,4,,2,5)
same=n,Set(CONFpin=${FILTER(0-9,${CONFpin})})
same=n,GotoIf($["${CONFpin}" = ""]?CONFERENCE,${EXTEN},hangup)
same=n,Playback(custom/6001)
same=n,SayDigits(${CONFpin})
same=n,MacroExclusive(emptyconference,${CONFnum},TMP_EMPTY)
same=n,GotoIf($["${TMP_EMPTY}" = "1"]?CONFERENCE,${EXTEN},uconf)
same=n,NoOP(Type Conference Max Users)
same=n,Read(CONFusers,custom/6003,2,,2,5)
same=n,Set(CONFusers=${FILTER(0-9,${CONFusers})})
same=n,GotoIf($["${CONFusers}" = ""]?CONFERENCE,${EXTEN},hangup)
same=n(aconf),MacroExclusive(makeconference,${CONFnum},${CONFpin},${CONFusers},${CONFrec},TMP_CONFOK,TMP_ADMIN)
same=n(uconf),MacroExclusive(makeconference,${CONFnum},${CONFpin},${CONFusers},${CONFrec},TMP_CONFOK,TMP_ADMIN)
same=n,GotoIf($["${TMP_CONFOK}" != "1"]?hangup)
same=n,GotoIf($["${TMP_ADMIN}" = "1"]?CONFERENCE,${EXTEN},admin:CONFERENCE,${EXTEN},user)
same=n(admin),Read(PASS,custom/6005,5,,2,5)
same=n,GotoIf($["${PASS}" = "12345"]?:CONFERENCE,${EXTEN},hangup)
same=n,Set(CONFBRIDGE(user,admin)=yes)
same=n,Set(CONFBRIDGE(user,marked)=yes)
same=n,Set(CONFBRIDGE(user,announce_join_leave)=yes)
same=n,Set(CONFBRIDGE(user,music_on_hold_when_empty)=yes)
same=n,Set(CONFBRIDGE(user,music_on_hold_class)=default)
same=n,Set(CONFBRIDGE(user,end_marked)=yes)
same=n,Set(CONFBRIDGE(user,announce_only_user)=yes)
same=n,Set(CONFBRIDGE(user,announce_user_count)=yes)
same=n,Set(CONFBRIDGE(bridge,max_members)=${CONFusers})
same=n,ConfBridge(${CONFnum},conferences,USER,admin_menu)
same=n,Hangup()
same=n(user),Set(CONFBRIDGE(user,admin)=no)
same=n,Set(CONFBRIDGE(user,marked)=no)
same=n,Set(CONFBRIDGE(user,announce_join_leave)=yes)
same=n,Set(CONFBRIDGE(user,music_on_hold_when_empty)=yes)
same=n,Set(CONFBRIDGE(user,music_on_hold_class)=default)
same=n,Set(CONFBRIDGE(user,end_marked)=yes)
same=n,ConfBridge(${CONFnum},conferences,foo-user,user_menu)
same=n,Hangup()
same=n(hangup),Hangup()

[macro-emptyconference]
exten=s,1,NoOp(Checking to see if conference is empty and needs extra admin prompts)
same=n,Verbose(${GROUP_COUNT(${ARG1}@conference)})
same=n,GotoIf($[${GROUP_COUNT(${ARG1}@conference)} > 0]?user)
same=n,Set(${ARG2}=0)
same=n,NoOp(${DB_DELETE(conf/${MACRO_EXTEN})})
same=n,MacroExit
same=n(user),Set(${ARG2}=1)
same=n,MacroExit

[macro-makeconference]
exten=s,1,NoOp(Validating Conference)
same=n,GotoIf($[${LEN(${ARG1})} < ${CONFnum_MINLEN}]?exiterr)
same=n,GotoIf($[${LEN(${ARG1})} > ${CONFnum_MAXLEN}]?exiterr)
same=n,GotoIf($[${LEN(${ARG2})} < ${CONFpin_MINLEN}]?exiterr)
same=n,GotoIf($[${LEN(${ARG2})} > ${CONFpin_MAXLEN}]?exiterr)
same=n,Verbose(${GROUP_COUNT(${ARG1}@conference)})
same=n,GotoIf($[${GROUP_COUNT(${ARG1}@conference)} > 0]?checkpin)
same=n,Set(DB(conf/${ARG1}/pin)=${ARG2})
same=n,Set(DB(conf/${ARG1}/max_users)=${ARG3})
same=n,Set(${ARG5}=1)
same=n,Set(${ARG6}=1)
same=n,Set(GROUP(conference)=${ARG1})
same=n,MacroExit()
same=n(checkpin),NoOp(Checking PIN)
same=n,GotoIf($["${DB(conf/${ARG1}/pin)}" != "${ARG2}"]?exiterr)
same=n,Set(${ARG5}=1)
same=n,Set(GROUP(conference)=${ARG1})
same=n,MacroExit()
same=n(exiterr),NoOp(Exiting - Something Wasn't Liked)
same=n,Set(${ARG5}=0)
same=n,MacroExit()


From confbridge.conf


[USER]
type=user
music_on_hold_when_empty=yes
music_on_hold_
end_marked=yes
announce_only_user=yes
announce_join_leave=yes
dtmf_passthrough=yes

[conferences]
type=bridge


Some of the differences:
  • The example above gives ability to set all options usually in the confbridge.conf file from within the dialplan.
  • It also does a pssword check to keep just any Joe Random employee from creating conference rooms.
  • Since [CONFERENCE] is included in my users contexts, anybody can just dial any extension 1900 through 1999 to create/enter a conference.
  • I also have an external DID pointing to External-Conf which prompts for the conference room number and then places that call into [CONFERENCES] with that extension.
  • There are a few other changes, but I forget them all.

Technical Details (for developers)

ConfBridge() uses Asterisk's bridging framework which was introduced in Asterisk 1.6.2. There is a common bridging framework in main/bridging.c. The bridging implemenations itself are modules located in bridges/bridge_*.c. There are several implementations with different kind of features. When an application requests a new bridge (e.g. ConfBridge), it has to specify the needed features and the bridging framework will choose the best fitting bridging implementation.

Bugs

ConfBridge crashes in Asterisk 1.8 when users leave at the same time. See bug 16640. The ConfBridge implementation in Asterisk 10 is much improved to the 1.8 version and probably (?!) does not have have this bug.

See also


Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ
Created by: dbackeberg, Last modification: Sat 27 of Sep, 2014 (17:46 UTC) by deux


Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+

Page Changes | Comments

 

Featured -

Search: