[asterisk-users] [SOLVED] Re: Incoming calls to a GSM gateway & "SIP/2.0 401 Unauthorized" response when dial 7777 to Asterisk

Luis Eduardo Cortes luedcortes at gmail.com
Wed Nov 12 21:20:39 CST 2014

2014-11-12 2:45 GMT-02:00 Luis Eduardo Cortes <luedcortes at gmail.com>:
> Hello:
> I'm newbie in asterisk, please help me.
> My context is as follows:
> --> Asterisk 11.13.1 complied from source
> --> Yeastar NeoGate TG100 GSM gateway
> When I call from a GSM cell phone, my TG100 GSM gateway answers and
> dials extension 7777 (configured as a hotline on TG100) to asterisk
> server, but asterisk server sends me "SIP/2.0 401 Unauthorized"
> response, I think it's a matter of contexts but I don't find the
> problem.
> Attached are sip.conf, extensions.conf and debug from
> (TG100 GSM gateway).
> Thanks in advance.


I solved my issue by changing type=friend with type=peer in
[555555555] section, afterwards, googling I've found this article that
explain me why:


Re: type=friend is bad for you

Postby thor » Tue Aug 02, 2011 11:24 am
Another little known fact about the difference between peer and friend:
Friend will challenge INVITEs. When making outbound calls from a
registered phone/peer another challenge will be issued.

This means type=friend requires second INVITE with authentication
credentials, while peer will accept INVITE without challenge.

In other words type=friend does not care about the phone registration
status and always tries to authenticate as if the phone never

More information about the asterisk-users mailing list