asterisk zoiper registration failed - asterisk

I'm using Asterisk to register sip client but it shows me this message:
NOTICE[3212]: chan_sip.c:25797 handle_request_register: Registration from '' failed for '192.xx.xx.xx:5060' - Wrong password
that's what I configure in sip.conf:
[user1]
type=friend
host=dynamic
secret=root
context=users
nat=no
[user2]
type=friend
host=dynamic
secret=rootroot
context=users
nat=no
in extensions.conf:
[users]
exten=>6001,1,Dial(SIP/user1,20)
exten=>6002,1,Dial(SIP/user2,20)
when I use sip show users, I don't find any user.

u forgot to add
[user1]
...
defaultuser=user1
[user2]
...
defaultuser=user2

It looks like to be asked in Server Fault though.
Error says 'Wrong Password' though did you make sure its correct?
How did you set up Zoiper?
I recommend you set keepalive as well.
Otherwise zoiper will be unregistered from Asterisk.
And also make sure you set up zoiper to work background if you want to take call all the time.
You can turn on background functionality here.
Settings > Incoming Calls

Related

Cannot originate call with Asterisk

Hopefully someone can help me out, I've been breaking my head for a few days and have read a ton of threads on the internet to no avail.
My ultimate goal is to use the AMI to originate a call and pass it off to a script. Unfortunately I cannot get originate to work so I have simplified the flow to try and debug the issue. I am trying to just originate a call from the dialplan now and play a sound file. After a short time the call gets cancelled and the SIP client that originated the call gets a declined.
This same configuration works perfectly exactly as is using the Dial command instead of the Originate command.
Below I am including a SIP debug from the console of the originate and the relevant sip.conf bits. The sever is using Asterisk v1.8.32.3.
All IPs and phone numbers have been changed to protect the innocent.
111.111.111.111 (Asterisk Server IP)
222.222.222.222 (SIP Termination Provider)
333.333.333.333 (Originating SIP Client)
sip.conf
[vitel-outbound]
type=friend
dtmfmode=auto
host=222.222.222.222
allow=all
canreinvite=no
nat=yes
trustrpid=yes
sendrpid=yes
[front4]
type=friend
context=outgoing-calls
host=dynamic
defaultuser=front4
secret=password
nat=yes
qualify=yes
limitonpeers=yes
call-limit=10
port=5060
canreinvite=no
dtmfmode=rfc2833
disallow=all
allow=ulaw
SIP Debug
Looking at your trace, the Asterisk is cancelling the outbound call.
Without timestamps or more logging it's impossible to say why definitively. However, looking at the timestamps of the outbound INVITE and the OPTIONS from the originating client it would seem that the Originate() command is simply timing out. The Originate() command has a hard-coded 30-second timeout.
When the Originate() command terminates then the inbound call from the client hits the Hangup() step in the dialplan. This sends a 603 Declined response since the inbound call was never answered.

Asterisk who is calling every minute?

I know the basics of Asterisk . When I go into the console by running the command asterisk -rvvv I see the following:
If you notice I first get a notice:
[Aug 24 19:14:43] NOTICE[5097][C-00000036]: chan_sip.c:25877
handle_request_invite: Call from '' (62.210.26.82:5079) to extension
'011972599166454' rejected because extension not found in context
'default'.
and then I get a warning and this happens every minute.
So my question is who is dailing extension 011972599166454 ? If I add:
[default]
exten => _X.66454,1,NoOp(Hanging up call)
same => n, Hangup
to my extensions.conf file this solves the problem. But why is someone making a call every minute? to open the NAT? Should I stop this?
I'd just ban the IP address with your firewall and forget it.
If you are curious, you can set sip set debug ip <ip> and check SIP headers, maybe you could find some info about callee in the headers.
Also you can trace the IP with whois and try to find admins' contact to discuss the issue.
This is scanning bot looking for free calls.
Just disable guest calling sip.conf: allowguest=no. Then any not authenticated connections will be ignored. It will help with new IPs also.
http://www.voip-info.org/wiki/view/Asterisk+sip+allowguest
It seems that this is an attempt of hacking...
Use Fail2Ban for blocking any suspected attempts to call.

Asterisk ACL Doesn't Seem To Work

I am trying to get Asterisk to allow inbound calls (authed purely on IP) on multiple IPs from the same supplier. The only way that works so far is to create a new sip.conf peer entry for each IP.
ACLs look like they should work, but I cannot work out how to use them properly. That or they don't work as I think they do/should.
For example, if I create the following in my sip.conf (a little stripped down) :
[general]
context=no_default_context_allowed
allowguest=yes
...
[supplier]
type=peer
host=1.1.1.1
context=abc
the calls that arrive from 1.1.1.1 go to the context abc as expected. However, if I have a range of IPs (eg 1.1.1.80/28) I would expect something along these lines to work :
[supplier]
type=peer
host=dynamic
acl=supplier-acl
context=abc
with the acl.conf as :
[supplier-acl]
deny=0.0.0.0/0.0.0.0
permit=1.1.1.80/28
From the Asterisk CLI :
acl show supplier-acl
ACL: supplier-acl
----------------------------------------
0: deny - 0.0.0.0/0.0.0.0
1: allow - 1.1.1.80/255.255.255.240
which looks correct to me, and sip show peers shows A in the ACL column.
In every case, no matter how I try and configure it, the call goes to the default context unless the host contains the precise IP of the inbound call.
I've tried so many config variations I can't honestly remember them all, so what I'm asking is does anyone know how to do this?
EDIT: I'm using Asterisk 13.0.2
ACL restricts the network configuration, but does not identify the host.
You will need a separate peer entry per call origin host to ensure that the calls get to the right context. Just make your [supplier] into a template, and then have several [supplier-srv1], [supplier-srv2] each with host=<specific ip> to distinguish them.
Further Reading
+ https://wiki.asterisk.org/wiki/display/AST/Named+ACLs
+ http://www.voip-info.org/wiki/view/Asterisk+config+sip.conf
acl desighned for something like this
[localext]
type=friend
host=dynamic
secret=supersecret
deny=0.0.0.0/0.0.0.0
permit=192.168.0.1/24
You still need add other mandatory params(minimum realy working is above example)

Request timeouts due to register/unregister conflicts in asterisk

I have installed asterisk 11.5.1, and I have Bria on iPhone as the sip client. username/passwords are set in sip.conf, and the default dialplan (used by the clients) is
exten => _X.,1,Dial(SIP/${EXTEN},20)
exten => _X.,n,Hangup()
I have two iphones, say A and B, and I attached to the running asterisk with asterisk -rvvvv. When I hit 'Register' button from A, I see
Registered SIP 'A' at ww.xx.yy.zz:mmmm
message on the asterisk cli. When I hit 'Register' button from B, I see
Registered SIP 'B' at aa.bb.cc.dd:nnnn
Unregistered SIP 'B' <== HERE IS THE PROBLEM
although I do not hit Unregister from client B. Besides, B seems registered at the client. From now on, any call from B results in 'request timeout'. And if I call B from A, I see 'subscriber absent' message on the asterisk cli.
Why is asterisk unregistering client B? Any suggestion?
p.s.: I see the following error in asterisk cli:
chan_sip.c:3905 __sip_xmit: sip_xmit of 0x7f7df4027b00 (len 622) to aa.bb.cc.dd:nnnn returned -2: Interrupted system call
EDIT: My sip.conf file is as following
[myConf](!)
disallow=all
allow=g729
allow=gsm
allow=g723
allow=ulaw
allow=ilbc
directmedia=no
host=dynamic
dtmfmode=rfc2833
context=default
type=friend
transport=tls,tcp
qualify=4000
nat=force_rport,comedia
encryption=yes
[A](myConf)
secret=AAAA
[B](myConf)
secret=BBBB
I can't give you the exact solution but I can point to where it may can be the problem.
The documentated part of the code from where you hit the problem in chan_sip.c says
* \return length of transmitted message, XMIT_ERROR on know network failures -1 on other failures
In your case you fall on the other failures as Interrupted system call. That message led me to an open bug suspended due to lack of activity here. So my bid is that this error is more related to operating system than Asterisk itself.
My following question is, if you invert the order (first register B and then register A) is the last one who gets the error? If yes then you may start looking at the selinux or any other security tool that is killing the connection after is established. Otherwise you may need to update the bug and let the people from Asterisk fix the bug.
Let us know the result, is always nice to find posts with fixes :)
I think you need deal with NAT
http://www.voip-info.org/wiki/view/Asterisk+SIP+NAT+solutions
OR you have check that your B can got message from asterisk and answer it correctly. More info can be got using sip debug
asterisk -r
sip set debug on

Call and hangup using Asterisk as a SIP client

I'm a newbie in Asterisk, so I'm gonna start with something simple.
I read some documentation and I've managed to do some basic config.
My Asterisk version is 1.6.2.9-2+squeeze10 (installed on Debian using apt-get) and changed ONLY sip.conf and extensions.conf.
My idea is to use it as a SIP client, connected to the Flowroute SIP server - but please see what's happening when I use console dial EXTEN...
sip.conf
[general]
register => 74770000:HIDDEN#sip.flowroute.com/s
registertimeout=20
context=default
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
subscribecontext=from-sip
[flowroute]
canreinvite=no
username=74770000
fromuser=74770000
secret=HIDDEN
context=default
type=friend
fromdomain=sip.flowroute.com
host=85.17.214.222
dtmfmode=rfc2833
disallow=all
allow=alaw
allow=ulaw
nat=yes
insecure=very
extensions.conf
[default]
exten => _XXXXXXXXXXXXXX,1,Dial(SIP/flowroute/${EXTEN})
;exten => _XXXXXXXXXXXXXX,2,Hangup
sip show users
loreen*CLI> sip show users
Username Secret Accountcode Def.Context ACL NAT
flowroute HIDDEN default No Always
sip show peers
loreen*CLI> sip show peers
Name/username Host Dyn Nat ACL Port Status
flowroute/74771200 85.17.214.227 N 5060 Unmonitored
1 sip peers [Monitored: 1 online, 0 offline Unmonitored: 0 online, 0 offline]
console dial EXTEN
loreen*CLI> console dial 00359891505054
[Jun 14 16:44:27] WARNING[14031]: chan_oss.c:486 setformat: Unable to re-open DSP device /dev/dsp: No such file or directory
[Jun 14 16:44:28] NOTICE[14031]: console_video.c:133 console_video_start: voice only, console video support not present
[Jun 14 16:44:28] WARNING[14033]: app_dial.c:1714 dial_exec_full: Skipping dialing interface 'SIP/flowroute/00359891505054' again since it has already been dialed
Unfortunately, Asterisk 1.6.2 was made end-of-life in april 2012, and it doesn't seem this feature is still supported, and using a sound card with Asterisk isn't the most common use-case.
Installing Asterisk from source is rather easy, and also rather clean (make uninstall will sufficiently clean it out). I highly recommend it, as it allows you to stay ahead of the game (with security and feature releases). Try it with ./configure and then make menuselect (you'll need ncurses libraries) for a really nice build interface.
While trying to test dial outbound calls on your SIP trunk (to test it's connectivity), I would recommend using the channel originate function at the CLI.
For help:
asterisk*CLI> core show help channel originate
A specific device and parameter string using your setup:
asterisk*CLI> channel originate SIP/flowroute/00359891505054 application Playback tt-monkeys
Note: This will play the sound of screaming monkeys to the called party!
Also -- if you're a smart phone user, it's rather convenient to have a softphone hooked up as an extension to test your trunks, new dialplans, etc. (Although I'll always do my initial tests with channel originate)
Lastly -- but equally importantly... I realize this is a test scenario, but... As you bring this forward; I'd avoid directly dialing your ITSP with the dialed extension from the [default] context. This could, if not otherwise configured properly, leave you open to toll-fraud via the fact that asterisk defaults call attempts to this context if the context is otherwise unknown.

Resources