1. SRV Lookup should be enabled in the FreePBX:
Go to "Settings", "Asterisk SIP Settings", "Chan SIP Settings".
2. Go to "Connectivity" - "Trunks" and add a SIP trunk.
Specify the name of the trunk and go to the sip settings tab.
Enter the following information:
111111: Your sip number from the personal account
Password: Your sip number password from the "SIP Connection" section in your personal account.
Trunk Name: Zadarma
USER Context: 111111
Register String: 111111:password@sip.zadarma.com/111111
1234-100: Your PBX extension number from your personal account
Password: Your PBX extension number password from your personal account.
Trunk Name: Zadarma
USER Context: 1234-100
Register String: 1234-100:password@pbx.zadarma.com/1234-100
In PEER Details and USER Details enter the following data:
host=sip.zadarma.com insecure=invite,port type=friend fromdomain=sip.zadarma.com disallow=all allow=alaw&ulaw dtmfmode=auto secret=password defaultuser=111111 fromuser=111111 qualify=400 directmedia=no nat=force_rport,comedia
host=pbx.zadarma.com insecure=invite,port type=friend fromdomain=pbx.zadarma.com disallow=all allow=alaw&ulaw dtmfmode=auto secret=password defaultuser=1234-100 fromuser=1234-100 qualify=400 directmedia=no nat=force_rport,comedia
3. Go to "Connectivity" - "Inbound Routes" and create an inbound route.
Description Zadarma-in
DID Number: 111111
Description Zadarma-in
DID Number: 1234-100
You can set where the call will be routed to in the "Set Destination" section (it can be routed to a PBX extension number, a call group, an IVR, etc.)
4. Go to "Connectivity", "Outbound Routes" and create an outbound route Zadarma-out.
Route Name Zadarma-out
Route CID 111111
Trunk sequence for matched routes: Zadarma
Route Name Zadarma-out
Route CID 1234-100
Trunk sequence for matched routes: Zadarma
Go to "Dial Patterns that will use this Route", enter a full stop (.) in the blank space indicated as "match pattern". (As displayed by a red arrow in the screenshot below.) . If you skip this stage, you will not be able to make outgoing calls.