Inbound calls is always anonymous

Hi Asterisk lovers!!

I have installed asterisk 11.2 a few weeks ago on our new Redhat Enterprise server.
We have a also a Patton SmartNode 4112 connected for our landline. At this moment we only use 1 FXO port.

Everything is working fine like CDR to mysql, make calls internally, make outbound calls. Also all the calls are being recorded. We can make a call using our erp-php program.

But when someone is calling to our landline that is connected to patton. Then asterisk gives us this message :
chan_sip.c:25184 handle_request_invite: Call from ‘anonymous’ (192.168.1.192:5060) to extension ‘anonymous’ rejected because extension not found in context ‘anonymous’.

I have been working on this for few days now without succes.
Below i have posted my config files.

Who knows what the problem can be?

SIP.CONF

[general]
port=5060
bindaddr=0.0.0.0
context=incoming
externip=xxxxxxxxxxxx
nat=force_rport,comedia
localnet=192.168.1.0/255.255.255.0
allowguest=yes
insecure=port,invite

[1000]
type=friend
context=phones
host=dynamic
secret=xxxx

[2000]
type=friend
context=phones
host=dynamic
secret=xxxx

[3000]
type=friend
context=phones
host=dynamic
secret=xxxx

[4000]
type=friend
context=phones
host=dynamic
secret=xxxx

[5000]
type=friend
context=phones
host=dynamic
secret=xxxx

[6000]
type=friend
context=phones
host=dynamic
secret=xxxx

[fxo1]
type=peer
context=incoming
host=dynamic
secret=xxx
insecure=port,invite
canreinvite=no
disallow=all
allow=alaw
allow=ulaw
allowexternaldomains=yes
allowguest=yes

[fxo2]
type=friend
context=incoming
host=dynamic
secret=fxo2
insecure=port,invite

[anonymous]
type=user
host=192.168.1.192
secret=xxxx
context=anonymous
insecure=port,invite
allowguest=yes

EXTENSIONS.CONF

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

[globals]
OUTBOUND=SIP/fxo1

[phones]
include => outgoing
include => incoming

exten => 1000,1,MixMonitor(${EXTEN}_${UNIQUEID}.wav)
exten => 1000,n,Dial(SIP/1000)
exten => 2000,1,MixMonitor(${EXTEN}_${UNIQUEID}.wav)
exten => 2000,n,Dial(SIP/2000)
exten => 2000,n,Background(main-menu)
exten => 2000,n,WaitExten()
exten => 1,1,Playback(digits/1)
exten => 2,1,Playback(digits/2)
exten => 3000,1,MixMonitor(${EXTEN}_${UNIQUEID}.wav)
exten => 3000,n,Dial(SIP/3000)
exten => 4000,1,MixMonitor(${EXTEN}_${UNIQUEID}.wav)
exten => 4000,n,Dial(SIP/4000)
exten => 5000,1,MixMonitor(${EXTEN}_${UNIQUEID}.wav)
exten => 5000,n,Dial(SIP/5000)
exten => 6000,1,MixMonitor(${EXTEN}_${UNIQUEID}.wav)
exten => 6000,n,Dial(SIP/6000)

[incoming]
exten => s,1,Answer()
exten => s,n,Dial(SIP/2000)

[outgoing]
exten => _X.,1,MixMonitor(${EXTEN}_${UNIQUEID}.wav)
exten => _X.,n,Dial(${OUTBOUND}/${EXTEN})

PATTON CONFIG

cli version 3.20
dns-client server 192.168.1.50
dns-client server 192.168.1.99
dns-relay
webserver port 80 language en

system

  ic voice 0
    low-bitrate-codec g729

profile ppp default

profile tone-set default

profile voip default
  codec 1 g711alaw64k rx-length 20 tx-length 20
  codec 2 g711ulaw64k rx-length 20 tx-length 20

profile pstn default

profile sip default

profile aaa default
  method 1 local
  method 2 none

context ip router

  interface LAN
    ipaddress 192.168.1.192 255.255.255.0
    tcp adjust-mss rx mtu
    tcp adjust-mss tx mtu

context ip router
  route 0.0.0.0 0.0.0.0 192.168.x.xx 0

context cs switch
  national-prefix 0
  international-prefix 00

  interface fxo IF-FXO-1
    route call dest-interface IF-SIP-1
    disconnect-signal loop-break
    ring-number 3
    dial-after timeout 2

  interface sip IF-SIP-1
    bind context sip-gateway GW_PATTON_1
    route call dest-interface IF-FXO-1
    remote 192.168.x.xx 5060
    early-disconnect

context cs switch
  no shutdown

authentication-service AUTH_ASTERISK
  username fxo1 password xxxx
  username fxo2 password xxxx

location-service LOC_SERV_ASTERISK_1
  domain 1 192.168.1.50

  identity fxo1

    authentication outbound
      authenticate 1 authentication-service AUTH_ASTERISK username fxo1

    registration outbound
      registrar 192.168.1.50 5060
      lifetime 60
      register auto
      retry-timeout on-system-error 10
      retry-timeout on-client-error 10
      retry-timeout on-server-error 10

location-service LOC_SERV_ASTERISK_2
  domain 1 192.168.1.50

  identity fxo2

    authentication outbound
      authenticate 1 authentication-service AUTH_ASTERISK username fxo2

    registration outbound
      registrar 192.168.1.50 5060
      lifetime 60
      register auto
      retry-timeout on-system-error 10
      retry-timeout on-client-error 10
      retry-timeout on-server-error 10

context sip-gateway GW_PATTON_1

  interface IF_GW_SIP_ASTERISK_1
    bind interface LAN context router port 5060

context sip-gateway GW_PATTON_1
  bind location-service LOC_SERV_ASTERISK_1
  no shutdown

context sip-gateway GW_PATTON_2

  interface IF_GW_SIP_ASTERISK_2
    bind interface LAN context router port 5062

context sip-gateway GW_PATTON_2
  bind location-service LOC_SERV_ASTERISK_2
  no shutdown

port ethernet 0 0
  medium auto
  encapsulation ip
  bind interface LAN router
  no shutdown

port fxo 0 0
  caller-id format bell
  encapsulation cc-fxo
  bind interface IF-FXO-1 switch
  no shutdown

What is the anonymous section trying to achieve? What is at 192.168.1.192?

Note, you almost certainly don’t want allowguest=yes, and it is meaningless outside the general section (it is only used when no section matches!).

insecure=invite is not wise when using host=dynamic. If they need to register, they should know the password! Hardly anyone needs insecure=port.

Is there any specific reason for setting nat= options; most people don’t need them.

Hey David55

Don’t mind the anonymous section, it was something i was testing with.

At …192 there is the patton smartnode 4112.

Thank you for your comments, but those are the things that i have been trying… to receive incoming calls. Everything was working fine also with those options you are mentioning.

Do you have any idea why i get these message?

I cannot see the incoming callerid, i think that is the problem for this incoming call thing…

Because of your anonymous section.

I don’t know why the extension is also “anonymous”, but a From of anonymous will produce the rest of that message, because it will match the anonymous section.

Things will probably b e clearer if you turn on sip debugging.

Hi David,

I have removed the anonymous section and now the error for inbound call is :

[Jan 30 12:02:34] NOTICE[28879][C-00000000]: chan_sip.c:25184 handle_request_invite: Call from 'fxo1' (192.168.1.192:5060) to extension 'anonymous' rejected because extension not found in context 'incoming'.

Subject to seeing the sip packet itself, the message is telling you what is wrong. The peer is sending:

INVITE anonymous@…

but you have no extension matching anonymous in your incoming context.

Why it is sending anonymous is not an Asterisk problem. If it is correctly sending anonymous, change the s to anonymous. If it is erroneosly sending it, fix it.

Patton SmartNode sends anonymus@… because it does not get CalledID on FXO line. You can also see this on the Patton SmartNode debugs (it has very good debugs for these kind of things).

This isn’t a caller ID issue. The call is failing because the destination address is anonymous, not because the source one is. Asterisk expects there to be no user part in that case, but if there is a user part of anonymous, one simply has to match that in extensions.conf.

My post was refering to the Patton SmartNode side. If you re-read the post, you will see that I was saying that Patton SmartNode is not receiving Called ID from the FXO line (not Caller ID - it’s probably not receiving that also, but that is not the problem we are talking about).

David already pointed out a solution for this problem on Asterisk side. I would just say that perhaps something can be done on the Patton SmartNode side, so it receives the Called ID successfully.

Hello David, Dejans

David : I want to let you know that inbound calls are working now when i change s to anonymous.

Dejans : You are also correct, the problem is somewhere in the patton config.

I’m trying to figure out was is going wrong. I live in belgium and i have etsi selected.

Maybe you have a suggestion?

I know Patton SmartNode configs really well and I know that they are quite complex to set up. I don’t know how experienced are you in configuring these gateways.

But the first thing is to talk with your telephony provider about the line parameters they have (so you can set up line parameters on Patton SmartNode accordingly). But on the other hand - if calls work as expected, why bother with Called ID.

If only Called ID bothers you, you can configure your Patton SmartNode to correct the Called ID before the call is sent to Asterisk. You can do that with mapping-table.