Thuc hanh Asterisk

Màu nền
Font chữ
Font size
Chiều cao dòng

accountcode: What account number to use: Asterisk billing account, (string, 20 characters)

src: Caller*ID number (string, 80 characters)

dst: Destination extension (string, 80 characters)

dcontext: Destination context (string, 80 characters)

clid: Caller*ID with text (80 characters)

channel: Channel used (80 characters)

dstchannel: Destination channel if appropriate (80 characters)

lastapp: Last application if appropriate (80 characters)

lastdata: Last application data (arguments) (80 characters)

start: Start of call (date/time)

answer: Answer of call (date/time)

end: End of call (date/time)

duration: Total time in system, in seconds (integer)

billsec: Total time call is up, in seconds (integer)

disposition: What happened to the call: ANSWERED, NO ANSWER, BUSY, FAILED

amaflags: What flags to use: see amaflags::DOCUMENTATION, BILL, IGNORE etc, specified on a per channel basis like accountcode.

;kick tat ca thue bao ra khoi phong

exten=>900,1,Answer()

exten=>900,n,MeetMeAdmin(1000,K)

;kick thue bao ra khoi phong

exten=>901,1,Answer()

exten=>901,n,MeetMeAdmin(1000,k,1)

exten=>902,1,Answer()

exten=>902,n,MeetMeAdmin(1000,k,2)

exten=>903,1,Answer()

;L:khoa phong hop, l:mo khoa phong hop

exten=>906,1,Answer()

exten=>906,n,MeetMeAdmin(1000,L)

exten=>907,1,Answer()

exten=>907,n,MeetMeAdmin(1000,l)

;M:tat tieng thanh vien

exten=>908,1,Answer()

exten=>908,n,MeetMeAdmin(1000,M,1)

exten=>909,1,Answer()

exten=>909,n,MeetMeAdmin(1000,M,2)

exten=>910,1,Answer()

exten=>910,n,MeetMeAdmin(1000,M,3)

;bo tat tieng thanh vien

;exten=>908,1,MeetMeAdmin(1000,m,1)

;exten=>909,1,MeetMeAdmin(1000,m,2)

;exten=>910,1,MeetMeAdmin(1000,m,3)

;N:tat tieng ca phong, n:bo tat tieng

exten=>913,1,Answer()

exten=>913,n,MeetMeAdmin(1000,N)

exten=>914,1,Answer()

exten=>914,n,MeetMeAdmin(1000,n)

;s:giam volume noi trong phong, S:tang volume

noi trong phong

exten=>915,1,Answer()

exten=>915,n,MeetMeAdmin(1000,s)

exten=>916,1,Answer()

exten=>916,n,MeetMeAdmin(1000,S)

;v:giam volume nghe trong phong, V:tang volume

nghe trong phong

exten=>917,1,Answer()

exten=>917,n,MeetMeAdmin(1000,v)

exten=>918,1,Answer()

exten=>918,n,MeetMeAdmin(1000,V)

;t:giam volume noi 1 thanh vien, T:tang

exten=>919,1,Answer()

exten=>919,n,MeetMeAdmin(1000,t,1)

exten=>920,1,Answer()

exten=>920,n,MeetMeAdmin(1000,T,1)

;u:giam volume nghe 1 thanh vien, U:tang

exten=>921,1,Answer()

exten=>921,n,MeetMeAdmin(1000,u,1)

exten=>922,1,Answer()

exten=>922,n,MeetMeAdmin(1000,U,1)

;r:reset volume 1 thanh vien, R:reset volume tat ca

thanh vien

exten=>923,1,Answer()

exten=>923,n,MeetMeAdmin(1000,r,1)

exten=>924,1,Answer()

exten=>924,n,MeetMeAdmin(1000,R)

MeetMe Synopsis

MeetMe conference bridge

Description

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

If the conference number is omitted, the user will be prompted to enter one.

Page Contents Option details Option 's' Option 'q' Option 'r' Option 'j' of chan_local Examples Overview by OEJ (May 23, 2004) Please observe Performance considerations MeetMe with 10+ Users on ISDN PRI Architecture and its limits MeetMe honours only 1 CPU (May 2011) More on option 'b' (AGI_BACKGROUND) AGI_BACKGROUND Pros/Cons Inviting users to a conference (n-way call) Merging conferences Whisper to a conference user Alternatives to the standard MeetMe app_conference app_konference ConfBridge Remote conference hosting Bugs and patches See also

Please note: A Zaptel timer must be present for conferencing to work! See Asterisk timer

New in Asterisk v1.2: The conference application now allows users to increase/decrease their speaking volume and listening volume (independently of each other and other users); the 'admin' and 'user' menus have changed, and new sound files are included with this release. However, if a user calling in over a Zaptel channel that does NOT have hardware DTMF detection increases their speaking volume, it is likely they will no longer be able to enter/exit the menu or make any further adjustments, as the software DTMF detector will not be able to recognize the DTMF coming from their device.

The option string may contain zero or more of the following characters:

'1' — disable "you are currently the only person in this conference" message for first member (new in 1.2 trunk, see bug 6316) (This is not included in 1.2.11) 'a' — set admin mode 'A' — set marked mode 'b' — run AGI script specified in ${MEETME_AGI_BACKGROUND}

Default: conf-background.agi(Note: This does not work with non-Zap channels in the same conference) 'c' — announce user(s) count on joining a conference 'd' — dynamically add conference 'D' — dynamically add conference, prompting for a PIN At the pin prompt, if the user does NOT want a pin assigned to the conference, they should hit the # key. 'e' — select an empty conference 'E' — select an empty pinless conference 'F' — Pass DTMF through the conference. 'i' — announce user join/leave with review — requires chan_zap.so (new in Asterisk 1.2) — Asterisk 1.4 has an issue with loud squelches after announcements. See bug 9430 'I' --announce user join/leave without review 'M' — enable music on hold when the conference has a single caller 'm' — set monitor only mode (Listen only, no talking) 'p' — allow user to exit the conference by pressing '#' 'P' — always prompt for the pin even if it is specified 'q' — quiet mode (don't play enter/leave sounds) 'r' — Record conference (records as ${MEETME_RECORDINGFILE} using format ${MEETME_RECORDINGFORMAT}). Default filename is meetme-conf-rec-${CONFNO}-${UNIQUEID} and the default format is wav. — requires chan_zap.so 's' — Present menu (user or admin) when '*' is received ('send' to menu) 't' — set talk only mode. (Talk only, no listening) 'T' — set talker detection (sent to manager interface and meetme list) 'v' — video mode (this option currently does nothing at all) 'w' — wait until the marked user enters the conference (plays music on hold until marked user enters if M is used)

All other connected users will hear MusicOnHold until the marked user enters. 'X' — allow user to exit the conference by entering a valid single digit extension of the context specified in ${MEETME_EXIT_CONTEXT} or the current context if that variable is not defined. Due to a bug (see 5773 and 5631) this option didn't work in Asterisk v1.2.0. 'x' — close the conference when last marked user exits

Option details Option 's'

Neither the option 's' nor the option 'p' works if used together with 'X'.

user (i.e. without the option 'a' being set): Upon pressing * plays the voicemenu "Please press 1 to mute or unmute yourself"; Asterisk v1.2 now comes with volume adjustment for the individual MeetMe individual participants by pressing * followed by 4 or 6; likewise patch 4170 lets one control the volume of ones (own?) voice by pressing * followed by a series of 7's and 9's for up and down until you press 8 to accept and return to normal operation. admin (with option 'a' being set): Upon pressing * plays the voicemenu "Press 1 to mute/unmute yourself, 2 to lock/unlock this conference" 1 - mute/unmute 2 - lock/unlock conference 3 - eject last user who joined conference 4 - Decrease Volume of Conference with each 4 you press - end with 8 6 - Increase Volume of Conference with each 6 you press - end with 8 7 - Decrease your volume - end with 8 9 - Increase your volume - end with 8

Note: You cannot lock out an admin user or eject an admin user - but both work just fine on ordinary users!

Option 'q'

There was a long lasting and annoying bug in Asterisk <= 1.0.9: Audio delay in MeetMe using SIP when not 'q' mode - supposedly fixed in Asterisk v1.2. See

bug 4252 and bug 3599

Option 'r'

Set ${MEETME_RECORDINGFILE} before starting MeetMe() with the record option. Otherwise the recorded conference sound files will be stored to /var/lib/asterisk/sounds.

exten => s,n(record),SetVar(MEETME_RECORDINGFILE=/var/spool/asterisk/meetme/conference_recording-${EPOCH}-${USER}); exten => s,n,MeetMe(,rDMpc) ;Make new Room and record call.

Option 'j' of chan_local

The Asterisk jitterbuffer for IAX and SIP in Asterisk 1.4 (and most probably 1.6 as well) only works for calls that bridge channels and does not apply to calls to applications like MeetMe() or Record() etc. However by using the Local channel construct together with the 'j' option there is a workaround available:

[some-context]

exten => 123,1,Dial(Local/124 <at> some-context/nj)

exten => 124,1,MeetMe(some-room,dM)

Applying such a jitter buffer can increase voice quality, but that at the expense of additional latency.

Examples

Conference room 101 as defined in meetme.conf with password (PIN) 123456

exten => 500,1,MeetMe(101||123456)

Authenticated conference room

exten => 18,1,Answer

exten => 18,2,Wait(1)

exten => 18,3,Authenticate(5678)

exten => 18,4,MeetMe(18|p)

exten => 18,5,Playback(vm-goodbye)

exten => 18,6,Hangup

Dynamic conference room, user must input room number to be created:

exten => 9999,1, Wait(1)

exten => 9999,2,MeetMe(|Md) ; NOTE: If you add the option 'e', * will choose room # for you

;Change the 'd' option to 'D' if you want to have a pin number for the conference

Dynamic conference room 123 with quiet entering. User foo becomes the marked user if he dials extension '10'. Conference lasts until foo leaves. When foo exits other users who dialed extension '11' will be disconnected.

exten => 10,1,MeetMe(123|Aqd)

exten => 11,1,MeetMe(123|xqd)

From 1.6 on ex MeetMe(123,Md) use commas not pipes

Overview by OEJ (May 23, 2004)

Have you discovered the not-so-simple-anymore "Simple Meetme Conference Bridge" application? It's a killer app in Asterisk. With this app, you get a lot of functionality:

Multiuser conferencing over multiple channels - VoIP and PSTN Announcements: One talker, multiple listeners Administration - kicking users, muting and locking conferences Background music while waiting for other participants Statically configured conferences with pin code auth for entry Dynamic conferences, created on demand (the conference number is told at first user entry)

In CVS head, there's been a number of additions to MeetMe lately, additions that make MeetMe much more than a "simple" conference bridge.

The dial plan applications for the MeetMe system in CVS head are

MeetMe - enter a conference (in some cases creates a dynamic conference) MeetMeAdmin - kick users, lock conferences, mute conferences MeetMeCount - count number of participants for a conference

There's also a new family of CLI commands for managing MeetMe:

Meetme List all conferences

MeetMe kick <confno> <user> Kick a user out of a conference

MeetMe kick <confno> all Kick all users

MeetMe list <confno> List participants in a conference

MeetMe lock <confno> Lock a conference - no more users

MeetMe unlock <confno> Unlock a conference

MeetMe mute <confno> <user> Mute a user in a conference

MeetMe unmute <confno> <user> Unmute a user in a conference

Some additional notes on Meetme conferences

The conference bridge runs ulaw codec by default. If you let people connect with GSM or other codecs, Asterisk will use CPU power to convert audio between codecs The variable MEETMESECS contains the amount of seconds user was in conference The Meetme app reads meetme.conf for each static conference joined i.e. there's no need to reload the config for each change Authenticate with the authenticate() app if you want a user based auth for a meetme conference You can limit the number of participants by using meetmecount() and variables in the dial plan To be able to run MeetMe, your Asterisk server needs a Zaptel timer. This is provided from Digium cards or through various drivers. See http://www.voip-info.org/tiki-index.php?page=Asterisk%20timer

Please observe The MeetMe application needs a timer to work. There are different ways to get the timer to work, but it won't work by default if you haven't got a Digium Zaptel hardware interface card installed. At this time only zaptel devices may be used. If you do not have a Zaptel device see the ztdummy instructions for timing. As of now (Jan. 2004, v0.7.1) passwords only work with static conferences A common conference password can also be specified in meetme.conf, example:

conf => 1234,4231 ; conference 1234, password 4231

Dynamic conferenceswork differently than you might think. Evidentally the idea is to make a conference IF IT DOES NOT ALREADY EXIST. So if user A make dynamic conference #200, then user B comes along and also makes dynamic conference #200, it is considered correct behaviour for user B to be joined to user A's conference instead of warning user B that conference #200 has already been created by someone. In addition, if the dynamic conference was created by user A to have a PIN, user B will instead be told 'invalid PIN' and then be prompted for a new conference number. The workaround for me was to set up dynamic conferences with the 'e' option so * would choose the conference number so the user's would not run into this behaviour. See http://bugs.digium.com/bug_view_page.php?bug_id=0002200.

Performance considerations MeetMe with 10+ Users on ISDN PRI

I was experiencing 'tunnel' sounds at 8 or 9 users, and total feedback at 10+ users in a meetme conference using ISDN PRI.

Most things I've read about PRI stated that echo cancelation was not necessary because the line was digital, and most telco's have some kind of echo cancelation mechanism. However, real life proves otherwise.

I added the following to /etc/asterisk/zapata.conf, and it cleared up the problem 100%

echocancel=yes echocancelwhenbridged=yes echotraining=yes

Architecture and its limits

There is only one lock in all of app_meetme (version 1.2) and that is on the linked list that holds the configurations for each conference. When something needs to be changed in a single conference, such as adding another channel, all of the conferences get locked. This is not that big of a deal when you have one 1 or 2 conferences but when you have 10 to 15 it becomes a somewhat of a problem and when you have 150 with channels being added and removed all the time it is a big problem. Sure using a single lock does a great job of helping to prevent deadlocks, but it would be far better to use thread safe programming techniques which do not need a lock.

MeetMe honours only 1 CPU (May 2011)

Q: What is better more cores (eg. 2x quadcore) or more CPU speed for a server that handle a lot of of Meetme Concerences with hundreds of concurrent G711 alaw Channels (no transcoding)?

A: I don't have an answer for you (too many unknown variables to say one way or another) but I do know that MeetMe currently is serialized onto a single CPU.

For example, all the conference participants threads queue up their audio data on their pseudo channels which can happen in parallel on SMP systems. Then they wait for the "masterspan" to mix the audio for all conferences currently active. This happens on a single CPU to simplify keeping channels synchronized to whatever timing source is your master. When this was originally written there were not too many SMP systems in use. Then the mixed audio is queued back on the channels. Finally, all the user space channel threads can read out the mixed audio which can happen in parallel on SMP.

If you have too many conferences, one CPU may not be able to mix all the audio and you will have audio problems even if there are 7+ other CPUs that are essentially idle while waiting for one CPU to mix everything. You should be able to handle 512 conference participants on a modern server system without problem. The current trunk of DAHDI linux limits the number of open pseudo channels to 512 for this reason. [1]

[1] http://svn.asterisk.org/view/dahdi?view=revision&revision=9610

The new ConfBridge module in the upcoming Asterisk 1.10 release may not have this limitation.

More on option 'b' (AGI_BACKGROUND)

as of August 2004

Question:

I've been reading some old threads and still have a couple of questions

about applying the AGI_BACKGROUND script inside a Conference. Perhaps

someone can save me a bit of fidd'lin.

Am I right in assuming that the MEETME_AGI_BACKGROUND script **WILL WORK**

on SIP conferenced channels **WITHOUT** an **ACTIVE** zap channel-- AS LONG

AS THERE IS A DIGIUM CARD INSTALLED IN THE ASTERISK BOX?

No, that's not correct.

The merging of incoming voice packets and the distribution of the merged packets to the output channels is done within the Zaptel driver. For true Zap channels, this happens completely at the driver layer. For a non-Zap channel, app_meetme creates a Zap pseudo-channel for the driver

to use, and then copies the audio data in both directions between the non-Zap channel and its associated pseudo channel. You can see this in the middle of the conf_run() function.

The catch is that conf_run() EITHER calls the AGI script, OR runs the pseudo-channel copying loop, but not both. So if you use an AGI script, there is nothing linking the non-Zap channel to its associated pseudo.

It *is* necessary either to have a Digium card or a dummy timing driver (e.g. ztdummy or zaprtc) in order for MeetMe to work at all, but that doesn't help you use AGI with SIP channels: They have no capacity to use any AGI script at all. If they try to, they get no audio.

Note that using an AGI script loses other built-in functionality too, like mute/unmute, kick, and MOH while there is only one user.

I can't see a reason why Zap and SIP channels couldn't use different extensions to get to the same MeetMe room with different flags and (for the Zap channels) different AGI scripts .

AGI_BACKGROUND Pros/Cons

With AGI_BACKGROUND you lose the ability to MUTE or KICK people from conferences via the command-line.

The meetme parameter 'p' (pound exit) also ceases to function with AGI_BACKGROUND.

With AGI_BACKGROUND You also loose the ability to MONITOR the -OUT side of the channel.

If you want to kick someone from the conference, simply kill -9 their AGI_BACKGROUND task.

Once the AGI_BACKGROUND script stops running, the user is automatically removed from the conference.

All DTMF events are sent to the AGI_BACKGROUND process/script. So you could have your .agi script loop endlessly, capturing touchtones, then decided what to do when a user presses a certain key.

AGI_BACKGROUND opens MANY cool programming possibilities as well. You can use interprocess communication (sockets, signals, etc). to remotely control the users experience in a MeetMe conference. (ie: Have it play .gsm files based on certain external events, or based on the users input).

Inviting users to a conference (n-way call)

Take a look at the Asterisk n-way call HOWTO that explains how it can be done.

Merging conferences

This may be done using Asterisk local channels and Asterisk manager API. (Probably, with AGI or Call Files)

He is an example of OriginateAction witch merge conferences 123 and 124:

from dialplan (context = default):

exten => 7799,1,Meetme(123|qd)

exten => 7798,1,Meetme(124|qd)

from Manager API:

Action: Originate

ActionID: 12345678

Channel: local/7798

Context: default

Exten: 7799

Priority: 1

Whisper to a conference user

See patch 8446: In Meetme, certain users can private whisper othe users through the 'whisper' functionality similar to ChanSpy.

I also included a 'z' flag:

'z' — all dtmf key events will be sent to the manager

This allows the flexbility for users hook their own manager commands to the meetme system by getting what key is pressed and then issuing their own manager command. Currently everything is hardcoded which is not customizable.

Alternatives to the standard MeetMe

app_conference

Another variant is app_conference, that according to the author, can handle more simultaneous users:

http://sourceforge.net/projects/appconference/

Asterisk cmd Conference

"If people are looking for a higher-capacity conferencing application,

take a look at app_conference, in the iaxclient (on sourceforge) CVS. I

haven't really benchmarked meetme, but I _think_ that app_conference

might be able to beat it. Certainly in it's designed application it

will (iax clients which use VAD on the client side)."

app_konference

Yet another variant is app_konference, app_conference can hold more then 1000 concurrent users in a conference:

http://sourceforge.net/projects/appkonference/

Asterisk cmd Konference

"app_konference is a fork of app_conference focusing on stability and growth many bugs introduced in app_conference have been fixed such as locking issues. Also Volume controls have been added app_konference focuses more on telephone rather then video.

app_konference 1.2 adds support for channel spying and whispering as well as thread priority enhancement for the conference thread, more stability and performance enhancements, app_konference 1.2 was released 2009-09-23"

ConfBridge

Asterisk 1.6.2 comes with the new ConfBridge addition that, amongst other features, should support g722 wideband conferencing.

The good old MeetMe application will never support anything other than 8kHz sampling rates, as it uses DAHDI for audio mixing and DAHDI only supports 8kHz audio.

In 1.6.2, however, there is a new ConfBridge application that can provide wideband audio mixing; you can read the application help to see how to use it. As far as I am aware, at this time is only supports a single sample rate per conference, it cannot support mixed-rate channels in a single conference.

When mixing audio, ConfBridge will use SLIN at 16kHz to handle wideband channels, since mixing must be done in the linear domain.

Remote conference hosting

Yet another alternative is to use a third party for conferencing: http://www.junctionnetworks.com

They provide IAX and SIP access to conferencing that can be integrated into a dialplan

with a line like

exten => 7000,1,Dial(IAX2/[email protected])

-or-

exten => 7000,1,Dial(SIP/[email protected])

which would call into their conference service via extension 7000 off your local system.

They provide reservationless and reservation based conference rooms as well as access

to conferences via local toll and 800 numbers for outside callers - all managed via a

web portal - where you can get multiple user accounts all under a single customer account

with usage reports. It makes for easy tracking of what, when, and how much people

in the organization or using conferencing for.

Asterisk cmd MeetmeAdmin MeetMeAdmin

MeetMeAdmin(confno,command[,user])

Description

Run admin command for conference

"

'K' — Kick all users out of conference

"

'k' — Kick one user out of conference

"

'L' — Lock conference

"

'l' — Unlock conference

"

'M' — Mute conference

"

'm' — Unmute conference

"

Most of the features are deprecated in 1.4

From the 1.4.13 Source

MeetMeAdmin(confno,command[,user]): Run admin command for conference

'e' — Eject last user that joined

'k' — Kick one user out of conference

'K' — Kick all users out of conference

'l' — Unlock conference

'L' — Lock conference

'm' — Unmute one user

'M' — Mute one user

'n' — Unmute all users in the conference

'N' — Mute all non-admin users in the conference

'r' — Reset one user's volume settings

'R' — Reset all users volume settings

's' — Lower entire conference speaking volume

'S' — Raise entire conference speaking volume

't' — Lower one user's talk volume

'T' — Raise one user's talk volume

'u' — Lower one user's listen volume

'U' — Raise one user's listen volume

'v' — Lower entire conference listening volume

'V' — Raise entire conference listening volume

MeetMeCount Synopsis

MeetMeCount(confno[|var])

MeetMe participant count

Description

Plays back the number of users in the specified MeetMe conference. If var is specified, playback will be skipped and the value will be returned in the variable.

Examples

You can limit the number of users in a conference with something like this:

[globals]

CONFMAX => 10 ; max persons in conference

exten => 8081,1,Macro(stdmeetme,8081))

[macro-stdmeetme]

; with limit to max number of persons in conference

exten => s,1,MeetMeCount(${MACRO_EXTEN}|count)

exten => s,2,Gotoif,$[${count} >= ${CONFMAX}]?103

exten => s,3,MeetMe(${MACRO_EXTEN})

exten => s,4,Goto(s|1)

exten => s,103,Background(conf-full)

exten => s,104,Hangup

Bạn đang đọc truyện trên: Truyen2U.Pro