Asterisk 1.8 SIP, i can make inbound but not out going calls

Hello All,

I was wondering if anybody could help me again :wink:

I’ve recently got a dreamplug and a cisco ip phone, all sorted and asterisk 1.8 installed.

I can make inbound calls from my mobile to the phone however i can’t make phone calls from my ip phone to anyone. When i pick up the handset i get a dial tone, when i dial a number I get a beep beep beep that’s it, so invalid number tone i guess, interesting thing is i don’t get any message on my asterisk server its even trying to make a call.

Sip.conf
[general]
port=5060
bindaddr=0.0.0.0
qualify=no
disable=no
allow=ulaw
allow=alaw
allow=gsm
allowexternaldomains=yes

register => SIPID:SIPpassword@sipgate.co.uk:5060/joshua26061990

[sipgate-out]
type=friend
secret=Password
username=joshua26061990
defaultip=192.168.0.2
fromuser=joshua26061990
fromdomain=sipgate.co.uk
canreinvite=yes
insecure=invite,port
qualify=yes
nat=yes
context=default ; this section will be defined in extensions.conf

Extensions.conf

[general]
static=yes
writeprotect=no
autofallthrough=yes
clearglobalvars=no
extenpatternmatchnew=no

[globals]
CONSOLE => Console/dsp
IAXINFO => guest
TRUNK => DAHDI/G2
TRUNKMSD => 1
FEATURES =>
DIALOPTIONS =>
RINGTIME => 20
FOLLOWMEOPTIONS =>
PAGING_HEADER => Intercom
CID_6001 => 02392985126
include => dundi-e164-canonical
include => dundi-e164-customers
include => dundi-e164-via-pstn
switch => DUNDi/e164

[default]
exten => joshua26061990,1,Answer ; 1234 is the contact extension, default contact extension is "s"
exten => joshua26061990,2,Dial(SIP/sipgate-out,25,Ttr) ; incoming calls are redirected to SIP telephone with number 111
exten => joshua26061990,3,Hangup

exten => _1,1,dial(SIP/${EXTEN}@sipgate.co.uk,30)

I’m a bit stuck now, as i said i can receive calls but can’t make them. and i don’t know any internet services i can use, i heard *68 was a wake up call, i get nothing when dial that and apparently to add credit to my sip account i need to dial 10200, i know i don’t have credit but it should show me calling out on asterisk server output. i’m just a little stuck. its as if the phones just one way. >.<

can anybody shed some light, maybe i’m doing something stupid. just request anything else you need to see.

Thank you so much for any help.

You haven’t forwarded any dialed digits to Sipgate!

Generally, though, you should include console log output at at least verbosity 3 with any question like this.

It looks as though you are following a recipe for your sip.conf. Most such recipes set options that are not strictly necessary and may reduce security.

Before you fix outbound calls, please, please, make sure that they cannot be made from the context associated with incoming PSTN calls. Please also disable allowguest.

I’ve set allowguest=no in my general, I’m really new as you can see David from the other posts you’ve helped me with. by recipes? you mean template of the contexts ? I’m a little stupid when it comes to this.

I have no output in the console log, My verbosity is usually set to 8 or 9 whats the difference ?

how can i make sure that they cannot be made with the associated calls ?

Thank you again!

so i’m guesssing you ment this bit when you said about stuff i didn’t need

[general]
static=yes
writeprotect=no
autofallthrough=yes
clearglobalvars=no
extenpatternmatchnew=no

[globals]
CONSOLE => Console/dsp
IAXINFO => guest
TRUNK => DAHDI/G2
TRUNKMSD => 1
FEATURES =>
DIALOPTIONS =>
RINGTIME => 20
FOLLOWMEOPTIONS =>

I’ve gotten rid of the include lines so that it doesn’t include the PSTN extensions…

also i logged on this morning to find this…

[Mar 22 13:27:56] NOTICE[1504]: chan_sip.c:23272 handle_request_invite: Call from ‘’ (37.8.9.107:10249) to extension ‘00972597234683’ rejected because extension not found in context ‘default’.
== Using SIP RTP CoS mark 5
[Mar 22 13:28:02] NOTICE[1504]: chan_sip.c:23272 handle_request_invite: Call from ‘’ (37.8.9.107:10247) to extension ‘000972597234683’ rejected because extension not found in context ‘default’.
== Using SIP RTP CoS mark 5
[Mar 22 13:28:05] NOTICE[1504]: chan_sip.c:23272 handle_request_invite: Call from ‘’ (37.8.9.107:10246) to extension ‘900972597234683’ rejected because extension not found in context ‘default’.

This is a premium number and tried to call me as soon as i got on my laptop… so thank god for my stupidity in contexts otherwise i could have been charged lol. also he hasn’t tried calling back since i got rid of those include lines.

my newer extensions.conf

[general]
static=yes
writeprotect=no
autofallthrough=yes
clearglobalvars=no
extenpatternmatchnew=no

[globals]
CONSOLE => Console/dsp
IAXINFO => guest
TRUNK => DAHDI/G2
TRUNKMSD => 1
FEATURES =>
DIALOPTIONS =>
RINGTIME => 20
FOLLOWMEOPTIONS =>

[default]
exten => joshua26061990,1,Answer ; 1234 is the contact extension, default contact extension is "s"
exten => joshua26061990,2,Dial(SIP/sipgate-in,25,Ttr) ; incoming calls are redirected to SIP telephone with number 111
exten => joshua26061990,3,Hangup

exten => _XXXXXXXXXXXXXXX,1,Dial(SIP/sipgate-out/${EXTEN})
exten => _XXXXXXXXXX,1,Dial(SIP/sipgate-out/${EXTEN})
exten => _XXXXXX,1,Dial(SIP/sipgate-out/${EXTEN})

and new sip.conf

[general]
port=5060
bindaddr=0.0.0.0
qualify=no
disable=no
allow=ulaw
allow=alaw
allow=gsm
allowexternaldomains=yes

register => SIPID:PASSWORD@sipgate.co.uk:5060/joshua26061990

[sipgate-out]
type=peer
allowguest=no
username=joshua26061990
secret=PASSWORD
fromdomain=sipgate.co.uk
host=sipgate.co.uk
insecure=invite,port
qualify =yes

[sipgate-in]
type=friend
secret=password
username=joshua26061990
defaultip=192.168.0.2
fromuser=joshua26061990
fromdomain=sipgate.co.uk
canreinvite=yes
insecure=invite,port
qualify=yes
allowguest=no
nat=yes
context=default ; this section will be defined in extensions.conf

This does not do what the comment says, but tries to dial out on a trunk whilst failing to forward any digits.

You really do not want this in your default context. The ability to make toll calls should be restricted to contexts only reachable from internal phones.

Right ok i’ve really buggered this up haven’t i haha.

[quote]
This does not do what the comment says, but tries to dial out on a trunk whilst failing to forward any digits.[/quote]

oh its trying to dial out, i through it dialed my extension so that it would redirect incoming calls to my phone. i guess not.

[quote]
You really do not want this in your default context. The ability to make toll calls should be restricted to contexts only reachable from internal phones.[/quote]

oh this is why i had a premium line try and dial me maybe. i’ll have to just get rid of it.

but i don’t have any errors that appear to come up when receiving calls, and if its meant to be forwarding and failing I have no errors that display in the server log. >.<

Ok so i’ll get rid of the toll numbers. and change it to _9. so i have to dial 9 to get an outside number ?

[default]
exten => joshua26061990,1,Answer ; 1234 is the contact extension, default contact extension is "s"
exten => joshua26061990,2,Dial(SIP/sipgate-in,25,Ttr) ; incoming calls are redirected to SIP telephone with number 111
exten => joshua26061990,3,Hangup

exten => _9,1,Dial(SIP/sipgate-out/${EXTEN})

like this ?

someone keeps trying to call me on all different extensions. anyone have any idea, they can’t get through but still.

= Using SIP RTP CoS mark 5
[Mar 22 17:29:47] NOTICE[1455]: chan_sip.c:23272 handle_request_invite: Call from ‘’ (176.31.65.135:5071) to extension ‘000972592555229’ rejected because extension not found in context ‘default’.
== Using SIP RTP CoS mark 5
[Mar 22 17:29:49] NOTICE[1455]: chan_sip.c:23272 handle_request_invite: Call from ‘’ (176.31.65.135:5074) to extension ‘00972592555229’ rejected because extension not found in context ‘default’.
== Using SIP RTP CoS mark 5
[Mar 22 17:29:51] NOTICE[1455]: chan_sip.c:23272 handle_request_invite: Call from ‘’ (176.31.65.135:5076) to extension ‘900972592555229’ rejected because extension not found in context ‘default’.
== Using SIP RTP CoS mark 5
[Mar 22 17:29:52] NOTICE[1455]: chan_sip.c:23272 handle_request_invite: Call from ‘’ (176.31.65.135:5071) to extension ‘800972592555229’ rejected because extension not found in context ‘default’.
== Using SIP RTP CoS mark 5
[Mar 22 17:29:54] NOTICE[1455]: chan_sip.c:23272 handle_request_invite: Call from ‘’ (176.31.65.135:5071) to extension ‘700972592555229’ rejected because extension not found in context ‘default’.
== Using SIP RTP CoS mark 5
[Mar 22 17:29:55] NOTICE[1455]: chan_sip.c:23272 handle_request_invite: Call from ‘’ (176.31.65.135:5070) to extension ‘9900972592555229’ rejected because extension not found in context ‘default’.
== Using SIP RTP CoS mark 5
[Mar 22 17:29:56] NOTICE[1455]: chan_sip.c:23272 handle_request_invite: Call from ‘’ (176.31.65.135:5070) to extension ‘810972592555229’ rejected because extension not found in context ‘default’.
> ast_get_srv: SRV lookup for ‘_sip._udp.sipgate.co.uk’ mapped to host sipgate.co.uk, port 5060
> ast_get_srv: SRV lookup for ‘_sip._udp.sipgate.co.uk’ mapped to host sipgate.co.uk, port 5060
> ast_get_srv: SRV lookup for ‘_sip._udp.sipgate.co.uk’ mapped to host sipgate.co.uk, port 5060
> ast_get_srv: SRV lookup for ‘_sip._udp.sipgate.co.uk’ mapped to host sipgate.co.uk, port 5060
> ast_get_srv: SRV lookup for ‘_sip._udp.sipgate.co.uk’ mapped to host sipgate.co.uk, port 5060
> ast_get_srv: SRV lookup for ‘_sip._udp.sipgate.co.uk’ mapped to host sipgate.co.uk, port 5060
== Using SIP RTP CoS mark 5
[Mar 22 17:38:31] NOTICE[1455]: chan_sip.c:23272 handle_request_invite: Call from ‘’ (37.8.6.129:11242) to extension ‘00972598335031’ rejected because extension not found in context ‘default’.
== Using SIP RTP CoS mark 5
[Mar 22 17:38:33] NOTICE[1455]: chan_sip.c:23272 handle_request_invite: Call from ‘’ (37.8.6.129:11242) to extension ‘000972598335031’ rejected because extension not found in context ‘default’.
== Using SIP RTP CoS mark 5
[Mar 22 17:38:35] NOTICE[1455]: chan_sip.c:23272 handle_request_invite: Call from ‘’ (37.8.6.129:11242) to extension ‘900972598335031’ rejected because extension not found in context ‘default’.
> ast_get_srv: SRV lookup for ‘_sip._udp.sipgate.co.uk’ mapped to host sipgate.co.uk, port 5060

Set allowguest=no, alwaysauthreject=yes, close ports if you dont need it, use a block hosts tool.

ok cheers for that :smile: all sorted, hopefully i won’t get that anymore lol

can anybody shred some light on my outbound call issue, I’m really stuck, and i’ve tried doing what david55 suggested but i don’t really understand the dial extensions at all. and i’ve look and i’m still confused.

[quote=“joshua26061990”]someone keeps trying to call me on all different extensions. anyone have any idea, they can’t get through but still.
[/quote]

Because they are criminals. In this case it looks like they probably own the premium rate number.

That’s why I’m telling you not to include outgoing rules your default context.

ok well i’ve removed the including rules now so thats cool.

Ok so i still don’t have a clue how to solve this problem, is there anyone that can help. David55 you’ve been so much help.

I still don’t understand the calling patterns and rules i have spent ages researching them but there all different depending on what version and type you have, i can’t seem to find a consistent set of global rules to put in and, i get no SIP messages when i dial from the phone just the same tone.

I really have no idea. could you guys help me please :smile:

I have Cookies ?

Most used dialpatterns:

X means digits from 0-9
Z means digits from 1-9
N means digits from 2-9
. Means any number or digits
_ Means “begin with”

So for example if I want a dialpattern That “begin with 7 and is followed by 6 numbers from 0-9” I can use:

Exten => _7XXXXXX

IF I want a pattern “beggining with any number greater than 2 and followed by n numbers of digits”

Exten=> _N. <----- bad practice btw

And so on, so you need to create your dialpattern according your needs.

Right ok, so my dial plan consists of

[default]
exten => _9.,1,Dial(SIP/sipgate.co.uk/${EXTEN:1})

so here this means i can press 9 and then any number after that, as i have the . there. the protocol is SIP and i want it to connect to my sipgate.co.uk account so i can dial out. the EXTEN:1 removes the 9.

that was my outbound statement. and this is bad practice ? as its just one extensions then any number. although i would have thought it fine as its only for my outbound calls.

below is my inbound statement that works fine with my phone. i can ring my phone from anywhere.

exten => joshua26061990,1,Answer ; joshua26061990 is the contact extension, default contact extension is "s"
exten => joshua26061990,2,Dial(SIP/sipgate-in,25,Ttr) ; incoming calls are redirected to SIP telephone with number joshua26061990
exten => joshua26061990,3,Hangup

Thank you by the way. :smile:

Hey guys,

Could someone please help me, I’m really new to this I’ve been at it for ages.

I’m sorry to bug everyone but even after trying to set up my call patterns i still don’t understand why i can’t dial out.

Kind Regards

Joshua Shipman

Please provide the complete contents of extensions.conf and sip.conf (with passwords obscured). Also please provide verbose logging for a call with the configuration that you are actually supplying.

I am pretty sure that the the problem lies in something that you are not telling us, although I would note that your choice of SIP device names is confusing, and you may be bypassing sip.conf for outgoing calls.

This should not be so difficult and I suspect you need to go back to the documentation and read it until you understand, or pay someone to set up the system for you. I feel you are currently out of your depth.

I’m not going to lie i feel i’m out of my depth to be honest.
However as this is a set project it needs to be done. and I Will Learn.

Trust me when i say, i’m not holding anything back, if i am its down to my own stupidity.

Sip.conf

[code][general]
port=5060
bindaddr=0.0.0.0
qualify=no
disable=no
allow=ulaw
allow=alaw
allow=gsm
allowexternaldomains=yes

register => 1531133:SIPPassword@sipgate.co.uk:5060/joshua26061990

;[sipgate-out]
;type=peer
;allowguest=no
;username=joshua26061990
;secret=Password
;fromdomain=sipgate.co.uk
;host=sipgate.co.uk
;insecure=invite,port
;qualify=yes;

[sipgate-in]
type=friend
secret=password
username=joshua26061990
defaultip=192.168.0.2
fromuser=joshua26061990
fromdomain=sipgate.co.uk
canreinvite=yes
insecure=invite,port
qualify=yes
;allowguest=yes
nat=yes
context=default ; this section will be defined in extensions.conf[/code]

Extensions.conf

[code][general]
static=yes
writeprotect=no
autofallthrough=yes
clearglobalvars=no
extenpatternmatchnew=no
;allowguest=no
;alwaysauthreject=no ; If i use this, i’m unable to call the phone from my mobile…

[globals]
TRUNKMSD => 1
FEATURES =>
DIALOPTIONS =>
RINGTIME => 20
FOLLOWMEOPTIONS =>

[default]
exten => _9.,1,Dial(SIP/sipgate.co.uk/${EXTEN:1}) ;

exten => joshua26061990,1,Answer ; joshua26061990 is the contact extension, default contact extension is "joshua26061990"
exten => joshua26061990,2,Dial(SIP/sipgate-in,25,Ttr) ; incoming calls are redirected to SIP telephone with number joshua26061990
exten => joshua26061990,3,Hangup[/code]

Verbose Log - This is me calling from my mobile to the IP phone.

[code]root@guiplug:/home/guiplug# asterisk -vvvvvr
Asterisk 1.8.20.1, Copyright © 1999 - 2012 Digium, Inc. and others.
Created by Mark Spencer markster@digium.com
Asterisk comes with ABSOLUTELY NO WARRANTY; type ‘core show warranty’ for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type ‘core show license’ for details.

Connected to Asterisk 1.8.20.1 currently running on guiplug (pid = 1450)
Verbosity is at least 6
== Using SIP RTP CoS mark 5
– Executing [joshua26061990@default:1] Answer(“SIP/sipgate.co.uk-0000000b”, “”) in new stack
– Executing [joshua26061990@default:2] Dial(“SIP/sipgate.co.uk-0000000b”, “SIP/sipgate-in,25,Ttr”) in new stack
== Using SIP RTP CoS mark 5
– Called SIP/sipgate-in
– SIP/sipgate-in-0000000c is ringing
== Spawn extension (default, joshua26061990, 2) exited non-zero on ‘SIP/sipgate.co.uk-0000000b’
[Mar 28 12:37:03] ERROR[2230]: cdr_csv.c:318 csv_log: Unable to re-open master file /var/log/asterisk//cdr-csv//Master.csv : Permission denied
> doing dnsmgr_lookup for ‘sipgate.co.uk
> ast_get_srv: SRV lookup for ‘_sip._udp.sipgate.co.uk’ mapped to host sipgate.co.uk, port 5060
> doing dnsmgr_lookup for ‘sipgate.co.uk
[/code]

Is this ok ? my SIP names are just a reference i started with when i started to be able to receive incoming calls, hence i haven’t changed it.

Paying is out of the option, don’t think i haven’t thought about it thou haha.
I’ve tried examples. they don’t seem to work. i’m hoping if you can help me i will just go, I’m an idiot i should have know that and thank you like a mad man.

You are calling SIP/sipgate-in, i.e. you are trying to send the call back out through sipgate, but you are not giving it any dialed digits, so it doesn’t know where to send the call.

You haven’t demonstrated a case using level 9, but that would bypass sip.conf, and therefore not send your password, so that wouldn’t work, either, or at least shouldn’t work, if sipgate have a sensible security configuration.