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.