A bit about conferences
Not so long ago, we abandoned the use of Skype as a means of corporate communications in favor of Telegram. However, Skype had one very useful thing on board - audio / video conferences. As mentioned in previous articles, Asterisk is responsible for communication, but so far it has worked in a minimal configuration (apart from creating tasks in redmine about missed calls) and we decided to tighten the conference call feature.
It all started with the urgent need to assemble a conference with a client and at that time I had to use the services of third-party companies. But I would like to have my own, as they say with blackjack and other delights!
And so, assembling a conference in Asterisk is as easy as shelling pears! Just call AppConfBridge:
context conference {
100 => ConfBridge(sb);
}
We will not describe confbridge.conf and all possible parameters, all of this can be seen, for example, here voip.rus.net/tiki-index.php?page=Asterisk+ConfBridge
To just chat with your colleagues in your voice, this is quite enough.
And now let's add an admin to the conference, and the ability to invite customers.
1) Permanent admins (Management always wants to be at the head)
We use the AstDB database for this.
database put conference 51 1
Where 51 is the internal number of one of the employees.
And now the challenge of our conference will look like this
context conference {
100 => {
Set(STATUS_ADMIN=${DB(conference/${CALLERID(num)})});
switch (${STATUS_ADMIN}) {
case 1:
Set(CONFBRIDGE(bridge,template)=sb_profile)
Set(CONFBRIDGE(user,template)=sb_admin)
Set(CONFBRIDGE(menu,template)=admin_menu)
break;
default:
Set(CONFBRIDGE(bridge,template)=sb_profile)
Set(CONFBRIDGE(user,template)=sb_user)
Set(CONFBRIDGE(menu,template)=user_menu)
break;
};
Confbridge(sb);
};
}
What we got: if the subscriber dials the conference number with clid 51, then the template and menu of the conference administrator are set for him, we do not give privileges to everyone else.
But what if one of the junior admins gathers the conference? Raise the first one who entered the room:
...
100 => {
Answer;
Set(STATUS_ADMIN=${DB(conference/${CALLERID(num)})});
if ("${CONFBRIDGE_INFO(parties,sb)}"="0"){
Set(STATUS_ADMIN=1);
};
switch (${STATUS_ADMIN}) {
case 1:
...
$ {CONFBRIDGE_INFO (parties, sb)} - returns the number of participants. If there are 0 in the conference, then the first participant becomes the administrator.
But it’s not always convenient to talk on the phone, especially when it comes to a conference with developers where both hands are needed. It would be wrong to create SIP accounts for the developers of our clients, because we will use webrtc.
There were many articles on customization, with proposals to patch asterisk, but in version 13 everything works out of the box. You only need to generate certificates and enable socket support.
The script for generating certificates can be found in the sources or downloaded separately: raw.github.com/rillian/asterisk-opus/master/contrib/scripts/ast_tls_cert
mkdir /etc/asterisk/keys
/usr/src/asterisk-13/contrib/scripts/ast_tls_cert -C asterisk.southbridge.ru -O "centos admin" -d /etc/asterisk/keys
http.conf:
[general]
enabled=yes
bindaddr=0.0.0.0
bindport=8088
RTP
Since we all often sit at the nat, we turn on ice and stun support, otherwise
rtp.conf will not find our voice:
[general]
rtpstart=10000
rtpend=20000
icesupport=yes
stunaddr=stun.l.google.com:19302
Sip. Setting up peers
Activate websocket and create a
sip.conf peer :
[general]
udpbindaddr=0.0.0.0:5060
realm=pbx.domain.ru ; заменить на свой ИП или на доменное имя сервера с астериском.
transport=udp,ws
[webrtc](!)
host=dynamic
context=from-internal
type=friend
encryption=yes
avpf=yes
force_avp=yes
icesupport=yes
nat=force_rport,comedia
directmedia=no
disallow=all
qualify=yes
videosupport=yes
allow=ulaw,alaw,vp8,h264,h263p,mpeg4
dtlsenable=yes
dtlsverify=no
dtlscertfile=/etc/asterisk/keys/asterisk.pem
dtlscafile=/etc/asterisk/keys/ca.crt
dtlssetup=actpass ; Пароль сертификата
[101](webrtc)
defaultusername=101
secret=101Passw0rd
You can find many sip clients on github, for example this github.com/onsip/sipjs-examples
. Now, we are gathering the conference, giving the client a link to the softphone with one button “Join the conference” and everyone is happy.
You can also try to screw Google services for speech recognition and conversation shorthand into the ticket archive, but that's another story.
Author: Centos-admin.ru artzcom system administrator .