Call automatically discounting after few seconds

Hi all,

I am using an Asterisk server that is receiving calls from a Twilio SIP trunk and dialing to my Twilio SIP domain.

Under the SIP domain, I have Twilio webhooks to connect the caller with the Twilio client app.

The issue is that the call starts and goes to the Twilio SIP domain, and the Twilio client app connects with the caller. However, the call disconnects after a few seconds automatically. Sometimes it disconnects after 5 seconds, and sometimes it disconnects after 1 minute, randomly.

In PJSIP, I have the following configuration:
[general]
bindaddr=0.0.0.0
bindport=5060
udpbindaddr=0.0.0.0:5060
externip=my_server_sip
listen=0.0.0.0:5060
nat=yes
localnet=my_server_sip/24

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
external_media_address=my_server_sip
external_signaling_address=my_server_sip
local_net=my_server_sip/24

[twilio0-aors]
type=aor
contact=sip:mytwiliosip.sip.twilio.com:5060

twilio-trunks
type=endpoint
transport=transport-udp
context=from-twilio
allow=ulaw
allow=alaw

twilio0
aors=twilio0-aors
outbound_auth=twilio0-auth

[twilio0-auth]
type=auth
auth_type=userpass
password=password
username=username

[twilio0-ident]
type=identify
endpoint=twilio0
match=54.172.60.0
match=54.172.60.1
match=54.172.60.2
match=54.172.60.3

And in the extensions:
[from-twilio]
exten => SIP_TRUNK_NUMBER,1,NoOp(Call received from Twilio for SIP_TRUNK_NUMBER)
exten => SIP_TRUNK_NUMBER,n,NoOp(Forwarding to Twilio SIP domain aivibackup)
exten => SIP_TRUNK_NUMBER,n,Dial(PJSIP/twilio0) ; Forward the call to Twilio SIP domain
exten => SIP_TRUNK_NUMBER,n,NoOp(Call to Twilio SIP domain ended)

You need to provide a SIP trace.

Thanks for you reply
please check this Context – share whatever you see with others in seconds

The above are undefined.

I haven’t heard of the following one, but can’t say, definitively, that it is wrong:

You should always start with disallow.

There are no dialled digits, but Twilio is a PSTN provider. How are they expected to know where to send the call?

This will not be reached for a successful call, so should be reworded as …failed, not …ended, or the Dial option to continue after the callee hangs up should be added, and a hangup handler added to cope with the caller hanging up.

Paste expired or not found. Create your own Context here.

root@crazy-fermat:~# tail -f /var/log/asterisk/messages

[Jan 6 18:23:31] WARNING[381019] loader.c: Module ‘app_adsiprog’ has been loaded but may be removed in a future release.

[Jan 6 18:23:31] WARNING[381019] loader.c: Module ‘app_getcpeid’ has been loaded but may be removed in a future release.

[Jan 6 18:23:31] ERROR[381019] loader.c: cel_tds declined to load.

[Jan 6 18:23:31] ERROR[381019] loader.c: cel_radius declined to load.

[Jan 6 18:23:31] ERROR[381019] loader.c: cdr_tds declined to load.

[Jan 6 18:23:31] ERROR[381019] loader.c: cdr_radius declined to load.

[Jan 6 18:23:31] ERROR[381019] loader.c: cdr_sqlite3_custom declined to load.

[Jan 6 18:23:31] ERROR[381019] loader.c: cel_sqlite3_custom declined to load.

[Jan 6 18:23:31] WARNING[381023] pbx_config.c: users.conf is deprecated and will be removed in a future version of Asterisk

[Jan 6 18:23:31] VERBOSE[381019] asterisk.c: Asterisk Ready.

[Jan 6 18:23:47] NOTICE[381046] res_pjsip/pjsip_distributor.c: Request ‘INVITE’ from ‘sip:my_sip_trunk_number@pstn.twilio.com’ failed for ‘54.244.51.2:5060’ (callid: a382268ba599bb2a8238de047adeb18a@0.0.0.0) - No matching endpoint found

AFTER CALL ENDED

[Jan 6 18:25:02] VERBOSE[381019] asterisk.c: Asterisk cleanly ending (0).

[Jan 6 18:25:02] VERBOSE[381019] asterisk.c: Executing last minute cleanups

[Jan 6 18:25:03] Asterisk 22.1.0 built by root @ crazy-fermat.SERVERIP.SERVER.page on a x86_64 running Linux on 2025-01-02 18:54:24 UTC

[Jan 6 18:25:03] NOTICE[381116] loader.c: 338 modules will be loaded.

[Jan 6 18:25:03] NOTICE[381116] res_config_ldap.c: No directory user found, anonymous binding as default.

[Jan 6 18:25:03] ERROR[381116] res_config_ldap.c: No directory URL or host found.

[Jan 6 18:25:03] ERROR[381116] res_config_ldap.c: Cannot load LDAP RealTime driver.

[Jan 6 18:25:03] NOTICE[381116] cdr.c: CDR simple logging enabled.

[Jan 6 18:25:03] NOTICE[381116] indications.c: Default country for indication tones: us

[Jan 6 18:25:03] NOTICE[381116] indications.c: Setting default indication country to ‘us’

[Jan 6 18:25:03] DEBUG[381116] res_pjsip/config_transport.c: TCP Keepalive enabled for transport ‘transport-tls’. Idle Time: 30, Interval: 1, Count: 5

[Jan 6 18:25:03] NOTICE[381116] res_smdi.c: No SMDI interfaces are available to listen on, not starting SMDI listener.

[Jan 6 18:25:03] WARNING[381116] res_phoneprov.c: Unable to find a valid server address or name.

[Jan 6 18:25:03] ERROR[381116] ari/config.c: No configured users for ARI

[Jan 6 18:25:03] NOTICE[381116] confbridge/conf_config_parser.c: Adding default_menu menu to app_confbridge

[Jan 6 18:25:03] NOTICE[381116] cel_tds.c: cel_tds has no global category, nothing to configure.

[Jan 6 18:25:03] WARNING[381116] cel_tds.c: cel_tds module had config problems; declining load

[Jan 6 18:25:03] NOTICE[381116] cel_radius.c: Cannot load radiusclient-ng configuration file /etc/radiusclient-ng/radiusclient.conf.

[Jan 6 18:25:03] NOTICE[381116] cel_custom.c: No mappings found in cel_custom.conf. Not logging CEL to custom CSVs.

[Jan 6 18:25:03] NOTICE[381116] cdr_radius.c: Cannot load radiusclient-ng configuration file /etc/radiusclient-ng/radiusclient.conf.

[Jan 6 18:25:03] WARNING[381116] ael/pval.c: Warning: file /etc/asterisk/extensions.ael, line 196-196: macro call to ael-dundi-e164 cannot be found in the AEL code!

[Jan 6 18:25:03] WARNING[381116] ael/pval.c: Warning: file /etc/asterisk/extensions.ael, line 209-209: macro call to ael-dundi-e164 cannot be found in the AEL code!

[Jan 6 18:25:03] WARNING[381116] ael/pval.c: Warning: file /etc/asterisk/extensions.ael, line 328-328: macro call to ael-std-exten-ael cannot be found in the AEL code!

[Jan 6 18:25:03] WARNING[381116] loader.c: Some non-required modules failed to load.

[Jan 6 18:25:03] WARNING[381116] loader.c: Module ‘res_adsi’ has been loaded but may be removed in a future release.

[Jan 6 18:25:03] WARNING[381116] loader.c: Module ‘app_adsiprog’ has been loaded but may be removed in a future release.

[Jan 6 18:25:03] WARNING[381116] loader.c: Module ‘app_getcpeid’ has been loaded but may be removed in a future release.

[Jan 6 18:25:03] ERROR[381116] loader.c: cel_tds declined to load.

[Jan 6 18:25:03] ERROR[381116] loader.c: cel_radius declined to load.

[Jan 6 18:25:03] ERROR[381116] loader.c: cdr_tds declined to load.

[Jan 6 18:25:03] ERROR[381116] loader.c: cdr_radius declined to load.

[Jan 6 18:25:03] ERROR[381116] loader.c: cdr_sqlite3_custom declined to load.

[Jan 6 18:25:03] ERROR[381116] loader.c: cel_sqlite3_custom declined to load.

[Jan 6 18:25:03] WARNING[381120] pbx_config.c: users.conf is deprecated and will be removed in a future version of Asterisk

[Jan 6 18:25:03] VERBOSE[381116] asterisk.c: Asterisk Ready.

There is no SIP signaling in your log, or any active/accepted calls. There is just this indicating an incoming call was rejected. This is because the source IP address (54.244.51.2) is not in the configured list for Twilio: