Surely you have a landline phone, probably, even if it is not connected and you do not use it! In my case, he hasn’t been working for more than two days, because some rookie musicians call me and play their music without even saying their names!
The idea is to connect this PSTN telephone line to the VOip Gateway FXS / FXO, pass calls to Asterisk IVR and then ask a simple question “If you are a person, press 7” and then the call goes to a phone.
I take Orange Pi PC Plus, I have a DIY case with cooler, but the stock will also be worth it.
It contains Debian Stretch with Armbian Linux 4.19.62-sunxi. I have updated it and instaled the Asterisk.
apt-get upgrade
apt-get install asterisk
I run it and look at the state
systemctl start asterisk
systemctl status asterisk
To start at the beginning
systemctl enable asterisk
Yes, it’s still the same old Asterisk
asterisk -rvvvvv
Asterisk 13.14.1~dfsg-2+deb9u4, Copyright (C) 1999 - 2014, Digium, Inc. and others. Created by Mark Spencer <markster@digium.com> Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details. This is free software, with components licensed under the GNU General Public License version 2 and other licenses; you are welcome to redistribute it under certain conditions. Type 'core show license' for details. ========================================================================= Connected to Asterisk 13.14.1~dfsg-2+deb9u4 currently running on OrangeHomeServer (pid = 6142) OrangeHomeServer*CLI>
To recall what to do i used these instructions mike42.me/blog/2015-01-02-how-to-set-up-asterisk-in-10-minutes as always, not all essentials are here, but it’s enough for me to start!
I don’t install a webgui for Asterisk, of course that would make installation easier, but he doesn’t do everything, so I’ll edit the configuration files directly!
Add to end of file
vi /etc/asterisk/users.conf
this code
[6001] fullname = First secret = 1234 hassip = yes context = users host = dynamic [6002] fullname = Second secret = 1234 hassip = yes context = users host = dynamic
And add to file
vi /etc/asterisk/extensions.conf
in the end of that text
[users] exten => 6001,1,Dial(SIP/6001) exten => 6002,1,Dial(SIP/6002)
Enter the asteriska console
asterisk -rvvvvv
and do
reload
To do a test, install the Linphone app on my Android phone – it’s a terribly buggy program, it worked only when I created the profile for SIP again. The configuration page – it is my orange’s IP with Asterisk, the UDP transmission method.
And also i had problems with access rights, if it asks for the right to record conversations, it is actually the right to use a microphone … or not … but after that it works!!! I called numbers 6001 and 6002, called from one to another, and it works!
Now I do IVR. First I need an audio file, for this we need two programs!
apt-get install espeak
apt-get install sox
It is important to go to the correct folder and create files there.!
cd /var/lib/asterisk/sounds/custom/
Good program, the sound of a real robot. There is no Russian, but the Serbian is good, except the numbers!
espeak -s 1 -v sr "[[_::_::_::]]Zdrastvuite[[_::_::_::]]Esli vi reklamniy robot nazhmite piyat[[_::_::_::_::]]Esli vi chelovek [[_::_::_::]]nazhmite sem[[_::_::_::_::_::_::_::_::_::_::_::_::_::_::_::_::_::_::]]ot klu chaius[[_::_::_::]] dosvidania" -w ivr.wav
Asterisk needs ulaw file, so lets do it
sox ivr.wav --rate 8000 --channels 1 --type ul ivr.ulaw lowpass 3400 highpass 300
Here it is:
And we change the file
vi /etc/asterisk/extensions.conf
the context users and we add a new spam_ivr
[users] exten => 6666,1,Goto(spam_ivr,s,1) exten => 6001,1,Dial(SIP/6001) exten => 6002,1,Dial(SIP/6002) [spam_ivr] exten => s,1,Answer(500) same => n(loop),Background(/var/lib/asterisk/sounds/custom/ivr) exten => 5,1,Dial(SIP/6001) exten => 7,1,Dial(SIP/6002)
Enter the asteriska console
asterisk -rvvvvv
and do
reload
Here it turned out a little different than planned. The IVR hangs when the audio file ends, I did not know how to set a timeout. Therefore, the recording is lengthened in an unnatural way.
I call 6666 and it works !!!
How to choose a VoIP router
Something is not right with the choice at this time. Apparently, half of the people stopped waiting for the installation of a fixed telephone in their apartment, and the other half, due to spam, disconnected it, like me …
Now (autumn 2019) you can buy two brand models.
First DVG-7111S B1 is the old DVG-7111S A1 in a new square fashion box The model was popular in 2012 judging by the questions on the forums on how to make it work, and then did not develop, the latest firmware is from 2016!
And Grandstream ht813, I bought that one !!! The router turned out to be with firmware of year 18, but there is also one of 2019, it is a fresh VoIP! I have known Grandstream for a long time, about 15 years ago I installed their phones and I was surprised that they had a web menu from the 80s and nothing has changed, it has the same menu, the same color and fonts!
I was surprised that the price is quite large 5500RUR, and the router comes in a white box without a beautiful image, which is not closed at all, and inside there is only a router, power supply, connection cable and a piece of paper that is not enough to go to the bathroom, there is nothing else!
There is also an absolutely incredible cosplay by the Chinese. In all the details, they stamp the SPA3000 and SPA3102 models, with all the stickers, manuals under the brand of the company that no longer exist for more than 6 years – Linksys by Cisco! I am sure that the firmware in them is original from Cisco 10 years ago (just like in Huawei switches), but of course the chips are not original! At one time, I thought that Lynksis is Cisco, that is why I respected Lynksis a lot, but now I read the wiki and that was not true: Cisco bought Sipura and Lynksis and decided that, under the Lynksis brand, it was going to produce Sipura VoIP routers. .. I have one of those SPA3000 (ese) It still shows signs of life, but there is so much noise soo I didn’t dare to buy one of those!
Lets connect the Grandstream ht813 VoIP router to Asterisk
First we will make calls from the PSTN telephone line to the Asterisk!
Here you need a clue to followtrustore.ru/article/asterisk/nastrojka-grandstream-ht503-dlya-freepbx-asterisk-trixbox-elastix.html It doesn’t matter that many years have passed and the model is different: nothing changes on the Grandstrem menu for decades, even on different models! As I do not have an Asterisk webgui, it will be a little more difficult to install …
Let’s go to Grandstream ht813 in the BASIC SETTINGS tab in Unconditional Call Forward to VOIP: you have to write like this
This configuration passes all the calls that arrive at the FXO port to the number 6666 on the IP of my asterisk.
To apply changes click Apply
Then we go to FXO PORT and do that
Here I change Primary SIP Server and SIP User ID and Authenticate Password asterisk does not accept the call without an account!
To apply changes click Apply
Here is a funny thing! VoIP router cannot hang up the call; He simply does not understand that it is hung on the other end. To do this, you need to be told what intermittent beeps to hear: here, for the GPON RV6699 router, they are like this
Translate from: English
228/5000
Here I change Enable Current Disconnect and Enable PSTN Disconnect Tone Detection and STN Disconnect Tone and AC Termination Model and PSTN Ring Thru FXS
To apply changes click Apply
I will tell you how to find parameters for your line later
And the fsx port will be a normal phone with the number 6002, I open FXS PORT
171/5000
Here I change Primary SIP Server and IP User ID and Authenticate Password
To apply changes click Apply
I am now editing asterisk files
vi /etc/asterisk/extensions.conf
extensions will be those
[users] exten => 6666,1,Goto(spam_ivr,s,1) exten => 6001,1,Dial(SIP/6001) exten => 6002,1,Dial(SIP/6002) [spam_ivr] exten => s,1,Answer(500) exten => s,2,Monitor(wav,,m) same => n(loop),Background(/var/lib/asterisk/sounds/custom/ivr) exten => 5,1,Dial(SIP/6001) exten => 7,1,Dial(SIP/6002)
A call recording line is added here
exten => s,2,Monitor(wav,,m)
Call files will appear here /var/spool/asterisk/monitor
And in the users.conf file
vi /etc/asterisk/sip.conf
I add an account for the router for the pstn fso line all the text is like this
[6789] fullname = MGTS PSTN secret = 1234 hassip = yes context = users host = dynamic [6001] fullname = Test Android secret = 1234 hassip = yes context = users host = dynamic [6002] fullname = Home phone secret = 1234 hassip = yes context = users host = dynamic
Enter the asteriska console
asterisk -rvvvvv
and do
reload
And it works!!!
How to choose the PSTN disconnection tone for your telephone line?
I called from my mobile phone to my house, I waited for IVR, I pressed the number 7, then cut the call, but the bell continued ringing, Grandstream continues calling even though the call stopped, all that call was recorded by Asterisk! all the sounds!
I pick up the audio file and open it in the program Free, open source, cross-platform audio software Audacity.I select one beep from a series of final beeps and see its spectrogram Analyze > Plot Spectrum…
I take the cursir to the top, and immediately jump to the top, I look down Peak 425Hz 20.1Db
I measure the duration of the beep and the silence between them
It’s at the bottom, just select Length and End of Selection I have 359 milliseconds rounded will be 350
And that’s it, then just substitute in the formula
Syntax: f1=freq@vol, f2=freq@vol, c=on1/off1-on2/off2-on3/off3; Allowed Range: freq = 0 to 4000Hz; vol = -40 to -24dBm Default: Busy Tone: f1=480@-32,f2=620@-32,c=500/500;
For my MGTS telephone line through GPON RV6699, I need to insert
f1=425@-21,f2=425@-21,c=350/350;
The peak is one, but there may be more therefore f1 and f2 , for one peak everybody describe it twice, then c is the duration of the beep and silence!
We are now calling from a landline through Grandstream HT813 on a PSTN line
It’s easy (as in SPA3000, but with different letters) only in Dial Plan in the FXS PORT tab write
{ L:x+ }
Everything that is dialed on a landline is passed to PSTN. But there are no ringing beeps, so you must wait until they answer you.
A spam call will appear here, when I catch it!
Pure robot: failed attempt!
The human robots from callcenters calls on weekends (bastards) also do not pass, uf i would give everything to see their faces at this moment :)))
Leave a Reply