Incoming calls don't work, why?


#1

Hi everyone,

This is the message that I have in my console CLI when I try to call my number (+32) 02 899 20 18 :

[Mar 19 14:55:08] NOTICE[10722]: res_pjsip_session.c:2142 new_invite: Call from 'belgium-voip-provider' (UDP:188.66.8.19:5060) to extension 's' rejected because extension not found in context 'from-belgium-voip'

This my extensions.conf file


#2

Please use text, not images, as it is not easy to search images. (When using images of screens, please use lossless formats.)

The message is quite clear. There is no extension s in the named context.

Most likely you are expecting the ITSP to send the called number as the user part of the URI, but they are either sending s, because that is what was in your register request, or not including a user part at all.


#3
[general]
static=yes
writeprotect=no
clearglobalvars=no


[globals]
CONSOLE=Console/dsp                             ; Console interface for demo
IAXINFO=guest                                   ; IAXtel username/password
TRUNK=DAHDI/G2                                  ; Trunk interface
TRUNKMSD=1                                      ; MSD digits to strip (usually 1 or 0)


[from-internal]
;======================================= Internal Calls between extensions
exten => _10X,1,NoOp(###### First Line ######)
same => n,Dial(PJSIP/${EXTEN})
same => n,VoiceMail(${EXTEN},u)
same => n,Hangup()


;======================================= Call to a extension 103
exten => 103,1,Answer()
same => n,Set(CHANNEL(language)=fr)
same => n,Wait(1)
same => n,Playback(hello-world)
same => n,Wait(1)
same => n,Playback(goodbye)
same => n,Hangup()


;======================================= Other numbers to outbound trunk
exten => _XXXX.,1,NoOp(####### [from-internal] ########)
same => n,Set(CALLERID(num)=042771412)
same => n,Dial(PJSIP/${EXTEN}@belgium-voip-provider)
same => n,Hangup()


exten => _XXXXXXXXX.,1,Dial(PJSIP/${EXTEN}@belgium-voip-provider)
same => n,Set(CALLERID(num)=042771412)
same => n,Dial(PJSIP/${EXTEN}@belgium-voip-provider)
same => n,Hangup()


exten => _XXXXXXXXXX.,1,Dial(PJSIP/${EXTEN}@belgium-voip-provider)
same => n,Set(CALLERID(num)=042771412)
same => n,Dial(PJSIP/${EXTEN}@belgium-voip-provider)
same => n,Hangup()


;====================================== All Incoming Calls
[from-belgium-voip]
exten => _028992018,1,NoOp(###### [from-belgium-voip] ######)
same => n,Dial(PJSIP/102,20)
same => n,Hangup()


#4

Hello,

Did you used command “dialplan reload” within Asterisk console once you added it? What does “dialplan show 028992018@from-belgium-voip” show?

Can you show console logs please?

Regards


#5

It’s not saying falling back to s, so I don’t think it is a case of the _028992018 not having taken.

However _028992018 seems pointless, as it is just a less efficient way of doing 028992018 If the OP really wanted a wildcard match on the initial digits, they would have needed to end the pattern with “.”.


#6

Hi everyone,

That I want is when I call the number (+32) 2 899 20 18 on my mobile, we have my extension 102 (Ip Phone) who ring. But I change the diaplan like you said to me @david551 :

root@IPBX-Asterisk:/etc/asterisk#
root@IPBX-Asterisk:/etc/asterisk# asterisk -r
Asterisk 13.19.2, Copyright (C) 1999 - 2014, 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 13.19.2 currently running on IPBX-Asterisk (pid = 1427)
IPBX-Asterisk*CLI> dialplan reload
Dialplan reloaded.
IPBX-Asterisk*CLI> pjsip reload
Module 'res_pjsip.so' reloaded successfully.
Module 'res_pjsip_authenticator_digest.so' reloaded successfully.
Module 'res_pjsip_endpoint_identifier_ip.so' reloaded successfully.
Module 'res_pjsip_mwi.so' reloaded successfully.
Module 'res_pjsip_notify.so' reloaded successfully.
Module 'res_pjsip_outbound_publish.so' reloaded successfully.
Module 'res_pjsip_publish_asterisk.so' reloaded successfully.
Module 'res_pjsip_outbound_registration.so' reloaded successfully.
[Mar 20 10:39:03] NOTICE[1804]: sorcery.c:1427 sorcery_object_load: Type 'system' is not reloadable, maintaining previous values
IPBX-Asterisk*CLI>

When I call the number since my mobile by typing the number (+32) 2 899 20 18, I have this message in the Asterisk Console CLI :

[Mar 20 10:39:50] NOTICE[1804]: res_pjsip_session.c:2142 new_invite: Call from 'belgium-voip-provider' (UDP:188.66.8.19:5060) to extension 's' rejected because extension not found in context 'from-belgium-voip'.
IPBX-Asterisk*CLI>

My extensions.conf :

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


[globals]
CONSOLE=Console/dsp                             ; Console interface for demo
IAXINFO=guest                                   ; IAXtel username/password
TRUNK=DAHDI/G2                                  ; Trunk interface
TRUNKMSD=1                                      ; MSD digits to strip (usually 1 or 0)


[from-internal]
;======================================= Internal Calls between extensions
exten => _10X,1,NoOp(###### First Line ######)
same => n,Dial(PJSIP/${EXTEN})
same => n,VoiceMail(${EXTEN},u)
same => n,Hangup()


;======================================= Call to a extension 103
exten => 103,1,Answer()
same => n,Set(CHANNEL(language)=fr)
same => n,Wait(1)
same => n,Playback(hello-world)
same => n,Wait(1)
same => n,Playback(goodbye)
same => n,Hangup()


;======================================= Other numbers to outbound trunk
exten => _XXXX,1,NoOp(####### [from-internal] ########)
same => n,Set(CALLERID(num)=042771412)
same => n,Dial(PJSIP/${EXTEN}@belgium-voip-provider)
same => n,Hangup()


exten => _XXXXXXXXX,1,Dial(PJSIP/${EXTEN}@belgium-voip-provider)
same => n,Set(CALLERID(num)=042771412)
same => n,Dial(PJSIP/${EXTEN}@belgium-voip-provider)
same => n,Hangup()


exten => _XXXXXXXXXX,1,Dial(PJSIP/${EXTEN}@belgium-voip-provider)
same => n,Set(CALLERID(num)=042771412)
same => n,Dial(PJSIP/${EXTEN}@belgium-voip-provider)
same => n,Hangup()

;====================================== All Incoming Calls
[from-belgium-voip]
exten => _028992018.,1,NoOp(## Incoming Call To Public Number 028992018 ##)
same => n,Dial(PJSIP/102,20)
same => n,Hangup()


#7

@dose this is what I have when I type “dialplan show form-belgium-voip” in the console CLI

IPBX-Asterisk*CLI> dialplan show from-belgium-voip
[ Context 'from-belgium-voip' created by 'pbx_config' ]
  '_028992018.' =>  1. NoOp(## Incoming Call To Public Number 028992018 ##) [pbx_config]
                    2. Dial(PJSIP/102,20)                         [pbx_config]
                    3. Hangup()                                   [pbx_config]

-= 1 extension (3 priorities) in 1 context. =-
IPBX-Asterisk*CLI>

#8

I have two numbers. One for my outbound route (042771412) and an other for the inbound route (028992018).
Do you think that I have to make two trunk registration for this two numbers ?


#9

Seeing the INVITE packet that came in would be helpful.

pjsip set logger on

As would seeing the definition of the endpoint and aor the call came in on.

pjsip show endpoint <endpoint>
pjsip show aor <aor>

#10

@gjoseph

PJSIP SET LOGGER ON

Connected to Asterisk 13.19.2 currently running on IPBX-Asterisk (pid = 1427)
IPBX-Asterisk*CLI> pjsip set logger on
PJSIP Logging enabled
<--- Transmitting SIP request (470 bytes) to UDP:188.66.8.19:5060 --->
OPTIONS sip:0427714121@voip.belgium-voip.com:5060 SIP/2.0
Via: SIP/2.0/UDP <public ip address>:5060;rport;branch=z9hG4bKPj60461e89-3841-4ea6-bb0d-691f017f1fee
From: <sip:042771412@voip.belgium-voip.com>;tag=e7eda557-7c96-482b-90aa-13d8700a8130
To: <sip:0427714121@voip.belgium-voip.com>
Contact: <sip:042771412@<public ip address>:5060>
Call-ID: d0f26684-488e-4dd7-b219-349ce56bde22
CSeq: 26591 OPTIONS
Max-Forwards: 70
User-Agent: Asterisk PBX 13.19.2
Content-Length:  0


<--- Received SIP response (428 bytes) from UDP:188.66.8.19:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP <public ip address>:5060;rport=41348;branch=z9hG4bKPj60461e89-3841-4ea6-bb0d-691f017f1fee;received=<public ip address>
From: <sip:042771412@voip.belgium-voip.com>;tag=e7eda557-7c96-482b-90aa-13d8700a8130
To: <sip:0427714121@voip.belgium-voip.com>;tag=6a4cc70e519e85e8bc5c654eeaf70770.e89b
Call-ID: d0f26684-488e-4dd7-b219-349ce56bde22
CSeq: 26591 OPTIONS
Server: Enswitch SIP proxy
Content-Length: 0


IPBX-Asterisk*CLI> pjsip set logger off
PJSIP Logging disabled
IPBX-Asterisk*CLI>

#11

Uhm. You need to have it turned on when you make your call. We need to see the incoming INVITE,


#12

@gjoseph like this :slight_smile:

Connected to Asterisk 13.19.2 currently running on IPBX-Asterisk (pid = 1427)
IPBX-Asterisk*CLI> pjsip set logger on
PJSIP Logging enabled
<--- Transmitting SIP request (470 bytes) to UDP:188.66.8.19:5060 --->
OPTIONS sip:0427714121@voip.belgium-voip.com:5060 SIP/2.0
Via: SIP/2.0/UDP 41.82.82.120:5060;rport;branch=z9hG4bKPj86f3c748-74de-490e-8be3-01e6db7b97e5
From: <sip:042771412@voip.belgium-voip.com>;tag=6b501f94-20b6-4510-9431-d8bd4fdc494f
To: <sip:0427714121@voip.belgium-voip.com>
Contact: <sip:042771412@<public ip address>:5060>
Call-ID: eee406fe-c22f-4659-8955-048b30f777fa
CSeq: 11109 OPTIONS
Max-Forwards: 70
User-Agent: Asterisk PBX 13.19.2
Content-Length:  0


<--- Received SIP response (428 bytes) from UDP:188.66.8.19:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP <public ip address>:5060;rport=41348;branch=z9hG4bKPj86f3c748-74de-490e-8be3-01e6db7b97e5;received=<public ip address>
From: <sip:042771412@voip.belgium-voip.com>;tag=6b501f94-20b6-4510-9431-d8bd4fdc494f
To: <sip:0427714121@voip.belgium-voip.com>;tag=6a4cc70e519e85e8bc5c654eeaf70770.5c9f
Call-ID: eee406fe-c22f-4659-8955-048b30f777fa
CSeq: 11109 OPTIONS
Server: Enswitch SIP proxy
Content-Length: 0


<--- Received SIP request (1304 bytes) from UDP:188.66.8.19:5060 --->
INVITE sip:s@<public ip address>:5060 SIP/2.0
Record-Route: <sip:188.66.8.19;lr=on>
Via: SIP/2.0/UDP 188.66.8.19;branch=z9hG4bKa8b6.01df0cde661ff64db3adc37a355adc59.0
Via: SIP/2.0/UDP 188.66.8.30:5060;received=188.66.8.30;branch=z9hG4bK13934cda;rport=5060
Max-Forwards: 69
From: "221705237773" <sip:0221705237773@188.66.8.30>;tag=as46520cb1
To: <sip:0427714121@188.66.8.19:5060>
Contact: <sip:0221705237773@188.66.8.30:5060>
Call-ID: 3516fc220131720d36a58d93662ee517@188.66.8.30:5060
CSeq: 102 INVITE
User-Agent: 3StarsNet VoipSwitch
Date: Tue, 20 Mar 2018 12:27:59 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
X-Enswitch-Uniqueid: 1521548879.092459
Diversion: <sip:028992018@ast24>
Content-Type: application/sdp
Content-Length: 368
X-Enswitch-RURI: sip:0427714121@188.66.8.19:5060
X-Enswitch-Source: 188.66.8.30:5060
X-Enswitch-External: yes

v=0
o=root 447387213 447387213 IN IP4 188.66.8.27
s=3StarsNet VoipSwitch
c=IN IP4 188.66.8.27
t=0 0
m=audio 14586 RTP/AVP 8 0 18 3 9 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:3 GSM/8000
a=rtpmap:9 G722/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
a=sdpmangled:yes

[Mar 20 12:27:57] NOTICE[38253]: res_pjsip_session.c:2142 new_invite: Call from 'belgium-voip-provider' (UDP:188.66.8.19:5060) to extension 's' rejected because extension not found in context 'from-belgium-voip'.
<--- Transmitting SIP response (544 bytes) to UDP:188.66.8.19:5060 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 188.66.8.19;rport=5060;received=188.66.8.19;branch=z9hG4bKa8b6.01df0cde661ff64db3adc37a355adc59.0
Via: SIP/2.0/UDP 188.66.8.30:5060;rport=5060;received=188.66.8.30;branch=z9hG4bK13934cda
Record-Route: <sip:188.66.8.19:5060;lr>
Call-ID: 3516fc220131720d36a58d93662ee517@188.66.8.30:5060
From: "221705237773" <sip:0221705237773@188.66.8.30>;tag=as46520cb1
To: <sip:0427714121@188.66.8.19>;tag=9c87d5c3-f33f-4326-86fb-27e486ad5e63
CSeq: 102 INVITE
Server: Asterisk PBX 13.19.2
Content-Length:  0


<--- Received SIP request (379 bytes) from UDP:188.66.8.19:5060 --->
ACK sip:s@<public ip address>:5060 SIP/2.0
Via: SIP/2.0/UDP 188.66.8.19;branch=z9hG4bKa8b6.01df0cde661ff64db3adc37a355adc59.0
Max-Forwards: 69
From: "221705237773" <sip:0221705237773@188.66.8.30>;tag=as46520cb1
To: <sip:0427714121@188.66.8.19>;tag=9c87d5c3-f33f-4326-86fb-27e486ad5e63
Call-ID: 3516fc220131720d36a58d93662ee517@188.66.8.30:5060
CSeq: 102 ACK
Content-Length: 0


IPBX-Asterisk*CLI> pjsip set logger off
PJSIP Logging disabled
IPBX-Asterisk*CLI>

#13

That’s why the call is going to the “s” extension. It’s where the ITSP is telling it to go.
You could examine the To header in your dialplan and route it that way if you can’t get the ITSP to properly set the user part of the request uri.


#14

So, I have to change what part of my extensions.conf file ? Because I don’t really understand… :sweat_smile:


#15

@gjoseph Endpoint and AOR for belgium-voip-provider I use now:

IPBX-Asterisk*CLI> pjsip show endpoint belgium-voip-provider

 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri..........................> <Hash....> <Status> <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <criteria.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time.....>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
==========================================================================================

 Endpoint:  belgium-voip-provider/042771412                      Not in use    0 of inf
    OutAuth:  belgium-voip-provider-auth/0427714121
        Aor:  belgium-voip-provider                              0
      Contact:  belgium-voip-provider/sip:0427714121@voip. 14fa9184d9 Avail        96.111
   Identify:  belgium-voip-provider/belgium-voip-provider
        Match: 188.66.8.19/32


 ParameterName                      : ParameterValue
 ===============================================================
 100rel                             : yes
 accountcode                        :
 acl                                :
 aggregate_mwi                      : true
 allow                              : (ulaw|alaw|gsm|g722|g729)
 allow_overlap                      : true
 allow_subscribe                    : true
 allow_transfer                     : true
 aors                               : belgium-voip-provider
 asymmetric_rtp_codec               : false
 auth                               :
 bind_rtp_to_media_address          : false
 call_group                         :
 callerid                           : 042771412
 callerid_privacy                   : allowed_not_screened
 callerid_tag                       :
 connected_line_method              : invite
 contact_acl                        :
 context                            : from-belgium-voip
 cos_audio                          : 0
 cos_video                          : 0
 device_state_busy_at               : 0
 direct_media                       : true
 direct_media_glare_mitigation      : none
 direct_media_method                : invite
 disable_direct_media_on_nat        : false
 dtls_ca_file                       :
 dtls_ca_path                       :
 dtls_cert_file                     :
 dtls_cipher                        :
 dtls_fingerprint                   : SHA-256
 dtls_private_key                   :
 dtls_rekey                         : 0
 dtls_setup                         : active
 dtls_verify                        : No
 dtmf_mode                          : rfc4733
 fax_detect                         : false
 fax_detect_timeout                 : 0
 force_avp                          : false
 force_rport                        : true
 from_domain                        : voip.belgium-voip.com
 from_user                          : 042771412
 g726_non_standard                  : false
 ice_support                        : false
 identify_by                        : username,ip
 inband_progress                    : false
 incoming_mwi_mailbox               :
 language                           :
 mailboxes                          :
 media_address                      :
 media_encryption                   : no
 media_encryption_optimistic        : false
 media_use_received_transport       : false
 message_context                    :
 moh_suggest                        : default
 mwi_from_user                      :
 mwi_subscribe_replaces_unsolicited : false
 named_call_group                   :
 named_pickup_group                 :
 notify_early_inuse_ringing         : false
 one_touch_recording                : false
 outbound_auth                      : belgium-voip-provider-auth
 outbound_proxy                     :
 pickup_group                       :
 record_off_feature                 : automixmon
 record_on_feature                  : automixmon
 refer_blind_progress               : true
 rewrite_contact                    : true
 rpid_immediate                     : false
 rtcp_mux                           : false
 rtp_engine                         : asterisk
 rtp_ipv6                           : false
 rtp_keepalive                      : 0
 rtp_symmetric                      : true
 rtp_timeout                        : 0
 rtp_timeout_hold                   : 0
 sdp_owner                          : -
 sdp_session                        : Asterisk
 send_diversion                     : true
 send_pai                           : false
 send_rpid                          : false
 set_var                            :
 srtp_tag_32                        : false
 sub_min_expiry                     : 0
 subscribe_context                  :
 t38_udptl                          : false
 t38_udptl_ec                       : none
 t38_udptl_ipv6                     : false
 t38_udptl_maxdatagram              : 0
 t38_udptl_nat                      : false
 timers                             : yes
 timers_min_se                      : 90
 timers_sess_expires                : 1800
 tone_zone                          :
 tos_audio                          : 0
 tos_video                          : 0
 transport                          :
 trust_id_inbound                   : false
 trust_id_outbound                  : false
 use_avpf                           : false
 use_ptime                          : false
 user_eq_phone                      : false
 voicemail_extension                :

IPBX-Asterisk*CLI> pjsip show aor belgium-voip-provider

      Aor:  <Aor..............................................>  <MaxContact>
    Contact:  <Aor/ContactUri............................> <Hash....> <Status> <RTT(ms)..>
==========================================================================================

      Aor:  belgium-voip-provider                                0
    Contact:  belgium-voip-provider/sip:0427714121@voip.be 14fa9184d9 Avail        99.882


 ParameterName        : ParameterValue
 ================================================================
 authenticate_qualify : false
 contact              : sip:0427714121@voip.belgium-voip.com:5060
 default_expiration   : 3600
 mailboxes            :
 max_contacts         : 0
 maximum_expiration   : 7200
 minimum_expiration   : 60
 outbound_proxy       :
 qualify_frequency    : 60
 qualify_timeout      : 3.000000
 remove_existing      : false
 support_path         : false
 voicemail_extension  :

IPBX-Asterisk*CLI>

#16

Try adding a new extension s in from-belgium-voip
Here’s the example (not optimized)
[from-belgium-voip]
exten => _028992018.,1,NoOp(## Incoming Call To Public Number 028992018 ##)
same => n,Dial(PJSIP/102,20)
same => n,Hangup()

exten => s,1,NoOp(## Incoming Call To Public Number 028992018 ##)
same => n,Dial(PJSIP/102,20)


#17

The user part of the request uri in the INVITE is how calls are mapped to extensions.conf. Since it’s being set to “s” by your ITSP, and assuming the ITSP’s endpoint/context parameter is set to from-belgium-voip, Asterisk is looking for an extension named “s” in from-belgium-voip and not finding it. There’s nothing special about the “s” in this case. It just happens to be what the ITSP is sending. So you need to create an extension for “s” in your context then to route it further, you’ll need to examine the To header to get the real number.

[from-belgium-voip]
exten = s,1,NoOp(...)
 same = n,Set(TO_HEADER=PJSIP_HEADER(read,To))
...use other functions to get the user part of the uri and set REAL_EXTEN to it.
 same = n,GoTo(${REAL_EXTEN},1)
exten = '_028992018.',1,NoOp(...)
...etc...

#18

This is work well, But I have a question about the ‘s’ @gjoseph

So I can optimize the “s” to be enable to catch many extensions at the same time, or one extension to other if one of them don’t respond ?


#19

Sure, you can do anything you want with it as long as you can get the data from the incoming INVITE.


#20

Thanks @everyone for your help.