Help! cant get voipdiscount to work

Hello Asterisk Guru’s,
Wondering if someone could help me please. I’ve setup a very simple Asterisk 1.8.4.1 asterisk installation (uses asterisk management system gui) on my qnap nas box. I have created 4 extensions (100,200,300,400) and can dial between them, I’ve setup my cisco 7970G on ext300.
I’ve bought credit from voipdiscount and want to integrate this into the configuration, however it seems I’ve got something wrong with my config as get the following error if I try to dial the number in any of the UK formats;

Got a feeling that it is due to my dial plan or configuration, but am baffled by this, and would really appreciate any help to resolve as do a lot of conference calls from home and would prefer not to tie up the home number. I’ve stripped down the files as the original ones were annotated and several pages long.

Couple of notes:
I’m a uk reside with an area code 01932 (not my real one but same number of digits).
I’m hoping that I can dial the uk domestic number i.e. ‘02074963743’ rather than the full international number.

I’ve replaced the sensitive data with <> format

Thanks in advance.
Regards, Adrian.

[Sep 2 11:39:25] NOTICE[27212]: chan_sip.c:21619 handle_request_invite: Call from ‘300’ to extension ‘02074963743’ rejected because extension not found in context ‘users’.
[Sep 2 11:39:57] NOTICE[27212]: chan_sip.c:21619 handle_request_invite: Call from ‘300’ to extension ‘00442074963743’ rejected because extension not found in context ‘users’.
[Sep 2 11:41:17] NOTICE[27212]: chan_sip.c:21619 handle_request_invite: Call from ‘300’ to extension ‘442074963743’ rejected because extension not found in context ‘users’.

QNAP*CLI> dialplan show globals
OUTBOUND-TRUNKMSD=1
OUTBOUND-TRUNK="Zap/g2"
IAXINFO-AEL=guest
CONSOLE-AEL="Console/dsp"
TRUNKMSD=1
TRUNK=DAHDI/G2
IAXINFO=guest
CONSOLE=Console/dsp

-- 8 variable(s)

QNAP*CLI>

++++++++++++++++++++++++++++
SIP.CONF
++++++++++++++++++++++++++++
[general]
context = default ; Default context for incoming calls
allowoverlap = no ; Disable overlap dialing support. (Default is yes)
tcpenable = no ; Enable server for incoming TCP connections (default is no)
tcpbindaddr = 0.0.0.0 ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces)
srvlookup = yes ; Enable DNS SRV lookups on outbound calls
externhost = <>.dyndns.org
externrefresh = 900
disallow = all
allow = ulaw
localnet = 172.16.32.0/24

register => <>:<>@sip.voipdiscount.com

[voipdiscount-out]
type=peer ; we only want to call out, not be called
remotesecret=<> ; Our password to their service
defaultuser=<> ; Authentication user for outbound proxies
host=sip.voipdiscount.com
busylevel=2 ; Signal busy at 2 or more calls
outboundproxy=sip.voipdiscount.com ; send outbound signaling to this proxy, not directly to the peer

[authentication]

basic-options ; a template
dtmfmode=rfc2833
context=from-office
type=friend

natted-phone ; another template inheriting basic-options
nat=yes
directmedia=no
host=dynamic

public-phone ; another template inheriting basic-options
nat=no
directmedia=yes

my-codecs ; a template for my preferred codecs
disallow=all
allow=ilbc
allow=g729
allow=gsm
allow=g723
allow=ulaw

ulaw-phone ; and another one for ulaw-only
disallow=all
allow=ulaw

[100]
type=friend
host=dynamic
secret=100
context=users
mailbox=100@default

[200]
type=peer
host=dynamic
secret=200
context=users
mailbox=200@default

[300]
type=friend
host=dynamic
secret=300
context=users
mailbox=300@default

[400]
type=friend
host=dynamic
secret=400
context=users
mailbox=400@default

++++++++++++++++++++++++++++
extensions.conf
++++++++++++++++++++++++++++

[general]
static=yes
writeprotect=no
clearglobalvars=no
userscontext=default

[globals]
#include “ams_ext.conf”

[macro-phone]
exten => s,n,Dial(SIP/voipdiscount-out/44${NUM:1},180,T)
exten => s,1,Dial(SIP/${MACRO_EXTEN},25)
exten => s,n,Goto(${DIALSTATUS},1)
exten => ANSWER,1,Hangup
exten => CANCEL,1,Hangup
exten => NOANSWER,1,Voicemail(${MACRO_EXTEN}@default,u)
exten => BUSY,1,Voicemail(${MACRO_EXTEN}@default,b)
exten => CONGESTION,1,Voicemail(${MACRO_EXTEN}@default,b)
exten => CHANUNAVAIL,1,Voicemail(${MACRO_EXTEN}@default,u)
exten => a,1,VoicemailMain(${MACRO_EXTEN}@default)

[users]
exten => s,n,Dial(SIP/voipdiscount-out/44${NUM:1},180,T)
exten => 100,1,Macro(phone)
exten => 200,1,Macro(phone)
exten => 300,1,Macro(phone)
exten => 400,1,Macro(phone)
exten => 500,1,Macro(phone)
exten => 4242,1,VoicemailMain(default)

[default]
include => users
include => macro-phone

[time]
exten => _X.,30000(time),NoOp(Time: ${EXTEN} ${timezone})
exten => _X.,n,Wait(0.25)
exten => _X.,n,Answer()
exten => _X.,n,Set(FUTURETIME=$[${EPOCH} + 12])
exten => _X.,n,SayUnixTime(${FUTURETIME},Zulu,HNS)
exten => _X.,n,SayPhonetic(z)
exten => _X.,n,SayUnixTime(${FUTURETIME},${timezone},HNS)
exten => _X.,n,Playback(spy-local)
exten => _X.,n,WaitUntil(${FUTURETIME})
exten => _X.,n,Playback(beep)
exten => _X.,n,Return()

[ani]
exten => _X.,40000(ani),NoOp(ANI: ${EXTEN})
exten => _X.,n,Wait(0.25)
exten => _X.,n,Answer()
exten => _X.,n,Playback(vm-from)
exten => _X.,n,SayDigits(${CALLERID(ani)})
exten => _X.,n,Wait(1.25)
exten => _X.,n,SayDigits(${CALLERID(ani)}) ; playback again in case of missed digit
exten => _X.,n,Return()

QNAP*CLI> dialplan show users
[ Context ‘users’ created by ‘pbx_config’ ]
‘100’ => 1. Macro(phone) [pbx_config]
‘200’ => 1. Macro(phone) [pbx_config]
‘300’ => 1. Macro(phone) [pbx_config]
‘400’ => 1. Macro(phone) [pbx_config]
‘4242’ => 1. VoicemailMain(default) [pbx_config]
‘500’ => 1. Macro(phone) [pbx_config]

-= 6 extensions (6 priorities) in 1 context. =-
QNAP*CLI>

QNAP*CLI> dialplan show macro-phone
[ Context ‘macro-phone’ created by ‘pbx_config’ ]
‘ANSWER’ => 1. Hangup() [pbx_config]
‘BUSY’ => 1. Voicemail(${MACRO_EXTEN}@default,b) [pbx_config]
‘CANCEL’ => 1. Hangup() [pbx_config]
‘CHANUNAVAIL’ => 1. Voicemail(${MACRO_EXTEN}@default,u) [pbx_config]
‘CONGESTION’ => 1. Voicemail(${MACRO_EXTEN}@default,b) [pbx_config]
‘NOANSWER’ => 1. Voicemail(${MACRO_EXTEN}@default,u) [pbx_config]
‘a’ => 1. VoicemailMain(${MACRO_EXTEN}@default) [pbx_config]
‘s’ => 1. Dial(SIP/${MACRO_EXTEN},25) [pbx_config]
2. Goto(${DIALSTATUS},1) [pbx_config]

-= 8 extensions (9 priorities) in 1 context. =-

QNAPCLI> sip show registry
Host dnsmgr Username Refresh State Reg.Time
sip.voipdiscount.com:5060 N <> 105 Registered Mon, 02 Sep 2013 11:56:59
1 SIP registrations.
QNAP
CLI> sip show peers
Name/username Host Dyn Forcerport ACL Port Status
100 (Unspecified) D 0 Unmonitored
200 (Unspecified) D 0 Unmonitored
300/300 172.16.32.199 D 5060 Unmonitored
400/400 (Unspecified) D 0 Unmonitored
voipdiscount-out/<> 77.72.169.134 5060 Unmonitored
5 sip peers [Monitored: 0 online, 0 offline Unmonitored: 2 online, 3 offline]
QNAP*CLI>

Hello,

In the sip configuration you assign the users to the users context.

That means that when one of the users makes a call, the system looks in the assigned context if the called number is there.

So what you have to do is add a patern to the users context.

So, if you dial an international number, you have to add this to the users context.

exten => _00X.,1,NoOp(International call)
same => n,Dial(SIP/${EXTEN:2}@voipdiscount)
same => n,Hangup()

I removed the leading zero’s, I think voipdiscount expects the recieved number in international format without leading zero’s.

Then your call should go out.

Just remember to make sure that incomming sip calls never have access to an context that has outgoing routing… Will save you a lot of money.

Goodluck.

Many thanks for your advice, it seems to be getting further now, but still doesn’t establish the call, seems I’m getting a SIP/2.0 401 Unauthorized & SIP/2.0 603 Declined as per debug below, so not sure if my asterisk is creating the session properly?

thanks again for your assistance.

kind regards, Adrian
++++++++++++++++++++++++++++++++++++
QNAPCLI>
QNAP
CLI>
QNAPCLI>
QNAP
CLI>
QNAPCLI>
QNAP
CLI>

<— SIP read from UDP:172.16.32.199:49159 —>
INVITE sip:00442074963743@qnap.home.internal SIP/2.0
Via: SIP/2.0/UDP 172.16.32.199:5060;branch=<< branch replaced >>
From: “300” sip:300@qnap.home.internal;tag=<< tag replaced >>
To: sip:00442074963743@qnap.home.internal
Call-ID: << tag replaced #2 >>@172.16.32.199
Max-Forwards: 70
Date: Mon, 02 Sep 2013 GMT
CSeq: 101 INVITE
User-Agent: Cisco-CP7970G/8.0
Contact: sip:300@172.16.32.199:5060;transport=udp
Expires: 180
Accept: application/sdp
Allow: ACK,BYE,CANCEL,INVITE,NOTIFY,OPTIONS,REFER,REGISTER,UPDATE,SUBSCRIBE
Supported: replaces,join,norefersub
Allow-Events: kpml,dialog
Content-Length: 275
Content-Type: application/sdp
Content-Disposition: session;handling=optional

v=0
o=Cisco-SIPUA 21811 0 IN IP4 172.16.32.199
s=SIP Call
t=0 0
m=audio 32634 RTP/AVP 0 8 18 101
c=IN IP4 172.16.32.199
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/0
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
<------------->
— (18 headers 13 lines) —
Sending to 172.16.32.199:5060 (no NAT)
Using INVITE request as basis request - << tag replaced #2 >>@172.16.32.199
Found peer ‘300’ for ‘300’ from 172.16.32.199:49159

<— Reliably Transmitting (no NAT) to 172.16.32.199:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 172.16.32.199:5060;branch=<< branch replaced >>;received=172.16.32.199
From: “300” sip:300@qnap.home.internal;tag=<< tag replaced >>
To: sip:00442074963743@qnap.home.internal;tag=as081ebdf2
Call-ID: << tag replaced #2 >>@172.16.32.199
CSeq: 101 INVITE
Server: Asterisk PBX 1.8.4.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="5e799928"
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘<< tag replaced #2 >>@172.16.32.199’ in 32000 ms (Method: INVITE)

<— SIP read from UDP:172.16.32.199:49611 —>
ACK sip:00442074963743@qnap.home.internal SIP/2.0
Via: SIP/2.0/UDP 172.16.32.199:5060;branch=<< branch replaced >>
From: “300” sip:300@qnap.home.internal;tag=<< tag replaced >>
To: sip:00442074963743@qnap.home.internal;tag=as081ebdf2
Call-ID: << tag replaced #2 >>@172.16.32.199
Date: Mon, 02 Sep 2013 GMT
CSeq: 101 ACK
Content-Length: 0

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

<— SIP read from UDP:172.16.32.199:49159 —>
INVITE sip:00442074963743@qnap.home.internal SIP/2.0
Via: SIP/2.0/UDP 172.16.32.199:5060;branch=<< branch replaced >>
From: “300” sip:300@qnap.home.internal;tag=<< tag replaced >>
To: sip:00442074963743@qnap.home.internal
Call-ID: << tag replaced #2 >>@172.16.32.199
Max-Forwards: 70
Date: Mon, 02 Sep 2013 GMT
CSeq: 102 INVITE
User-Agent: Cisco-CP7970G/8.0
Contact: sip:300@172.16.32.199:5060;transport=udp
Authorization: Digest username=“300”,realm=“asterisk”,uri=“sip:00442074963743@qnap.home.internal”,response="<< response replaced >>",nonce=“5e789928”,algorithm=MD5
Expires: 180
Accept: application/sdp
Allow: ACK,BYE,CANCEL,INVITE,NOTIFY,OPTIONS,REFER,REGISTER,UPDATE,SUBSCRIBE
Supported: replaces,join,norefersub
Allow-Events: kpml,dialog
Content-Length: 275
Content-Type: application/sdp
Content-Disposition: session;handling=optional

v=0
o=Cisco-SIPUA 21811 0 IN IP4 172.16.32.199
s=SIP Call
t=0 0
m=audio 32634 RTP/AVP 0 8 18 101
c=IN IP4 172.16.32.199
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/0
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
<------------->
— (19 headers 13 lines) —
Sending to 172.16.32.199:5060 (no NAT)
Using INVITE request as basis request - << tag replaced #2 >>@172.16.32.199
Found peer ‘300’ for ‘300’ from 172.16.32.199:49159
Found RTP audio format 0
Found RTP audio format 8
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 G729 for ID 18
Found audio description format telephone-event for ID 101
Capabilities: us - 0x4 (ulaw), peer - audio=0x10c (ulaw|alaw|g729)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0x4 (ulaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 172.16.32.199:32634
Looking for 00442074963743 in users (domain qnap.home.internal)
list_route: hop: sip:300@172.16.32.199:5060;transport=udp

<— Transmitting (no NAT) to 172.16.32.199:5060 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 172.16.32.199:5060;branch=<< branch replaced >>;received=172.16.32.199
From: “300” sip:300@qnap.home.internal;tag=<< tag replaced >>
To: sip:00442074963743@qnap.home.internal
Call-ID: << tag replaced #2 >>@172.16.32.199
CSeq: 102 INVITE
Server: Asterisk PBX 1.8.4.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: sip:00442074963743@172.16.32.4:5060
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘<< tag replaced #2 >>@172.16.32.199’ in 32000 ms (Method: INVITE)

<— Reliably Transmitting (no NAT) to 172.16.32.199:5060 —>
SIP/2.0 603 Declined
Via: SIP/2.0/UDP 172.16.32.199:5060;branch=<< branch replaced >>;received=172.16.32.199
From: “300” sip:300@qnap.home.internal;tag=<< tag replaced >>
To: sip:00442074963743@qnap.home.internal;tag=as220aefc7
Call-ID: << tag replaced #2 >>@172.16.32.199
CSeq: 102 INVITE
Server: Asterisk PBX 1.8.4.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0

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

<— SIP read from UDP:172.16.32.199:49612 —>
ACK sip:00442074963743@qnap.home.internal SIP/2.0
Via: SIP/2.0/UDP 172.16.32.199:5060;branch=<< branch replaced >>
From: “300” sip:300@qnap.home.internal;tag=<< tag replaced >>
To: sip:00442074963743@qnap.home.internal;tag=as220aefc7
Call-ID: << tag replaced #2 >>@172.16.32.199
Date: Mon, 02 Sep 2013 GMT
CSeq: 102 ACK
Content-Length: 0

<------------->
— (8 headers 0 lines) —
Really destroying SIP dialog ‘<< sip replaced >>@172.16.32.199’ Method: ACK
QNAPCLI> sip set debug off
SIP Debugging Disabled
QNAP
CLI> sip show registry
Host dnsmgr Username Refresh State Reg.Time
sip.voipdiscount.com:5060 N <> a 105 Registered Mon, 02 Sep 2013 15:55:55
1 SIP registrations.
QNAP*CLI>

The 401 is normal. You don’t have enough verbosity to work out why the request is being declined.

(It looks like you have your local devices defined as users, which can cause problem, but generally only for calls arriving from the trunk. peers are almost certainly better.)

Hi David,

may I asked what debugging options I need to identify the root cause please?

i’m just building an asterisk now box on my VMware server to see if that can shed some light on why its not working. also thought about down grading the version to see if the asterisk management gui would help.

thanks for any assistance.

regards, Adrian

built VMware machine from AsteriskNow installation, and mentions in sip.conf file to edit via freepbx gui, this is becoming very confusing, going to try an earlier version on my nas first 1.4.22.1b and see where I get too, it sounds as if the commands are not common between versions, so seem to be having an uphill battle here.

wiki.asterisk.org/wiki/display/ … nformation