401 Unauthorized on Invite

Hi,

I’m trying to set up an Asterisk SIP server to use with a Nortel Contact Center (CCMS), although I’m quite new to both.
In my sip.conf I have a user set up as the customer (201), one as the CCMS (3000) and one as the agent (200). The basic call flow is that the customer calls the CCMS, the CCMS determines an agent is available and creates the call to the agent before transferring the customer to that call.
Currently the call from the customer to the CCMS works perfectly. CCMS determines that the agent is available and so tries to create a call between it and the agent. At this point Asterisk returns a 401 Unauthorized message to the ‘invite’ and the whole thing fails.
I’ve tried including changing my sip.conf to include “insecure=invite” both in the users and [general] sections with no change. I’ve included my edits to the sip.conf and extension.conf below along with the ‘invite’ and ‘unauthorized’ SIP messages. If you need anything else let me know.

As extra info, I’m using the QuteCom SIP clients, the Asterisk and Contact Center are being host on Amazon’s EC2 virtual machines.

Thanks,
Barry

sip.conf:

[200]
user=200
type=friend
secret=200
host=dynamic
callerid = Joe
insecure=invite
context=sip-internal

[201]
user=201
type=friend
secret=201
host=dynamic
callerid = Bob
insecure=invite
context=sip-internal

[3000]
user=3000
type=friend
secret=3000
host=dynamic
transport=udp,tcp
insecure=invite
context=sip-internal

[ccuser1]
user=ccuser1
type=friend
secret=ccuser1
host=dynamic
transport=udp,tcp
insecure=invite
context=sip-internal

extensions.conf:

[sip-internal]
exten => 200,1,Dial(SIP/200,20,tr)
exten => 201,1,Dial(SIP/201,20,tr)
exten => 3000,1,Dial(SIP/3000,20,tr)

INVITE request from CCMS:

25/03/2009-15:40:07,039 [0x41358] - --> Message to Send (Dest Address IP: 75.101.131.175:5060):$$begin_record
Direction: outgoing
Start-Line: INVITE sip:200@10.248.243.16 SIP/2.0
From: sip:3000@10.248.90.96;tag=43a81418-605af80a-13c4-50022-39f7-52459528-39f7
To: sip:200@10.248.243.16
Call-ID: 44660f40-605af80a-13c4-50022-39f7-7a0982ea-39f7
CSeq: 1 INVITE
Via: SIP/2.0/UDP 10.248.90.96:5060;branch=z9hG4bK-39f7-e26d56-60e5f15a
Max-Forwards: 70
User-Agent: Nortel Contact Center Manager 7.0
Contact: sip:3000@10.248.90.96:5060
Content-Type: application/sdp
Content-Length: 395
v=0
o=NNMAS 1 241 IN IP4 10.249.103.15
s=-
e=unknown@invalid.net
c=IN IP4 10.249.103.15
t=0 0
m=audio 53528 RTP/AVP 0 8 18 96 97
c=IN IP4 10.249.103.15
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:96 telephone-event/8000
a=rtpmap:97 X-nt-inforeq/8000
a=ptime:20
a=sendrecv
m=video 0 RTP/AVP 34
c=IN IP4 10.249.103.15
a=inactive
$$end_record

401 Unauthorized response from Asterisk:

25/03/2009-15:40:07,055 [0x1858] - <-- Message Received (Sender Address IP: 10.248.243.16:5060):$$begin_record
Direction: incoming
Start-Line: SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.248.90.96:5060;branch=z9hG4bK-39f7-e26d56-60e5f15a;received=174.129.234.54
From: sip:3000@10.248.90.96;tag=43a81418-605af80a-13c4-50022-39f7-52459528-39f7
To: sip:200@10.248.243.16;tag=as1ba7d7c4
Call-ID: 44660f40-605af80a-13c4-50022-39f7-7a0982ea-39f7
CSeq: 1 INVITE
User-Agent: Asterisk PBX 1.6.0.5
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="66c69289"
Content-Length: 0

$$end_record

In sip.conf, in the ccuser1 definition, try change

host=dynamic

to

host=xxx.xxx.xxx.xxx

xxx.xxx.xxx.xxx is the ip address of the CCMS.

Cheers.

Marco Bruni
www.marcobruni.net

When I set the host=xxx.xxx.xxx.xxx, the CCMS tries to register with Asterisk but fails with a ‘Forbidden’ message. On the Asterisk console I get the error:

[Mar 26 10:41:28] ERROR[29527]: chan_sip.c:10593 register_verify: Peer ‘ccuser1’ is trying to register, but not configured as host=dynamic
[Mar 26 10:41:28] NOTICE[29527]: chan_sip.c:18390 handle_request_register: Registration from ‘sip:ccuser1@ec2-75-101-131-175.compute-1.amazonaws.com’ failed for ‘174.129.234.54’ - Peer is not supposed to register

After failing to register, the CCMS stops the services so I can’t even place the first call.

If the CCM has to register to Asterisk undo the change I suggested, also comment out the line

insecure=invite

for the CCM user, because if it’s able to register it should be able to authenticate on invite too.

What happens then if you call from the CCM to Asterisk, with the CCM registered and the above line commented ? Do you get a SIP 401 response code or a different one ?

Cheers.

Marco Bruni
www.marcobruni.net

It appears that CCMS cannot authenticate on invites even if it’s able to authenticate during registration.
Is it possible that Asterisk can work with this? I thought that was the goal of “insecure=invite”. As far as I’m aware, authentication of ‘invites’ is not required, even if it’s good practice in SIP. Thanks.