Question

I'm developing a SIP user agent application that connects to an Asterisk server and tries to do an outgoing call. I'm using the NIST implementation of the JAIN SIP API.

The application first registers itself successfully. Then, when the application transmits an INVITE request to an X-Lite SIP soft phone, Asterisk responds with a 407 (Proxy Authentication Required) response. The response contains a Proxy-Authenticate header. My application sends an INVITE again, but this time with the Proxy-Authorization header, upon which Asterisk responds with 488 (Not acceptable here).

Here follows the SIP conversation ('>>' indicates outgoing messages; '<<' indicates incoming messages):

>> REGISTER sip:10.0.84.30:5060 SIP/2.0
Call-ID: 7f2d15884ab375fc7b5d32fdd28426d5@10.0.85.3
CSeq: 1 REGISTER
From: <sip:301@asterisk>;tag=0vmZig
To: <sip:301@asterisk>
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bK493cd4b63090dc9a8027931937b737c9353835 Max-Forwards: 70
Contact: <sip:10.0.85.3:5060>
Expires: 300
Content-Length: 0

<< SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bK493cd4b63090dc9a8027931937b737c9353835;received=10.0.85.3
From: <sip:301@asterisk>;tag=0vmZig
To: <sip:301@asterisk>
Call-ID: 7f2d15884ab375fc7b5d32fdd28426d5@10.0.85.3
CSeq: 1 REGISTER
User-Agent: Asterisk PBX (switchvox)
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY
Contact: <sip:301@10.0.84.30>
Content-Length: 0

<< SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bK493cd4b63090dc9a8027931937b737c9353835;received=10.0.85.3
From: <sip:301@asterisk>;tag=0vmZig
To: <sip:301@asterisk>;tag=as4d134cc6
Call-ID: 7f2d15884ab375fc7b5d32fdd28426d5@10.0.85.3
CSeq: 1 REGISTER
User-Agent: Asterisk PBX (switchvox)
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY
Contact: <sip:301@10.0.84.30>
WWW-Authenticate: Digest realm="asterisk",nonce="27ca4a51"
Content-Length:0

>> REGISTER sip:10.0.84.30:5060 SIP/2.0
CSeq: 2 REGISTER
From: <sip:301@asterisk>;tag=0vmZig
To: <sip:301@asterisk>
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bKe339b4ed9edc5d75379673b6dec7fc42353835 Max-Forwards: 70
Contact: <sip:10.0.85.3:5060>
Expires: 300
Authorization: Digest username="301",realm="asterisk",nonce="27ca4a51",response="cfdcdff7ddee99d10c3099e88ffb73af",algorithm=MD5,uri="sip:10.0.84.30:5060",nc=00000001
Call-ID: 7f2d15884ab375fc7b5d32fdd28426d5@10.0.85.3
Content-Length: 0

<< SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bKe339b4ed9edc5d75379673b6dec7fc42353835;received=10.0.85.3
From: <sip:301@asterisk>;tag=0vmZig
To: <sip:301@asterisk>
Call-ID: 7f2d15884ab375fc7b5d32fdd28426d5@10.0.85.3
CSeq: 2 REGISTER
User-Agent: Asterisk PBX (switchvox)
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY
Contact: <sip:301@10.0.84.30>
Content-Length: 0

<< SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bKe339b4ed9edc5d75379673b6dec7fc42353835;received=10.0.85.3
From: <sip:301@asterisk>;tag=0vmZig
To: <sip:301@asterisk>;tag=as4d134cc6
Call-ID: 7f2d15884ab375fc7b5d32fdd28426d5@10.0.85.3
CSeq: 2 REGISTER
User-Agent: Asterisk PBX (switchvox)
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY
Expires: 300
Contact: <sip:10.0.85.3:5060>;expires=300
Date: Tue, 03 May 2011 09:37:45 GMT
Content-Length: 0

>> INVITE sip:302@asterisk SIP/2.0
Call-ID: 003d85b0d0868f6f2a2d8c324d7f1d54@10.0.85.3
CSeq: 3 INVITE
From: <sip:301@asterisk>;tag=sJSeLA
To: <sip:302@asterisk>
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bK6704cd9554c0c8e5bc94bc42b606147a353835 Max-Forwards: 70
Contact: <sip:10.0.85.3:5060>
Route: <sip:10.0.84.30:5060;lr>
Content-Type: application/sdp
Content-Length: 106

v=0
o=- 3513403599 3513403599 IN IP4 10.0.85.3
s=-
c=IN IP4 10.0.85.3
t=0 0
m=audio 40000 RTP/AVP 3

<< SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bK6704cd9554c0c8e5bc94bc42b606147a353835;received=10.0.85.3
From: <sip:301@asterisk>;tag=sJSeLA
To: <sip:302@asterisk>;tag=as7358e1b8
Call-ID: 003d85b0d0868f6f2a2d8c324d7f1d54@10.0.85.3
CSeq: 3 INVITE
User-Agent: Asterisk PBX (switchvox)
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY
Contact: <sip:302@10.0.84.30>
Proxy-Authenticate: Digest realm="asterisk",nonce="55deefb6"
Content-Length: 0

>> INVITE sip:302@asterisk SIP/2.0
CSeq: 4 INVITE
From: <sip:301@asterisk>;tag=sJSeLA
To: <sip:302@asterisk>
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bK6e3501c0973664fcd7a17affddd23572353835 Max-Forwards: 70
Contact: <sip:10.0.85.3:5060>
Route: <sip:10.0.84.30:5060;lr>
Content-Type: application/sdp
Proxy-Authorization: Digest username="301",realm="asterisk",nonce="55deefb6",response="47e2c7abe625e4a183726e29c035d7e0",algorithm=MD5,uri="sip:302@asterisk",nc=00000001
Call-ID: 003d85b0d0868f6f2a2d8c324d7f1d54@10.0.85.3
Content-Length: 106

v=0
o=- 3513403599 3513403599 IN IP4 10.0.85.3
s=-
c=IN IP4 10.0.85.3
t=0 0
m=audio 40000 RTP/AVP 3

<< SIP/2.0 488 Not acceptable here
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bK6e3501c0973664fcd7a17affddd23572353835;received=10.0.85.3
From: <sip:301@asterisk>;tag=sJSeLA
To: <sip:302@asterisk>;tag=as7358e1b8
Call-ID: 003d85b0d0868f6f2a2d8c324d7f1d54@10.0.85.3
CSeq: 4 INVITE
User-Agent: Asterisk PBX (switchvox)
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY
Contact: <sip:302@10.0.84.30>
Content-Length: 0

What am I doing wrong here, causing the 488 response?

Was it helpful?

Solution

The 488 response is almost certainly because of a codec mismatch between your SIP client and your Asterisk server. In your SIP trace your client is requesting the call use the GSM codec and my guess is your Asterisk server is configured to not allow GSM.

Either re-configure your Asterisk server to accept GSM or try changing your SDP to use ULAW or ALAW as it's pretty rare for Asterisk to be configured not to accept those.

In the below sample not the change to the end of the m= line. 0 corresponds to PCMU (ULAW) and 8 corresponds to PCMA (ALAW).

v=0
o=- 3513403599 3513403599 IN IP4 10.0.85.3
s=-
c=IN IP4 10.0.85.3
t=0 0
m=audio 40000 RTP/AVP 0 8
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top