
As many have already guessed, it will be a question of the opportunity offered by the Google Voice service. In a post three years ago, the process of registering an account in GV was already described. At the same time, it was possible to receive calls to SIP devices, but to initiate a call, you still had to log into your account and call from there, which is rather inconvenient. In this post, I will talk about how to fully make friends with Google Voice and SIP.
American telephone number
I'll start from the beginning. To create an account with Google Voice, you need to confirm that we have a US phone number. Therefore, the first thing you need to get it somewhere. There are two options:
IPKall and
GroovyTel .
If there were no problems with IPKall before, now everything is not so smooth. First, most of the numbers received will be already registered to someone else’s Google Voice accounts, and when we try to add a number, we’ll get the message: “Google Voice accounts. Forwarding numbers cannot be shared across more than two accounts. "Secondly, there is a suspicion that Google imposed a restriction on IPKall numbers - 1-2 years ago, people in foreign forums complained that they could not register numbers with the code 360. Personally, I I could not get a number in IPKall that Google would have liked, even though I tested about 10 pieces with different codes. Perhaps you are more lucky.
On GroovyTel, we immediately get a "good" number, but there are some nuances. For example, the number cannot be redirected to a SIP address, but there are other options: Google Talk, MSN, Truphone and even Skype. Configuring GTalk redirection. To do this, you can specify your email address in the “RingTo Address” field immediately after registration, or after registration, on the
My Numbers page. The second feature of GroovyTel is that the number will become active only after you confirm your account and get the status “Active”. It will take approximately 24 hours.
Google voice
To get a Google Voice number, we need an American IP. For our purposes, any free VPN is suitable, for example
TunnelBear . Download, run, register, connect.
Now go to
google.com/voice and accept the agreement. A button-link Get a Voice number should appear on the left. If not, just refresh the page.
')

Click. In the message that appears, select "I want a new number". This is where Google will offer to enter our American number, and then confirm it. To do this, click on the Connect button, after which the female robot will call and ask you to enter a two-digit verification code.

If you still managed to get an unused number in IPKall, then launch your favorite SIP client and answer the call. For the GroovyTel number, the verification process is complicated by the fact that it does not support SIP. If you haven’t configured GTalk forwarding yet, do not forget to do it. To receive calls directly to Gmail, you need to install the plugin from the
Google Chat page. By the way, it does not work in 64-bit Internet Explorer.
After that, in a new tab, open the Gmail account to which we redirected the GrooveTel number; go to settings and enable chat in the "Chat" tab. Save the settings,
do not close the tab with Gmail . By the way, you can already disconnect from the American VPN.

Finally, you can click Connect.
The melody will play and a call acceptance window will appear directly in the Gmail interface. Click Answer. Do you hear nothing? That's right, because we still do not have a Google Voice number. In general, approximately 5 seconds after clicking on the Answer button, you need to enter the verification code in the chat window and press Enter.

If the moment was successful, a new window will open in Google Voice, where you will be asked to choose a number. If not, click Hang up and try again. In the end, everything should work out.
After we have created an account, you need to configure it a little. First of all, on the Phones tab, we remove the checkbox from the GrooyTel number (or IPKall) and leave only Google Chat. This is needed for further configuration.

On the Calls tab, we disable Call Screening, otherwise every time the robot will ask the caller to introduce himself, and then switch it to voice mail.

The remaining settings can be changed as you wish.
Done! Now you can get to the main point - integrating Google Voice with SIP.
SIP Integration
For a while, turn off the sound in the columns, because the site on which we need to register, thinks that flash animation with an annoying screech on the main one is cool.
We go to the site of a virtual digital PBX
PBXes , click Create Your Account in the upper right corner and register. Obviously superfluous information, for example, the full address and date of birth, you can specify any. Go to your account.
Extensions
On the left, select Extensions, then SIP. Extension Number must contain at least 3 digits. I advise you to choose something simple, for example, 200 or 300. The name (Display Name) we indicate any. After that click on the Submit button. A red confirmation bar appears on top, which you also need to click on.

In the list on the left, select the newly created Extension and create a password for it. Login is generated automatically in the format account name-extension number. We confirm the changes.

Trunks
This is what makes everything work. So, click on the section Trunks, then - Add SIP Trunk. Previously, pbxes allowed to create GTalk trunks on free accounts, but then this feature disappeared. But not really. To go to the GTalk Trunk creation page, you need to replace tech = SIP with tech = GTALK in the address bar of your browser.

Fill in the fields.
But do not rush to click Submit. First, it’s not too safe to enter a password from mail and other Google services anywhere. Secondly, pbxes does not know how to properly handle passwords with numbers and special characters. Therefore, we need to create a one-time password for pbxes.
To do this, go to
the security settings of the Google account on which Voice is configured , and enable two-step authentication. On the two-step authentication settings page, click on the link “Application Password Management” and generate a new password for pbxes. Use this password in the GTalk Trunk settings, click Submit, confirm the change of settings. Now two-step authentication can be disabled if you do not need it.
Additional instructions for those who can not add GTalk TrunkWe need a phone on Android, as well as installed programs
Sipdroid and
Google Voice .
First, launch Google Voice and go to the account on which the GV is configured. Since we are already set up, feel free to click "Next" until the item "Calls with Google Voice" appears - select "Ask each time." The voice mail setting is skipped and again on.

Now we start Sipdroid. From the bottom there should be a button “New PBX linked to my Google Voice” - click on it.

The program will automatically create a GTalk Trunk and ask for a password for it. You will also need to enter the login and password for the new pbxes account, because it will not be possible to create a trunk on the old one. That is, either you register through the computer and create a trunk manually, as described above, or create an account via Sipdroid. If you had to go the second way, then do not forget to delete the first account. After this, Google Voice and Sipdroid can also be deleted.
We go to the
PBXes website and log in with the data that was specified during registration via Sipdroid. Go to the Trunks section and check if our GTalk Trunk is there. Next, change the password to one-time and save the settings. Further actions are the same for everyone.
Inbound Routing and Outbound Routing
Go to the section Inbound Routing and check that we have at least one incoming route. Usually the route "/" is automatically created. We check its settings.

Further in the section Outbound Routing, you need to create an incoming route. To do this, select our GTalk Trunk in the drop-down menu, click Add and save the settings.

The pbxes settings are over.
SIP Settings
To make and receive calls, you can use a softphone, a sip client on a mobile device, a hardware phone, etc. The basic settings are the same everywhere.
Login: login in the format of the name name-extension number, which is specified in the settings of the Extension
Password: the password you came up with for the Extension
Server (Proxy): pbxes.org
Port: 5061
Protocol: TCP
We try to connect to SIP. To make sure that everything is set up correctly, go back to the pbxes website in the Status section and check our Extension - next to the name there should be a “circle” of green color.

We make a test outgoing call to your Google Voice number. If everything is in order, then the female robot will answer and say that there are no new messages in the voice mail. To check incoming calls, go to the Google Voice settings, go to the Voicemail & Text tab and click the Record New button opposite the Recorded Name item. The same robot woman will call and ask for a name. We press on the end button.

Personally, my incoming calls did not work right away. Those. The incoming call was, but when answered, it was immediately dropped. The problem was solved in a rather strange way - it was necessary to make several outgoing calls and accept several incoming calls using
Sipdroid .
At this point you can finish. Now you have an American number that you can call or send SMS to anyone and, most importantly, from which you can call absolutely free of charge to the USA and Canada using your mobile or SIP phone. I hope for someone it will be useful.