SIP incoming call CID/userID confusion

Hello Folks,

I’m trying to set up an Asterisk box (1.2.9.1 - old I know but I’m not the sysadmin so can’t change it) to accept calls from a SIP provider (VoipTalk in the UK, who generally are very good).

Their advice is to set up the incoming user as follows:

[056********]
type=friend
username=056********
context=thespace_in_production
nat=no

(note this works with their IAX connection… but I’m trying SIP for a change)

However, when I dial the number, the SIP debug output reveals it cannot find the user. Further investigation showed that if I configure the user like this:

[CIDOFMY*MOBILE]
type=friend
username=056********
context=thespace_in_production
nat=no

Then it can find the user and everything ‘works’. I can’t believe for a minute that this is entirely correct. Unless I’m really not understanding something.

So, has anyone else come across a similar problem where the CID and SIP userID appear to be swapped?

I have a support ticket in with the supplier to see if they know what’s wrong, but I imagine it’s my Asterisk configuration somehow. I’ve spent an afternoon on this so far with no luck. It’s annoying!

Here’s the debug output:

079******** is my mobile number (a.k.a. ‘the caller’)
056******** is my incoming VoIP number, the user ID.

[code]<-- SIP read from 77.240.48.141:5061:
INVITE sip:056********@holly.my.domain.co.uk SIP/2.0
Via: SIP/2.0/UDP 77.240.48.141:5061;branch=z9hG4bK08831f54;rport
From: “079********” sip:079********@77.240.48.141:5061;tag=as20f67cca
To: sip:056********@holly.my.domain.co.uk
Contact: sip:079********@77.240.48.141:5061
Call-ID: 054f19d25ff4b01a7797966334043b5a@77.240.48.141
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Max-Forwards: 70
Date: Tue, 03 Feb 2009 21:06:17 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Type: application/sdp
Content-Length: 547

v=0
o=root 4218 4218 IN IP4 77.240.48.141
s=session
c=IN IP4 77.240.48.141
t=0 0
m=audio 15680 RTP/AVP 8 0 3 97 7 110 5 10 18 112 111 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:7 LPC/8000
a=rtpmap:110 speex/8000
a=rtpmap:5 DVI4/8000
a=rtpmap:10 L16/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:112 AAL2-G726-32/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

— (14 headers 24 lines)—
Using INVITE request as basis request - 054f19d25ff4b01a7797966334043b5a@77.240.48.141
Sending to 77.240.48.141 : 5061 (NAT)
Found no matching peer or user for '77.240.48.141:5061’
Feb 3 21:06:17 NOTICE[10719]: chan_sip.c:10469 handle_request_invite: Failed to authenticate user “079********” sip:079********@77.240.48.141:5061;tag=as20f67cca
Reliably Transmitting (NAT) to 77.240.48.141:5061:
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 77.240.48.141:5061;branch=z9hG4bK08831f54;received=77.240.48.141;rport=5061
From: “079********” sip:079********@77.240.48.141:5061;tag=as20f67cca
To: sip:056********@holly.my.domain.co.uk;tag=as3b7266a4
Call-ID: 054f19d25ff4b01a7797966334043b5a@77.240.48.141
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Contact: sip:056********@87.237.59.48
Content-Length: 0

<-- SIP read from 77.240.48.141:5061:
ACK sip:056********@holly.my.domain.co.uk SIP/2.0
Via: SIP/2.0/UDP 77.240.48.141:5061;branch=z9hG4bK08831f54;rport
From: “079********” sip:079********@77.240.48.141:5061;tag=as20f67cca
To: sip:056********@holly.my.domain.co.uk;tag=as3b7266a4
Contact: sip:079********@77.240.48.141:5061
Call-ID: 054f19d25ff4b01a7797966334043b5a@77.240.48.141
CSeq: 102 ACK
User-Agent: Asterisk PBX
Max-Forwards: 70
Content-Length: 0

[/code]

I have been investigating further. If I enable guest calls (allowguest=yes) in sip.conf, as follows:

sip.conf:
[General]
allowguest=yes
context=in_guest

Then SIP calls successfully make it through to the 056******** part of the [in_guest] context in extensions.conf.

extensions.conf:
[in_guest]
exten => 056********,1,Answer()

I suppose this is a workaround, but I’m sure I should be able to define a user like I originally posted rather than using the guest call method.

Any ideas anyone?

This Asterisk server has the same issue with another SIP provider, so I conclude something is wrong with its config, or it’s working as expected and it’s a rather undocumented ‘feature’.

Either way I’ve decided it’s easier to use an IAX connection to/from the VoIP provider as that is working like I expect. Shame, as I don’t like letting things like this beat me…

Have you got a register line in the general section of the sip.conf ?

Ian

I registered for the outgoing trunk, which worked fine. (The guideline on the supplier’s website is here).

The incoming trunk (supplier’s details here) doesn’t seem to support registration so I never tried it.