Silence when outgoing calls

Hello.
Problem:
Sometimes outgoing calls get sillence for 15-30 seconds. Sometimes the caller can’t hear callee, but callee hears a caller. I can’t find any pattern of those cases. Sometimes it’s ok, sometimes it’s bad.

Question:
Where should I start looking?

I try to check logs for those kinds of calls. They look the same. We record calls and in CDR its looks like for example both calls are ANSWERED, record of one is just silence and other is all good.

Making the problem more difficult is that we have many calls going through asterisk server so it’s hard to trace ‘bad’ ones.

Network architecture:
Asterisk has several interfaces.
One for SIP phones(Cisco).(10.10.0.1/24)
One for direct connection to Voip providers via vlan.(192.168.0.1/24)
And others.

Settings:
We are using SIP module.
For Voip provider is next settings in sip.conf(using it for incoming and outgoing calls)

[my_Voip]
dtmfmode=rfc2833
username=12345
type=friend
secret=12345
host=192.168.0.2
fromuser=12345
fromdomain= 192.168.0.2
port=5060
context=inboundlines
insecure=port,invite
transport=udp
disallow = all
allow = alaw,ulaw
canreinvite=no
sendrpid=yes

For peer(SIP phone) in users.conf

[121]
callwaiting = yes
cid_number = 121
context = numberplan-custom-1
fullname = caller121
hasagent = no
hasdirectory = no
hasiax = no
hasmanager = no
hassip = yes
hasvoicemail = no
host = dynamic
mailbox = 121
threewaycalling = yes
registeriax = no
canreinvite = no
dtmfmode = rfc2833
disallow = all
allow = ulaw,alaw
deny=0.0.0.0/0
permit=10.10.0.2
call-limit=2

You need to provide protocol logging, including SDP, and RTP logging, however you should note that chan_sip is no longer maintained by the main project, so you should try to reproduce this using chan_pjsip.

Also note that, with chan_sip, the provider type should be peer, not friend, for security reasons.

How do i get this logs?
For RTP - sip set debug peer mypeer, am i right?
And what about SPD?
Or i just need to use tcpdump+whireshark?
Thank you for help!

For SDP, “sip set debug on”, although there are options to be more specific about the peer.

For RTP, I think it is “rtp set debug on”.

I manage to catch this “silence” call with tcpdump.Thats how it looks like in whireshark



So caller just wait and cancel call.
I look on others calls and there is no this RTP packets in middle.

Thats how it looks for normal call.

Wireshark will tell you the addresses. We have to guess whether this is inbound or outbound and on which side of the call. There does seem to be only one stream, though, whereas a normal, two party, call would have four streams A-in A-out B-in and B-out.

I just filtered all packets with sip INVITE.
(this white spaces looks like sip:callingnumber@asterisk ipaddress)
Then i filtered by call id( find it in SIP packet body)
This is outbound call from caller side. And this is all Whireshark showing me.
The only one difference i see is that when call with silence there is a lot of this RTP packets in two first screenshots.
The ip addresses that i see - one is SIP phone address and other is asterisk server address.

As @david551 said, RTP pakets are flowing one way, you have to check which is the IP address of those pakets to see if they are going out or in

oh, thank you for clarify. i misunderstand what @david551 says.

All this RTP packets going from caller to Asterisk server.


This is what inside.

And you don’t see them in asterisk with “rtp set debug on” ? If so, you have a firewall blocking the incoming RTP traffic

Its hard to get logs with Asterisk tools because this “silence” call is like 1 of 10 without any pattern(or i cant see it).
I can use in Asterisk CLI command 'rtp set debug ip “callerIP” ’ but its only show rtp packets without any others options(call id for example).
I don’t think its firewall problem because if it was all calls should fail.
I think its more about codecs or some wrong settings for peers.

If the firewall rule is incorrect - that is doesn’t allow the correct port range - then it could very well be sporadic, that came up recently from someone else.

From a codec perspective it’s unlikely, codecs are negotiated and if it fails to negotiate the call will fail.

If you enable rtp debug and have the proper logging channels enabled each RTP packet will be attached to the channel id. So you can filter out this call by doing something like the below, once you find a call that had one-way or zero-way audio.

cat /var/log/asterisk/messages | grep "C-0000049"

Thank you, i will try this.

Also consider attaching the output of ‘sip show settings’ in this thread. Be sure to mask any sensitive information such as external IP-addresses, if any.

And the reason you only see RTP traffic one way in your previous example/image is because the call is not answered. You are only seeing ring indication or early media. When the SIP 200 is received and ACK’d there should be media in both directions. Your cutting of the images is causing some confusion I believe.

For RTP i have next rule
ACCEPT 17 – * * 0.0.0.0/0 0.0.0.0/0 udp dpts:10000:20000
same ports is set up in rtp.conf
But i dont see ACCEPT rule for port 5061 only for 5060
ACCEPT 17 – * * 0.0.0.0/0 0.0.0.0/0 udp dpt:5060
ACCEPT 6 – * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5060
Could this be a problem?

Port 5061 doesn’t carry media, so no.

This is how “sip show settings” looks like.
Global Settings:

UDP Bindaddress: 0.0.0.0:5060
TCP SIP Bindaddress: Disabled
TLS SIP Bindaddress: 0.0.0.0:5061
RTP Bindaddress: Disabled
Videosupport: No
Textsupport: No
Ignore SDP sess. ver.: No
AutoCreate Peer: Off
Match Auth Username: No
Allow unknown access: No
Allow subscriptions: Yes
Allow overlap dialing: Yes
Allow promisc. redir: No
Enable call counters: Yes
SIP domain support: No
Path support : No
Realm. auth: No
Our auth realm asterisk
Use domains as realms: No
Call to non-local dom.: Yes
URI user is phone no: No
Always auth rejects: Yes
Direct RTP setup: No
User Agent: Cisco-SIPGateway/IOS-12.x
SDP Session Name: Asterisk PBX 20.4.0
SDP Owner Name: root
Reg. context: (not set)
Regexten on Qualify: No
Trust RPID: No
Send RPID: No
Legacy userfield parse: No
Send Diversion: Yes
Caller ID: asterisk
From: Domain:
Record SIP history: Off
Auth. Failure Events: Off
T.38 support: Yes
T.38 EC mode: FEC
T.38 MaxDtgrm: 4294967295
SIP realtime: Enabled
Qualify Freq : 60000 ms
Q.850 Reason header: No
Store SIP_CAUSE: No

Network QoS Settings:

IP ToS SIP: CS0
IP ToS RTP audio: CS0
IP ToS RTP video: CS0
IP ToS RTP text: CS0
802.1p CoS SIP: 4
802.1p CoS RTP audio: 5
802.1p CoS RTP video: 6
802.1p CoS RTP text: 5
Jitterbuffer enabled: No

Network Settings:

SIP address remapping: Enabled using externaddr
Externhost:
Externaddr: asterisk ip addr
Externrefresh: 10
Localnet: some nets

Global Signalling Settings:

Codecs: (ulaw|alaw|gsm|h263|codec2|g723|g726|g726aal2|adpcm|slin|slin12|slin16|slin24|slin32|slin44|slin48|slin96|slin192|lpc10|g729|speex|speex16|speex32|ilbc|g722|siren7|siren14|g719|opus|jpeg|png|h261|h263p|h264|h265|mpeg4|vp8|vp9|red|t140|t38|silk8|silk12|silk16|silk24)
Relax DTMF: No
RFC2833 Compensation: No
Symmetric RTP: Yes
Compact SIP headers: No
RTP Keepalive: 0 (Disabled)
RTP Timeout: 0 (Disabled)
RTP Hold Timeout: 0 (Disabled)
MWI NOTIFY mime type: application/simple-message-summary
DNS SRV lookup: No
Pedantic SIP support: Yes
Reg. min duration 60 secs
Reg. max duration: 3600 secs
Reg. default duration: 120 secs
Sub. min duration 60 secs
Sub. max duration: 3600 secs
Outbound reg. timeout: 20 secs
Outbound reg. attempts: 0
Outbound reg. retry 403:No
Notify ringing state: Yes
Include CID: No
Notify hold state: Yes
SIP Transfer mode: open
Max Call Bitrate: 384 kbps
Auto-Framing: No
Outb. proxy:
Session Timers: Accept
Session Refresher: uas
Session Expires: 1800 secs
Session Min-SE: 90 secs
Timer T1: 500
Timer T1 minimum: 100
Timer B: 32000
No premature media: Yes
Max forwards: 70

Default Settings:

Allowed transports: UDP,WS,WSS
Outbound transport: UDP
Context: public
Record on feature: automon
Record off feature: automon
Force rport: Yes
DTMF: rfc2833
Qualify: 2000
Keepalive: 0
Use ClientCode: No
Progress inband: No
Language:
Tone zone:
MOH Interpret: default
MOH Suggest:
Voice Mail Extension: asterisk
RTCP Multiplexing: No

Realtime SIP Settings:

Realtime Peers: Yes
Realtime Regs: No
Cache Friends: No
Update: Yes
Ignore Reg. Expire: No
Save sys. name: No
Save path header: No
Auto Clear: 120 (Disabled)