After reading this post
, I decided to share my experience.
Currently 2 simple tasks are solved:
- all calls to the PSTN number (normal city) are forwarded to a mobile phone, which I always have in my pocket and, at the same time, to a SIP phone that is at home
- From a SIP phone, I can call both in Russia and in some of the countries I need at minimum rates.
How is this done?
Choose a DID number
It all starts with the phone number to which they will call you, the common name is Direct Inward Dialing (DID) number
The cheapest offer with direct Moscow number - " Baza
" (provided by the Central Telegraph). At the time of writing the post, the cheapest fare is
250 rubles per month, plus a one-time fee for connecting a number in code 499 or 495, to choose from. When signing the contract, it is better to immediately ask for the connection to be redirected to a SIP device (additional service “Baza-IP”, the connection is charged one-time). Forwarding to SIP is free. It is my choice.
If you need a very cheap and angry, there is a mango-office, a Moscow number with a tone dial
for 30 rubles / month :) I have not tried this option.
You can buy a DID number from 49 local countries from the localphone
(Russia is not on the list) with a payment of £ 0.75 (≈37 rubles) per month. I have not tried this option yet, but I plan it :) A room in London or New York can be useful.
Customize the "Bas"
In the "personal account" we go to the "redirection" section and set, to your taste, the settings:
- number of simultaneous incoming connections → "1"
- call forwarding to voicemail → “off”
Next, in the “Forwarding Numbers” subsection add the magic phone number: 88830849XXXXXXXXX. For example, if you have a phone number of the base (499) 501-2345, then you should set the redirection to the number 8883084995012345. Forwarding to this number means redirecting to the SIP device, which is registered on the database server. The remaining redirection numbers, if any, can be deleted.
This completes the minimum required settings.
For Asterisk, a cheap virtual server in Germany
was selected on Xen technology for € 3 / month: 128Mb RAM, 256Mb swap, 10Gb disk, Debian stable OS. At the moment this is more than enough.
Connecting "Bas" and Asterisk
It is enough to enter the following lines in /etc/asterisk/users.conf:
secret = ***
defaultuser = 849********
trunkname = baza
hasexten = no
hassip = yes
hasiax = no
host = qwerty.cnt.ru
context = from-baza
insecure = invite
fromuser = 849********
fromdomain = qwerty.cnt.ru
type = friend
callbackextension = 111
disallow = all
allow = alaw
allow = ulaw
allow = g729
nat = no
canreinvite = nonat
dtmfmode = rfc2833
And we create a “from-baza” context in terms of numbering with one single number, which was specified above in the callbackextension parameter. The easiest option in /etc/asterisk/extensions.conf:
Exten => 111, 1, Dial(SIP/terrasip/79*********&SIP/112,60)
Exten => 111, n, Hangup()
include => inc-redirect-to-me
We call simultaneously on the mobile phone through the TerraSIP
operator and on the SIP phone standing on the table. I will not give the last settings - everything is standard.
Operator selection for VoIP traffic termination
It was not without adventures.
At first, the choice seemed obvious - Betamax. This is a German VoIP operator with very tasty tariffs and, with it, good call quality. He works through several dozen of his resellers, so first we look at the rates in the pivot table
, then check in with the reseller with the most favorable rates and enjoy life :) I did so.
And yesterday everything stopped working. Betamax servers consistently send a message to my asterisk: "SIP / 2.0 503 For wholesale traffic, check www.voicetrading.com
The investigation showed that it was the IP address of my virtual server that was banned - from my home computer all calls under the same accounts pass. Posted in support. They pretend that they know nothing and offer me to check my settings. The aforementioned voicetrading.com is also a Betamax reseller, but it works with organizations and the minimum contribution there, as far as I was able to figure out, is $ 500 (versus € 10 for the rest).
Summary: Betamax is not suitable for my purposes, as sad as it sounds.
Now I use the TerraSip
operator. Tariffs here are slightly higher
than that of Betamax and, most importantly, there are no free minutes, as in the latter. Asterisk settings for working with TerraSip will also not be given - everything is described in detail
on their website.
I add additional functionality as I read the documentation for Asterisk and when there is a desire to improve everything :) The plans include setting up your voice mail, call screening
(taking into account that Caller ID is lost when forwarding to a mobile phone), recording conversations, black / gray lists , callback to mobile phone, etc. I will share the nuances :)