[solved] Asterisk as SIP UA / issues with outgoing calls

Hi guys,

I’m newbie in Asterisk. I hope my question was not answered 100times already here :wink: At least I was not able to find a solution.

I’m running Asterisk 1.4.25 at home and trying to manage several SIP connections I have to different providers. Incoming calls are working fine however I have problem with authentication for outgoing calls. I’m trying to make my * running as SIP UA.

Here is part of my log with errors:

home*CLI> dial 73111@outgoing_calls

Audio is at 192.168.x.x port 10792
Adding codec 0x4 (ulaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 195.138.80.54:5060:
INVITE sip:73111@sip.tenet.ua SIP/2.0
Via: SIP/2.0/UDP 192.168.x.x:5060;branch=z9hG4bK3f883a2e;rport
From: “asterisk” sip:99001@sip.tenet.ua;tag=as0245901b
To: sip:73111@sip.tenet.ua
Contact: sip:99001@192.168.x.x
Call-ID: 4a09245360f7b80d01d6c0961bfc9dbe@sip.tenet.ua
CSeq: 102 INVITE
User-Agent: Sipura/SPA2000-2.0.9(d)
Max-Forwards: 70
Date: Mon, 01 Jun 2009 18:57:40 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Type: application/sdp
Content-Length: 240

v=0
o=root 19855 19855 IN IP4 192.168.x.x
s=session
c=IN IP4 192.168.x.x
t=0 0
m=audio 10792 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv


home*CLI>
<— SIP read from 195.138.80.54:5060 —>
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 192.168.x.x:5060;branch=z9hG4bK3f883a2e;received=84.42.x.x;rport=4368
From: “asterisk” sip:99001@sip.tenet.ua;tag=as0245901b
To: sip:73111@sip.tenet.ua;tag=as5a5c8af6
Call-ID: 4a09245360f7b80d01d6c0961bfc9dbe@sip.tenet.ua
CSeq: 102 INVITE
User-Agent: TeNeTSIP
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Proxy-Authenticate: Digest algorithm=MD5, realm=“sip.tenet.ua”, nonce="00c9676d"
Content-Length: 0

<------------->
— (11 headers 0 lines) —
Transmitting (NAT) to 195.138.80.54:5060:
ACK sip:73111@sip.tenet.ua SIP/2.0
Via: SIP/2.0/UDP 192.168.x.x:5060;branch=z9hG4bK3f883a2e;rport
From: “asterisk” sip:99001@sip.tenet.ua;tag=as0245901b
To: sip:73111@sip.tenet.ua;tag=as5a5c8af6
Contact: sip:99001@192.168.x.x
Call-ID: 4a09245360f7b80d01d6c0961bfc9dbe@sip.tenet.ua
CSeq: 102 ACK
User-Agent: Sipura/SPA2000-2.0.9(d)
Max-Forwards: 70
Content-Length: 0


[Jun 1 20:57:40] NOTICE[19860]: chan_sip.c:12640 handle_response_invite: Failed to authenticate on INVITE to ‘“asterisk” sip:99001@sip.tenet.ua;tag=as0245901b’

and the config:

[general]
useragent = Sipura/SPA2000-2.0.9(d)
context=default
register => 99001:XXX@sip.tenet.ua

[tenet]
nat=yes
type=peer
host=sip.tenet.ua
fromuser=99001
fromdomain=sip.tenet.ua
secret=x
context=outgoing_calls
dtmfmode=rfc2833
disallow=all
allow=ulaw
outboundproxy=sip.tenet.ua
insecure=port,invite

[outgoing_calls]
exten => _X.,1,NoOp()
exten => _X.,n,Dial(SIP/${EXTEN}@tenet|60|r)

If I understand this issue right I have somehow force Asterisk/SIP UA to make registration with remote server even before placing outgoing call.

register => 99001:XXX@sip.tenet.ua makes incoming calls working, how can I do something similar with outgoing calls?

Thanks.
Eugene.

I solved the issue. Here is the solution (added to sip.conf):

[authentication]
; Global credentials for outbound calls, i.e. when a proxy challenges your
; Asterisk server for authentication. These credentials override
; any credentials in peer/register definition if realm is matched.
;
; This way, Asterisk can authenticate for outbound calls to other
; realms. We match realm on the proxy challenge and pick an set of
; credentials from this list
; Syntax:
; auth = :@
; auth = #@
; Example:
auth=99001:x@sip.tenet.ua