Asterisk bridging calls to Avaya


#1

Here is my scenario:
Asterisk is registered with Avaya’s Session Manager (over a SIP trunk).
I have X-Lite registered with Asterisk. I have an extension on Asterisk to bridge/forward the call over the trunk.

What happens is that the INVITE gets sent across over the trunk but received a 407 Proxy Authentication Required) response back and I don’t know how to process that information. I also know that for call termination (if call duration exceeds about 30 seconds, I will get back a 407 which needs to be handled.

Any help is appreciated. Please tell me what I am doing wrong.

Here are relevant sections of config files and logs:

;----------------------------------------- OUTBOUND SIP REGISTRATIONS ------------------------ 483 ; Asterisk can register as a SIP user agent to a SIP proxy (provider) 484 ; Format for the register statement is: 485 ; register => [peer?][transport://]user[@domain][:secret[]]@host[:port][/extension][~expiry] 486 ; 487 register => 51111@mydomain.net:51111:12345@X.X.X.X~3600

1019 ;start user profile fmg;
1020 [fmg]
1021 type=friend
1022 username=fmg
1023 secret=***
1024 host=dynamic
1025 context=murgency
1026 insecure=very
1027 fromuser=51111
1028 fromdomain=mydomain.net
1029 defaultuser=51111
1030 permit=X.X.X.X/255.255.255.0
1031 permit=Y.Y.Y.Y/255.255.255.0
1032 allow=ulaw
1033 allow=alaw
1034 canreinvite=yes
1035 qualify=no
1036 sendrpid=yes
1037 trustrpid=yes
1038 callingpres=allowed_passed_screen
1039 ;end user profile fmg;

This is relevant section of extension.conf

847 [murgency] 848 exten => fmg,1,Dial(SIP/1234567890@X.X.X.X)

This is Asterisk’s log:

<--- SIP read from UDP:Z.Z.Z.Z:55300 --->
INVITE sip:fmg@Y.Y.Y.Y:5060;transport=udp SIP/2.0
Via: SIP/2.0/UDP Z.Z.Z.Z:55300;branch=z9hG4bK-d8754z-f2d1049d15cdca7e-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:fmg@Z.Z.Z.Z:55300;transport=udp>
To: <sip:fmg@Y.Y.Y.Y:5060>
From: "fmg"<sip:fmg@Y.Y.Y.Y:5060>;tag=92a0210a
Call-ID: NjE5Y2UwYzVhNjM4NDA0NjNhZjllNDE5MTc3ZDE0NWQ.
CSeq: 1 INVITE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Content-Type: application/sdp
Supported: replaces
User-Agent: X-Lite 4 release 4.1 stamp 63214
Content-Length: 409

v=0
o=- 12963683430273234 1 IN IP4 Z.Z.Z.Z
s=CounterPath X-Lite 4.1
c=IN IP4 Z.Z.Z.Z
t=0 0
a=ice-ufrag:7480d8
a=ice-pwd:c8181f9e1e903339b29adaa30a45d4b9
m=audio 4902 RTP/AVP 107 0 8 101
a=rtpmap:107 BV32/16000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=candidate:1 1 UDP 659136 10.109.171.25 64438 typ host
a=candidate:1 2 UDP 659134 10.109.171.25 64439 typ host

<------------->
--- (13 headers 14 lines) ---
  == Using SIP RTP CoS mark 5
Sending to Z.Z.Z.Z : 55300 (no NAT)
Using INVITE request as basis request - NjE5Y2UwYzVhNjM4NDA0NjNhZjllNDE5MTc3ZDE0NWQ.
Found peer 'fmg' for 'fmg' from Z.Z.Z.Z:55300
Found RTP audio format 107
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 101
Found audio description format BV32 for ID 107
Found audio description format telephone-event for ID 101
Capabilities: us - 0x8000e (gsm|ulaw|alaw|h263), peer - audio=0xc (ulaw|alaw)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0xc (ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x1 (telephone-event), combined - 0x1 (telephone-event)
Peer audio RTP is at port Z.Z.Z.Z:4902
Looking for fmg in murgency (domain Y.Y.Y.Y)
list_route: hop: <sip:fmg@Z.Z.Z.Z:55300;transport=udp>

<--- Transmitting (no NAT) to Z.Z.Z.Z:55300 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP Z.Z.Z.Z:55300;branch=z9hG4bK-d8754z-f2d1049d15cdca7e-1---d8754z-;received=Z.Z.Z.Z;rport=55300
From: "fmg"<sip:fmg@Y.Y.Y.Y:5060>;tag=92a0210a
To: <sip:fmg@Y.Y.Y.Y:5060>
Call-ID: NjE5Y2UwYzVhNjM4NDA0NjNhZjllNDE5MTc3ZDE0NWQ.
CSeq: 1 INVITE
Server: Asterisk PBX 1.6.2.9-2ubuntu2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Contact: <sip:fmg@Y.Y.Y.Y>
Content-Length: 0


<------------>
    -- Executing [fmg@murgency:1] Dial("SIP/fmg-00000022", "SIP/3014052724@X.X.X.X") in new stack
  == Using SIP RTP CoS mark 5

<--- SIP read from UDP:Z.Z.Z.Z:55300 --->



<------------->
Really destroying SIP dialog 'MjBmMzM1YjA4NDI5NmFkZDNmYWI2M2RjNTRmZjdjMjI.' Method: REGISTER
Audio is at Y.Y.Y.Y port 19026
Adding codec 0x4 (ulaw) to SDP
Adding codec 0x2 (gsm) to SDP
Adding codec 0x8 (alaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to X.X.X.X:5060:
INVITE sip:3014052724@X.X.X.X SIP/2.0
Via: SIP/2.0/UDP Y.Y.Y.Y:5060;branch=z9hG4bK66db93ce;rport
Max-Forwards: 70
From: "fmg" <sip:fmg@Y.Y.Y.Y>;tag=as208f70ca
To: <sip:3014052724@X.X.X.X>
Contact: <sip:fmg@Y.Y.Y.Y>
Call-ID: 3ce8d4f355bd205739dae0c570de6f42@Y.Y.Y.Y
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.6.2.9-2ubuntu2
Date: Fri, 21 Oct 2011 15:10:40 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 290

v=0
o=root 211244117 211244117 IN IP4 Y.Y.Y.Y
s=Asterisk PBX 1.6.2.9-2ubuntu2
c=IN IP4 Y.Y.Y.Y
t=0 0
m=audio 19026 RTP/AVP 0 3 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

---
    -- Called 3014052724@X.X.X.X

<--- SIP read from UDP:X.X.X.X:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP Y.Y.Y.Y:5060;branch=z9hG4bK66db93ce;rport=5060;received=Y.Y.Y.Y
To: <sip:3014052724@X.X.X.X>
From: "fmg" <sip:fmg@Y.Y.Y.Y>;tag=as208f70ca
Call-ID: 3ce8d4f355bd205739dae0c570de6f42@Y.Y.Y.Y
CSeq: 102 INVITE
Server:  AVAYA-SM-6.1.4.0.614005
Content-Length: 0


<------------->
--- (8 headers 0 lines) ---

<--- SIP read from UDP:X.X.X.X:5060 --->
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP Y.Y.Y.Y:5060;branch=z9hG4bK66db93ce;rport=5060;received=Y.Y.Y.Y
To: <sip:3014052724@X.X.X.X>;tag=-1965581852*1*016asm-callprocessing.sar838925834~1319209843148~-1258744692~1
From: "fmg" <sip:fmg@Y.Y.Y.Y>;tag=as208f70ca
Call-ID: 3ce8d4f355bd205739dae0c570de6f42@Y.Y.Y.Y
CSeq: 102 INVITE
Record-Route: <sip:ba77603@X.X.X.X;transport=udp;lr>
Proxy-Authenticate: Digest realm="mydomain.net", qop="auth", opaque="1234567890abcedef", nonce="1332708b9cd756014c2e851e7ab324ddec7b51ba59e", algorithm=MD5, stale=false
Server:  AVAYA-SM-6.1.4.0.614005
Content-Length: 0


<------------->
--- (10 headers 0 lines) ---
Transmitting (no NAT) to X.X.X.X:5060:
ACK sip:3014052724@X.X.X.X SIP/2.0
Via: SIP/2.0/UDP Y.Y.Y.Y:5060;branch=z9hG4bK66db93ce;rport
Max-Forwards: 70
From: "fmg" <sip:fmg@Y.Y.Y.Y>;tag=as208f70ca
To: <sip:3014052724@X.X.X.X>;tag=-1965581852*1*016asm-callprocessing.sar838925834~1319209843148~-1258744692~1
Contact: <sip:fmg@Y.Y.Y.Y>
Call-ID: 3ce8d4f355bd205739dae0c570de6f42@Y.Y.Y.Y
CSeq: 102 ACK
User-Agent: Asterisk PBX 1.6.2.9-2ubuntu2
Content-Length: 0


---
[Oct 21 11:10:40] NOTICE[1118]: chan_sip.c:17853 handle_response_invite: Failed to authenticate on INVITE to '"fmg" <sip:fmg@Y.Y.Y.Y>;tag=as208f70ca'
    -- SIP/X.X.X.X-00000023 is circuit-busy
  == Everyone is busy/congested at this time (1:0/1/0)
    -- Auto fallthrough, channel 'SIP/fmg-00000022' status is 'CONGESTION'

<--- Reliably Transmitting (no NAT) to Z.Z.Z.Z:55300 --->
SIP/2.0 503 Service Unavailable
Via: SIP/2.0/UDP Z.Z.Z.Z:55300;branch=z9hG4bK-d8754z-f2d1049d15cdca7e-1---d8754z-;received=Z.Z.Z.Z;rport=55300
From: "fmg"<sip:fmg@Y.Y.Y.Y:5060>;tag=92a0210a
To: <sip:fmg@Y.Y.Y.Y:5060>;tag=as3431a35b
Call-ID: NjE5Y2UwYzVhNjM4NDA0NjNhZjllNDE5MTc3ZDE0NWQ.
CSeq: 1 INVITE
Server: Asterisk PBX 1.6.2.9-2ubuntu2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Length: 0
X-Asterisk-HangupCause: Call Rejected
X-Asterisk-HangupCauseCode: 21


<------------>

<--- SIP read from UDP:Z.Z.Z.Z:55300 --->
ACK sip:fmg@Y.Y.Y.Y:5060;transport=udp SIP/2.0
Via: SIP/2.0/UDP Z.Z.Z.Z:55300;branch=z9hG4bK-d8754z-f2d1049d15cdca7e-1---d8754z-;rport
Max-Forwards: 70
To: <sip:fmg@Y.Y.Y.Y:5060>;tag=as3431a35b
From: "fmg"<sip:fmg@Y.Y.Y.Y:5060>;tag=92a0210a
Call-ID: NjE5Y2UwYzVhNjM4NDA0NjNhZjllNDE5MTc3ZDE0NWQ.
CSeq: 1 ACK
Content-Length: 0


<------------->
--- (8 headers 0 lines) ---
Really destroying SIP dialog 'NjE5Y2UwYzVhNjM4NDA0NjNhZjllNDE5MTc3ZDE0NWQ.' Method: ACK
Really destroying SIP dialog '3ce8d4f355bd205739dae0c570de6f42@Y.Y.Y.Y' Method: INVITE

#2

848 exten => fmg,1,Dial(SIP/1234567890@X.X.X.X)

That will only use global information from sip.conf, although there are global proxy authentication options.

You probably wanted SIP/frmg/1234567890 although I’m not 100% sure that Asterisk will use secret’s for both proxy and UA authentication.


#3

Hi, I tried setting the outbound proxy as well, but I still see the same behavior. Same goes for the exten too.

How do I get Asterisk to respond to the 407 with another INVITE with proper authentication details. Same for BYE too.

Thanks,
Raghu


#4

It is not clear to me that you have fixed your anonymous peer, but this is what is documented in the sample sip.conf, which you need to read before configuring a live 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=mark:topsecret@digium.com
;
; You may also add auth= statements to [peer] definitions
; Peer auth= override all other authentication settings if we match on realm