Just bought first hardware phone. Problems dialing IPs

I’ve just bought a Seimens DP450 . My first hardware IP phone. Before this I used Ekiga running on my laptop with a USB phone.

So far it works pretty good - I can make and take calls via my voip provider with no problem. I have asterisk set up as both registrar and as outbound proxy. Pretty much identical to how I have Ekiga set up. I want everything to go through asterisk.

The problem comes when I try to dial an IP address. I get a 404 error on the phone and the only thing that shows in terminal running asterisk -vvvvvgc is:

== Using SIP RTP CoS mark 5

and that’s it. It seems to ignore my dialplans (I have just 2 = incoming and external). I even put a ‘exten => _.,1,NoOp()’ in both to see if I could get some output but even that is ignored.

So the question is why is it doing this and what can I do to solve it?

This is my external diaplan with some bits trimmed:

[code]exten => _Z.,1,NoCDR()
exten => _Z.,n,GoToIf($["${SIPDOMAIN}" != “blacksun”]?external)
exten => _Z.,n,Dial(SIP/${EXTEN})
exten => _Z.,n,Hangup()
exten => _Z.,n(external),AGI(call-log.agi)
exten => _Z.,n,Dial(SIP/${EXTEN}@${SIPDOMAIN})
exten => _Z.,n,Hangup()

exten => _[a-z].,1,NoCDR()
exten => _[a-z].,n,GoToIf($["${SIPDOMAIN}" != “blacksun”]?external)
exten => _[a-z].,n,Hangup()
exten => _[a-z].,n(external),AGI(call-log.agi)
exten => _[a-z].,n,Dial(SIP/${EXTEN}@${SIPDOMAIN})
exten => _[a-z].,n,Hangup()

exten => _[A-Z].,1,NoCDR()
exten => _[A-Z].,n,GoToIf($["${SIPDOMAIN}" != “blacksun”]?external)
exten => _[A-Z].,n,Hangup()
exten => _[A-Z].,n(external),AGI(call-log.agi)
exten => _[A-Z].,n,Dial(SIP/${EXTEN}@${SIPDOMAIN})
exten => _[A-Z].,n,Hangup()
[/code]

And context is set to external in sip.conf section for the phone. blacksun is the domain name for the box running asterisk.

Someone I know suggested using nc/tcdump or similar and trying to connect to it. This is the output of nc when I try to call 192.168.1.3 relaying through 192.168.1.2:

[code]18:49:11(/etc/asterisk)# nc -v -l -u -p 5060
listening on [any] 5060 …
192.168.1.4: inverse host lookup failed: Unknown host
connect to [192.168.1.2] from (UNKNOWN) [192.168.1.4] 5060
INVITE sip:192.168.1.3:5060;user=phone SIP/2.0
Via: SIP/2.0/UDP 192.168.1.4:5060;branch=z9hG4bK69e4f550db870e88576b7bb0180aca9;rport
From: sip:192.168.1.4:5060;tag=118961641
To: sip:192.168.1.3:5060;user=phone
Call-ID: 1402447703@192_168_1_4
CSeq: 2 INVITE
Contact: sip:dec450@192.168.1.4:5060
Max-Forwards: 70
User-Agent: DP450/022270000000
Supported: replaces
Allow-Events: message-summary, refer
Allow: INVITE, ACK, CANCEL, BYE, OPTIONS, INFO, REFER, SUBSCRIBE, NOTIFY
Content-Type: application/sdp
Content-Length: 326

v=0
o=dec450 10016 12 IN IP4 192.168.1.4
s=Mapping
c=IN IP4 192.168.1.4
t=0 0
m=audio 10016 RTP/AVP 0 8 96 97 2 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:96 G726-32/8000
a=rtpmap:97 AAL2-G726-32/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
INVITE sip:192.168.1.3:5060;user=phone SIP/2.0
Via: SIP/2.0/UDP 192.168.1.4:5060;branch=z9hG4bK69e4f550db870e88576b7bb0180aca9;rport
From: sip:192.168.1.4:5060;tag=118961641
To: sip:192.168.1.3:5060;user=phone
Call-ID: 1402447703@192_168_1_4
CSeq: 2 INVITE
Contact: sip:dec450@192.168.1.4:5060
Max-Forwards: 70
User-Agent: DP450/022270000000
Supported: replaces
Allow-Events: message-summary, refer
Allow: INVITE, ACK, CANCEL, BYE, OPTIONS, INFO, REFER, SUBSCRIBE, NOTIFY
Content-Type: application/sdp
Content-Length: 326[/code]

Use sip set debug on

In any case, knowing what the phone send is of limited use without the contents of your sip.conf.

This is the output of sip debug on (or what seems to be the relevant bits):

[code]<— SIP read from UDP:192.168.1.4:5060 —>
INVITE sip:192.168.1.3:5060;user=phone SIP/2.0
Via: SIP/2.0/UDP 192.168.1.4:5060;branch=z9hG4bK39db3614883f5a73475278f8cb6b340d;rport
From: sip:192.168.1.4:5060;tag=4060958407
To: sip:192.168.1.3:5060;user=phone
Call-ID: 1187424136@192_168_1_4
CSeq: 2 INVITE
Contact: sip:dec450@192.168.1.4:5060
Max-Forwards: 70
User-Agent: DP450/022270000000
Supported: replaces
Allow-Events: message-summary, refer
Allow: INVITE, ACK, CANCEL, BYE, OPTIONS, INFO, REFER, SUBSCRIBE, NOTIFY
Content-Type: application/sdp
Content-Length: 326

v=0
o=dec450 10016 15 IN IP4 192.168.1.4
s=Mapping
c=IN IP4 192.168.1.4
t=0 0
m=audio 10016 RTP/AVP 0 8 96 97 2 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:96 G726-32/8000
a=rtpmap:97 AAL2-G726-32/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
<------------->

— (14 headers 14 lines) —
Sending to 192.168.1.4:5060 (NAT)
Using INVITE request as basis request - 1187424136@192_168_1_4
Found peer ‘dec450’ for ‘192.168.1.4:5060’ from 192.168.1.4:5060

<— Reliably Transmitting (NAT) to 192.168.1.4:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.1.4:5060;branch=z9hG4bK39db3614883f5a73475278f8cb6b340d;received=192.168.1.4;rport=5060
From: sip:192.168.1.4:5060;tag=4060958407
To: sip:192.168.1.3:5060;user=phone;tag=as47d68a60
Call-ID: 1187424136@192_168_1_4
CSeq: 2 INVITE
Server: Asterisk PBX 1.8.3.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="6ededb54"
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘1187424136@192_168_1_4’ in 7232 ms (Method: INVITE)

<— SIP read from UDP:192.168.1.4:5060 —>
ACK sip:192.168.1.3:5060;user=phone SIP/2.0
Via: SIP/2.0/UDP 192.168.1.4:5060;branch=z9hG4bK39db3614883f5a73475278f8cb6b340d;rport
From: sip:192.168.1.4:5060;tag=4060958407
To: sip:192.168.1.3:5060;user=phone;tag=as47d68a60
Call-ID: 1187424136@192_168_1_4
CSeq: 2 ACK
Contact: sip:dec450@192.168.1.4:5060
Max-Forwards: 70
User-Agent: DP450/022270000000
Content-Length: 0

<------------->
— (10 headers 0 lines) —

<— SIP read from UDP:192.168.1.4:5060 —>
INVITE sip:192.168.1.3:5060;user=phone SIP/2.0
Via: SIP/2.0/UDP 192.168.1.4:5060;branch=z9hG4bK81b51973fe5d7bb9d4d49c896288ffd4;rport
From: sip:192.168.1.4:5060;tag=4060958407
To: sip:192.168.1.3:5060;user=phone
Call-ID: 1187424136@192_168_1_4
CSeq: 3 INVITE
Contact: sip:dec450@192.168.1.4:5060
Authorization: Digest username=“dec450”, realm=“asterisk”, algorithm=MD5, uri=“sip:192.168.1.3:5060;user=phone”, nonce=“6ededb54”, response="b2e421fcbe26037666561995087a034e"
Max-Forwards: 70
User-Agent: DP450/022270000000
Supported: replaces
Allow-Events: message-summary, refer
Allow: INVITE, ACK, CANCEL, BYE, OPTIONS, INFO, REFER, SUBSCRIBE, NOTIFY
Content-Type: application/sdp
Content-Length: 326

v=0
o=dec450 10016 15 IN IP4 192.168.1.4
s=Mapping
c=IN IP4 192.168.1.4
t=0 0
m=audio 10016 RTP/AVP 0 8 96 97 2 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:96 G726-32/8000
a=rtpmap:97 AAL2-G726-32/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
<------------->
— (15 headers 14 lines) —
Sending to 192.168.1.4:5060 (NAT)
Using INVITE request as basis request - 1187424136@192_168_1_4
Found peer ‘dec450’ for ‘192.168.1.4:5060’ from 192.168.1.4:5060
== Using SIP RTP CoS mark 5
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 96
Found RTP audio format 97
Found RTP audio format 2
Found RTP audio format 18
Found RTP audio format 101
Found audio description format PCMU for ID 0
Found audio description format PCMA for ID 8
Found audio description format G726-32 for ID 96
Found audio description format AAL2-G726-32 for ID 97
Found audio description format G726-32 for ID 2
Found audio description format G729 for ID 18
Found audio description format telephone-event for ID 101
Capabilities: us - 0x80000008000e (gsm|ulaw|alaw|h263|testlaw), peer - audio=0x91c (ulaw|alaw|g726|g729|g726aal2)/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 192.168.1.4:10016
Peer doesn’t provide video
Peer doesn’t provide T.140
Looking for in external (domain 192.168.1.3:5060)

<— Reliably Transmitting (NAT) to 192.168.1.4:5060 —>
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.1.4:5060;branch=z9hG4bK81b51973fe5d7bb9d4d49c896288ffd4;received=192.168.1.4;rport=5060
From: sip:192.168.1.4:5060;tag=4060958407
To: sip:192.168.1.3:5060;user=phone;tag=as47d68a60
Call-ID: 1187424136@192_168_1_4
CSeq: 3 INVITE
Server: Asterisk PBX 1.8.3.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0

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

<------------>
Scheduling destruction of SIP dialog ‘1187424136@192_168_1_4’ in 7232 ms (Method: INVITE)
Retransmitting #1 (NAT) to 192.168.1.4:5060:
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.1.4:5060;branch=z9hG4bK81b51973fe5d7bb9d4d49c896288ffd4;received=192.168.1.4;rport=5060
From: sip:192.168.1.4:5060;tag=4060958407
To: sip:192.168.1.3:5060;user=phone;tag=as47d68a60
Call-ID: 1187424136@192_168_1_4
CSeq: 3 INVITE
Server: Asterisk PBX 1.8.3.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


<— SIP read from UDP:192.168.1.4:5060 —>
ACK sip:192.168.1.3:5060;user=phone SIP/2.0
Via: SIP/2.0/UDP 192.168.1.4:5060;branch=z9hG4bK81b51973fe5d7bb9d4d49c896288ffd4;rport
From: sip:192.168.1.4:5060;tag=4060958407
To: sip:192.168.1.3:5060;user=phone;tag=as47d68a60
Call-ID: 1187424136@192_168_1_4
CSeq: 3 ACK
Contact: sip:dec450@192.168.1.4:5060
Authorization: Digest username=“dec450”, realm=“asterisk”, algorithm=MD5, uri=“sip:192.168.1.3:5060;user=phone”, nonce=“6ededb54”, response="b2e421fcbe26037666561995087a034e"
Max-Forwards: 70
User-Agent: DP450/022270000000
Content-Length: 0

<------------->[/code]

and sip.conf:

[general]
alwaysauthreject=yes
canreinvite=yes
context=incoming
dtmfmode=auto
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=yes
limitonpeers=yes
videosupport=yes
textsupport=yes
callevents=yes
notifyringing=yes
notifyhold=yes
register => 
defaultuser=dave
fromuser=dave
call-limit=100
allowsubscribe=yes
nat=yes
localnet=192.168.1.0/255.255.255.0
externhost=xxxxxxxxxxx.net
mailbox=dave

; LAPTOP RUNNING EKIGA on 192.168.1.3
[davejunius]                                       
type=friend
secret=
qualify=yes
canreinvite=yes
host=dynamic
context=external
defaultuser=dave
callerid=dave@XXXXXXXXX.net <dave>
call-limit=100
callcounter=yes
limitonpeers=yes
callgroup=1
pickupgroup=1
mailbox=dave
nat=yes
deny=0.0.0.0/0.0.0.0 
permit=192.168.1.0/255.255.255.0
amaflags=billing

; PHONE on 192.168.1.4
[dec450]
type=friend
secret=
qualify=yes
canreinvite=yes
host=dynamic
context=external
defaultuser=dave
callerid=dave@xxxxxxxxxx <dave>
call-limit=100
callcounter=yes
limitonpeers=yes
callgroup=1
pickupgroup=1
mailbox=dave
nat=yes
deny=0.0.0.0/0.0.0.0 
permit=192.168.1.0/255.255.255.0
amaflags=billing

I’m not really making any sense out of the debug info but hopefully someone can. The only thing that seems a little odd is the ‘user=phone’.

You have no “s” extension in your external context (I would have expected an error message to this effect), or the “s” extension executes Unavailable().

The real problem is that you probably don’t have a valid dialplan on the phone, so it is opening the SIP connection before any digits are dialed.

I’m also wondering if there is some problem with 1.8 failing to replace an empty string with “s”.

Unfortunately adding an ‘s’ extension didn’t change anything. The dialplan settings on the phone are very basic, consisting basically of adding a phone number and then choosing to use either Voip or fixed line and to use a dialing code or not.

*Edit: This is what I added:

exten => s,1,Set(DYNAMIC_FEATURES=automon)
exten => s,n,Set(TOUCH_MONITOR=${CALLERID(num)}-${EXTEN}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M)})
exten => s,n,AGI(call-log.agi)
exten => s,n,Dial(SIP/${EXTEN}@${SIPDOMAIN})
exten => s,n,Hangup()

Look OK?

${EXTEN} will be “s”, which is probably not what you want.

All SIP hard phones should be configurable to not send anything until they have a complete number to dial. Failing that, it should be possible to dial the number before going “off-hook”.

My understanding is that the lack of user part should cause the s extension to be invoked, but it is possible that something is broken in the version you have and it really is trying to access an empty extension.

The CLI trace should give some clues.

Also, it is not normal to generate the actual SIP url address in the Dial arguments. One normally references a section name in sip.conf, and appends digits to that. For local calls, one normally simply addresses the section, with no digits.

Calling numbers, local and national, works fine. The problem is only when I try to connect to an IP address. If I directly connect to an IP it works ok, but not when going through asterisk.

I’m wondering about the ‘user=phone’ part in that output. Is asterisk actually asking if that use exists on the target IP?

adding an ‘s’ line didn’t work - also adding a exten => s,n,NoOp() didn’t register in console

Asterisk is not a SIP proxy. It will only look at the user part of the SIP URL.

Right, but even dialing my own server which routes all calls to my laptop gives a 404 too.

So I’m guessing that with no username@ then asterisk won’t be able to route the calls?

This code should set the extension to “s”:

/* If no extension was specified, use the s one */ /* Basically for calling to IP/Host name only */ if (ast_strlen_zero(p->exten)) ast_string_field_set(p, exten, "s");

Maybe something has been broken that prevents this code being reached or otherwise effective.

Yes the ‘s’ part was never reached because of the if {…} just before the switch.

I have managed to fix it and made a patch. I expect it breaks other things - I don’t know, but that ‘if’ test does need sorting out. We should never get to the switch in the case that there is no extension number (ie just an IP address).

http://www.dawoodfall.net/patches/asterisk-ip-only.diff

At present this allows me to dial just an IP, or a normal phone number through my Voip provider.

The only way of getting a patch applied to the official code is to use issues.asterisk.org properly. Digium will not accept any other route, because it does not give them permission to use the fix themselves.

You need to submit and get accepted the electronic licence grant, then attach the patch, to a bug report, as a unified diff, with the code or documentation tick box ticked.

Ok thanks, I’ll do that. The issues site doesn’t seem to be loading at them moment but I’ll have another look later.