Asterisk unintentionally transferring calls to unknown numbers

Dear all,
first post here, hello everyone!

I’ve got a simple Asterisk setup to basically play a Lenny installation on my VoIP number. Everything works as intended only for a few moments after a reload or Asterisk restart. Shortly after, if I call my number the incoming call is diverted to some other (unknown, not always the same) number.
I cannot find any sign of this transfer in my Asterisk logs and I do not see (with tcpdump) any incoming SIP traffic when I perform the second call.
I suspect some issue on the provider side but

  1. it’s a major italian ISP if I stop my Asterisk instance I get the “temporary unavailable message” every single time I call my number hence the defect seems to be present only when Asterisk is active.
    Any clue?

Here are my configs:

Asterisk 13.14.1~dfsg-2+deb9u4

sip.conf:

[general]
context=public                  ; Default context for incoming calls. Defaults to 'default'
allowoverlap=no                 ; Disable overlap dialing support. (Default is yes)
udpbindaddr=0.0.0.0:5060             ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
transport=udp                   ; Set the default transports.  The order determines the primary default transport.
srvlookup=yes
localnet=192.168.1.0/255.255.255.0      ; Also RFC1918
externaddr = my.internet.address:5060 ; UDP on this port is sent to my Asterisk box by my router

register => +mynum@"telecomitalia.it:5060":mypass:+mynum@out.bound.proxy:5060

[timfibra]
context=default
username=+mynum
type=peer
secret=mypass
qualify=yes
outboundproxy=out.bound.proxy
insecure=invite
dtmfmode=rfc2833
host=telecomitalia.it
fromuser=+mynum
formdomain=telecomitalia.it
callreinvite=no
directrtpsetup=no
directmedia=no
extensions.conf:

[default]

exten => s,1,Noop()
same => n,Answer()
same => n,WaitExten(2)

exten => t,1,Set(i=1)
same => n,Playback(Lenny/Daniele1)
same => n,BackgroundDetect(Lenny/backgroundnoise,1000)

exten => talk,1,Set(i=${IF($["0${i}"="016"]?7:$[0${i}+1])})
same => n,Playback(Lenny/Daniele${i})
same => n,BackgroundDetect(Lenny/backgroundnoise,1000)

exten => secretnum,1,Wait(1) ;this is used to record audio files
same => n,Record(Lenny/Daniele.ulaw)
same => n,Wait(1)
same => n,Playback(${RECORDED_FILE})
same => n,Hungup()

Any help would be really much appreciated, I have no clue what I’ve done to mess this up.

Thanks in advance,
Daniele

You have provided no logs

Which log could be useful?

I started my Asterisk this morning at 09:52 these are the tcpdump lines:
09:52:37.920154 IP ip.sip > telecomitalia.it.sip: SIP: REGISTER sip:telecomitalia.it:5060 SIP/2.0
09:52:38.158058 IP telecomitalia.it.sip > ip.sip: SIP: SIP/2.0 401 Unauthorized 1103023033C
09:52:38.158857 IP ip.sip > telecomitalia.it.sip: SIP: REGISTER sip:telecomitalia.it:5060 SIP/2.0
09:52:38.349021 IP telecomitalia.it.sip > ip.sip: SIP: SIP/2.0 200 OK

I tried to call my landline number shortly after but there is no incoming packet.

This is the message.log:

[2019-04-19 09:52:22] Asterisk 13.14.1~dfsg-2+deb9u4 built by buildd @ testbuildd on a armv7l running Linux on 2018-10-16 23:52:28 UTC
[2019-04-19 09:52:23] NOTICE[13910] cdr.c: CDR simple logging enabled.
[2019-04-19 09:52:24] NOTICE[13910] loader.c: 314 modules will be loaded.
[2019-04-19 09:52:27] NOTICE[13910] res_odbc.c: res_odbc loaded.
[2019-04-19 09:52:32] WARNING[13910] res_phoneprov.c: Unable to find a valid server address or name.
[2019-04-19 09:52:32] ERROR[13910] res_phoneprov.c: Unable to load users.conf
[2019-04-19 09:52:32] WARNING[13910] res_phoneprov.c: Unable to load default variables.
[2019-04-19 09:52:32] ERROR[13910] res_phoneprov.c: Unable to load provider 'sipusers' users. Register aborted.
[2019-04-19 09:52:32] WARNING[13910] res_phoneprov.c: Unable register sip/users config provider.  Others may succeed.
[2019-04-19 09:52:34] ERROR[13910] ari/config.c: No configured users for ARI
[2019-04-19 09:52:34] ERROR[13910] pbx_lua.c: Error loading extensions.lua: cannot open '/etc/asterisk/extensions.lua' for reading: No such file or directory
[2019-04-19 09:52:37] ERROR[13910] config_options.c: Unable to load config file 'res_parking.conf'
[2019-04-19 09:52:37] NOTICE[13910] res_config_ldap.c: No directory user found, anonymous binding as default.
[2019-04-19 09:52:37] ERROR[13910] res_config_ldap.c: No directory URL or host found.
[2019-04-19 09:52:37] ERROR[13910] res_config_ldap.c: Cannot load LDAP RealTime driver.
[2019-04-19 09:52:37] ERROR[13910] chan_iax2.c: Unable to load config iax.conf
[2019-04-19 09:52:37] NOTICE[13910] chan_sip.c: The 'username' field for sip peers has been deprecated in favor of the term 'defaultuser'
[2019-04-19 09:52:38] NOTICE[13910] chan_skinny.c: Configuring skinny from skinny.conf
[2019-04-19 09:52:39] NOTICE[13910] confbridge/conf_config_parser.c: Adding default_menu menu to app_confbridge
[2019-04-19 09:52:40] NOTICE[13910] cdr_pgsql.c: cdr_pgsql configuration contains no global section, skipping module load.
[2019-04-19 09:52:40] WARNING[13910] cel_pgsql.c: CEL pgsql config file missing global section.
[2019-04-19 09:52:40] NOTICE[13910] cel_tds.c: cel_tds has no global category, nothing to configure.
[2019-04-19 09:52:40] WARNING[13910] cel_tds.c: cel_tds module had config problems; declining load
[2019-04-19 09:52:40] NOTICE[13910] cel_radius.c: Cannot load radiusclient-ng configuration file /etc/radiusclient-ng/radiusclient.conf.
[2019-04-19 09:52:40] NOTICE[13910] cdr_radius.c: Cannot load radiusclient-ng configuration file /etc/radiusclient-ng/radiusclient.conf.
[2019-04-19 09:52:40] NOTICE[13910] cel_custom.c: No mappings found in cel_custom.conf. Not logging CEL to custom CSVs.
[2019-04-19 09:52:40] WARNING[13910] channel.c: Already have a handler for type 'Console'
[2019-04-19 09:52:40] ERROR[13910] chan_oss.c: Unable to register channel type 'OSS'
[2019-04-19 09:52:40] NOTICE[13910] pbx_ael.c: File /etc/asterisk/extensions.ael not found; AEL declining load

The only other updated log is queuelog.

Anything else could be useful?

sip show peers
Name/username             Host                                    Dyn Forcerport Comedia    ACL Port     Status      Description
timfibra/myphonenum    correct.ip.address                                Auto (No)  No             5060     Unmonitored
1 sip peers [Monitored: 0 online, 0 offline Unmonitored: 1 online, 0 offline]

The log shows now calls arriving, so either your logging level is inadequate or things are going wrong before they reach Asterisk.

The Asterisk logs don’t even show the REGISTER.

These are the relevant lines in logger.conf:

console => notice,warning,error
messages => security,notice,warning,error

How do you suggest to improve?

Thanks,
Daniele

Uncomment full and set verbosity and debug levels. Enable the protocol logging for your SIP channel driver.

https://wiki.asterisk.org/wiki/display/AST/Collecting+Debug+Information

Thanks for your time answering.

I set up logging and here is the full.log

I made two calls from my mobile device to the number, both correctly answered, then a third one, for which I find no line in the log.

I added a mixmonitor to the dial plan and moved the contest to TIM.

I also tried switching Asterisk off, and configuring the number on my Fritz!BOX and there I have no problem at all, every call is answered by the modem.

Ciao,
dan

I still have no idea what’s going on.

Today I made a test: fired up Asterisk, placed a test call from my mobile and saw this:
[2019-04-23 11:49:06] NOTICE[18290][C-00000000] chan_sip.c: Call from ‘+my.voip.num’ (my.external.ip:5060) to extension ‘+my.voip.num’ rejected because extension not found in context ‘TIM’.

the call was ringing but I had no other log in Asterisk. I hung up and got recalled shortly after by an unknown number (kind of similar to my voip number) asking about why I called. It seems like my call was routed to another customer after the fail above. I changed my dialplan like this:

exten => +my.voip.num,1,Noop(Estensione numero)
same => n,Playback(Lenny/Daniele1)
same => n,Hungup()

exten => s,1,Noop(Estensione s)
same => n,Answer()
same => n,WaitExten(2)

But it seems that I’m always going to exten => s,1,Noop(Estensione s)

Better ideas?

There are two incoming calls in your full log. Both were addressed to extension “s” (which is what I would expect to see in the error message). Both were answered by Asterisk and then cleared by the upstream system.

There were no outgoing calls, and no attempt by Asterisk to redirect the incoming call. As such the transferring aspect is not the result of anything that Asterisk did.

The configuration supplied does not indicate any reason for the call to be interpreted in anything but the default context, but that is clearly not what is happening.

The log verbosity is not sufficient to establish how this was handled by the dialplan.

I though I found the problem but it’s not the case.

I cleared all call diverts with my provider and things worked for about half an hour or so. After some time everything is back to not working.

There are two things driving me crazy:

  1. Configuring the VoIP number on my Fritz!BOX works perfectly. Hence the problem is caused by some Asterisk related stuff
  2. Sometimes the call is answered by the s extension, other times it’s the +my.voip.num extension. How can this be?

Thanks,
dan

Because sometimes the provider sends it to one, and sometimes to the other.

1 Like

Is there any sensible reason to do different from time to time?

Not that I know of, as, if the registration had expired, it wouldn’t know which machine to send to not just which use.

I’m assuming you haven’t got two registrations configured.

There is absolutely no configuration possible on the provider side and I have only one registration in my asterisk setup.
I’m now using my FritzBOX to register to the provider and Asterisk is then registered to the Fritzbox. It works but I find it very ugly.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.