401 Unathorized

hey guys, I’m new to asterisk and forum as well. I have a problem I’m trying to salve already for 2 days. I started everything from scrap, didn’t even had idea how linuxed worked, kinda figured some things out. installed freepbx asterisk on raspberry pi 3, registered SIP trunk from voip provider, registered extensions. extensions work fine between each other, but when i try to make calls out, or recive them i just get call drop, call doesn’t go through, not even buzzer. So i tried
Sip set debug on, and I see call that i placed from somewhere else to my Voip number it comes to server but than 401 unauthorised and gets destroyed. kinda stuck with the situation, any help would be appriciated.

I’d suggest providing the console log with SIP debug and configuration minus passwords. This is a common thing that people do so it’s just likely you have a configuration issue.

<— SIP read from UDP:212.58.96.188:5060 —>
INVITE sip:s@192.168.17.200:5060 SIP/2.0
Via: SIP/2.0/UDP 212.58.96.188:5060;branch=z9hG4bK+dcc969352c1da4fba8ab3a9eaece355c1+sip+1+ac0731eb
From: sip:‘NUMBERIMCALLINGFROM’@pbx.telenet.ge:5060;tag=pbx.telenet.ge+1+fcb7d956+a84db7af
To: sip:s@192.168.17.200:5060
CSeq: 1 INVITE
Expires: 70
Content-Length: 344
Call-Info: sip:212.58.96.188:5060;method="NOTIFY;Event=telephone-event;Duration=2000"
Supported: replaces,unknown, 100rel
Contact: sip:212.58.96.188:5060
Content-Type: application/sdp
Call-ID: fd8367838e8b5df3fdb585c0e74ea01f@pbx.telenet.ge
Max-Forwards: 69
Allow: INVITE,ACK,BYE,CANCEL,OPTIONS,REGISTER,INFO,PRACK,SUBSCRIBE,NOTIFY,REFER,UPDATE
Accept: application/sdp, application/dtmf-relay

v=0
o=- 85307610151067 85307610151067 IN IP4 212.58.96.190
s=-
c=IN IP4 212.58.96.190
t=0 0
m=audio 17608 RTP/AVP 8 18 116
a=rtpmap:8 PCMA/8000/1
a=rtpmap:18 G729/8000/1
a=rtpmap:116 telephone-event/8000
a=curr:qos local none
a=curr:qos remote none
a=des:qos mandatory local sendrecv
a=des:qos optional remote sendrecv
a=ptime:20
<------------->
— (15 headers 14 lines) —
Sending to 212.58.96.188:5060 (no NAT)
Sending to 212.58.96.188:5060 (no NAT)
Using INVITE request as basis request - fd8367838e8b5df3fdb585c0e74ea01f@pbx.telenet.ge
Found peer ‘MAGTI_27’ for ‘NUMBERIMCALLINGFROM’ from 212.58.96.188:5060

<— Reliably Transmitting (no NAT) to 212.58.96.188:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 212.58.96.188:5060;branch=z9hG4bK+dcc969352c1da4fba8ab3a9eaece355c1+sip+1+ac0731eb;received=212.58.96.188
From: sip:NUMBERIMCALLINGFROM@pbx.telenet.ge:5060;tag=pbx.telenet.ge+1+fcb7d956+a84db7af
To: sip:s@192.168.17.200:5060;tag=as32169a2e
Call-ID: fd8367838e8b5df3fdb585c0e74ea01f@pbx.telenet.ge
CSeq: 1 INVITE
Server: FPBX-13.0.190.11(13.13.1)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="2746a037"
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘fd8367838e8b5df3fdb585c0e74ea01f@pbx.telenet.ge’ in 32000 ms (Method: INVITE)

<— SIP read from UDP:212.58.96.188:5060 —>
ACK sip:s@192.168.17.200:5060 SIP/2.0
Via: SIP/2.0/UDP 212.58.96.188:5060;branch=z9hG4bK+dcc969352c1da4fba8ab3a9eaece355c1+sip+1+ac0731eb
From: sip:NUMBERIMCALLINGFROM@pbx.telenet.ge:5060;tag=pbx.telenet.ge+1+fcb7d956+a84db7af
To: sip:s@192.168.17.200:5060;tag=as32169a2e
CSeq: 1 ACK
Content-Length: 0
Call-ID: fd8367838e8b5df3fdb585c0e74ea01f@pbx.telenet.ge
Max-Forwards: 69

<------------->
— (8 headers 0 lines) —
Reliably Transmitting (no NAT) to 192.168.17.101:5060:
OPTIONS sip:114@192.168.17.101:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.17.200:5060;branch=z9hG4bK1eab1049
Max-Forwards: 70
From: “Unknown” sip:Unknown@192.168.17.200;tag=as0ec09d32
To: sip:114@192.168.17.101:5060
Contact: sip:Unknown@192.168.17.200:5060
Call-ID: 165f83890ca6e44e14ed4af9641ab4ae@192.168.17.200:5060
CSeq: 102 OPTIONS
User-Agent: FPBX-13.0.190.11(13.13.1)
Date: Wed, 01 Mar 2017 11:57:14 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<— SIP read from UDP:192.168.17.101:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.17.200:5060;branch=z9hG4bK1eab1049
From: “Unknown” sip:Unknown@192.168.17.200;tag=as0ec09d32
To: sip:114@192.168.17.101:5060;tag=588427047
Call-ID: 165f83890ca6e44e14ed4af9641ab4ae@192.168.17.200:5060
CSeq: 102 OPTIONS
Supported: replaces, path, timer
User-Agent: Grandstream GXP1160 1.0.6.11
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Length: 0

<------------->
— (10 headers 0 lines) —
Really destroying SIP dialog ‘165f83890ca6e44e14ed4af9641ab4ae@192.168.17.200:5060’ Method: OPTIONS
Reliably Transmitting (no NAT) to 192.168.17.103:5060:
OPTIONS sip:102@192.168.17.103:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.17.200:5060;branch=z9hG4bK6256627e
Max-Forwards: 70
From: “Unknown” sip:Unknown@192.168.17.200;tag=as60bdce5c
To: sip:102@192.168.17.103:5060
Contact: sip:Unknown@192.168.17.200:5060
Call-ID: 0c6879e44ff7b75c3f70baab7e384af9@192.168.17.200:5060
CSeq: 102 OPTIONS
User-Agent: FPBX-13.0.190.11(13.13.1)
Date: Wed, 01 Mar 2017 11:57:14 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<— SIP read from UDP:192.168.17.103:5060 —>
SIP/2.0 200 OK
To: sip:102@192.168.17.103:5060;tag=439ef074fcb3e945i0
From: “Unknown” sip:Unknown@192.168.17.200;tag=as60bdce5c
Call-ID: 0c6879e44ff7b75c3f70baab7e384af9@192.168.17.200:5060
CSeq: 102 OPTIONS
Via: SIP/2.0/UDP 192.168.17.200:5060;branch=z9hG4bK6256627e
Server: Cisco/SPA303-7.5.2
Content-Length: 0
Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER, UPDATE
Supported: replaces

<------------->
— (10 headers 0 lines) —
Really destroying SIP dialog ‘0c6879e44ff7b75c3f70baab7e384af9@192.168.17.200:5060’ Method: OPTIONS

[115]
deny=0.0.0.0/0.0.0.0
secret=XXXXXXXXXXXX
dtmfmode=rfc2833
canreinvite=no
context=from-internal
host=dynamic
defaultuser=
trustrpid=yes
sendrpid=no
type=friend
session-timers=accept
nat=no
port=5060
qualify=yes
qualifyfreq=60
transport=udp
avpf=no
force_avp=no
icesupport=no
encryption=no
namedcallgroup=
namedpickupgroup=
dial=SIP/115
permit=0.0.0.0/0.0.0.0
callerid=Eka <115>
callcounter=yes
faxdetect=no

[MAGTI_27]
host=212.58.96.188
username=ZZZZZZZZ
secret=YYYYYYYYYYY
type=peer
context=from-trunk-sip-MAGTI_27

example of 1 extensions + sip trunk config

You are challenging the ‘MAGTI_27’ peer for authentication and it is not doing so. If you configure “insecure=invite” on the peer it should not require authentication and calls will be accepted.

where do i put that? i’m kinda messed up with gui + doing some random stuff from ssh. should i put it in sip_custom.conf?

I don’t use FreePBX and don’t know where it would go to ensure it is applied. Generally you don’t want to use both when FreePBX is in use, you should make changes from the GUI if you can.

I F***ng love you man. inbound calls fixed. Gonna check outbound as well.

Outbound you would probably need a “fromuser=ZZZZZZZZ” section where ZZZZZZZZ is your username. Just guessing on that.