No audio - Fresh install

Hello everyone,

I’m fairly new to Asterisk and have a problem regarding audio. I have recently set up a VPS with CentOS 7 and Asterisk 16.9.0. It’s a basic, fresh install I did by compiling Asterisk myself. I used the instructions from the book “Asterisk: The Definitive Guide (Fifth Edition)” to setup everything. Endpoints are setup using a realtime connection with a MariaDB database that’s on the same VPS. The VPS only has one network interface with an external IP.

I was able to make endpoints and register them using several different softphone clients on different hardware devices. The only issue is, I get no audio when calling the different endpoints. I can see that the dialplan I made is working properly (to my knowledge). When calling the endpoints, they ring and I can pick up. I have tested this on several networks and clients, but I still get no audio. Also made an extension that plays the Hello-World sound, but sadly I get no audio here either. Here is some extra information:

Output of the firewall to see which ports have been opened:

sudo firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0
  sources:
  services: dhcpv6-client http https sip sips ssh
  ports: 5060/udp 10000-20000/udp 5060/tcp 4569/udp 5061/udp 5061/tcp
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

I contacted my VPS provider to ask if certain traffic was blocked by default, this was not the case. Also tried disabling my firewall temporarily, did not work. Also put SELinux on Permissive temporarily, also no results.

Here is the output of my pjsip.conf.

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0

[transport-tls]
type=transport
protocol=tls
bind=0.0.0.0
cert_file=/home/asterisk/certs/self-signed.crt
priv_key_file=/home/asterisk/certs/self-signed.key

In this case I’m not using TLS yet to make the call. The endpoints are both on the transport-udp protocol.

Here is an example of the live logging when I make a call to the Hello-World dialplan:

 == Setting global variable 'SIPDOMAIN' to 'sip.example.com'
[Mar 26 10:40:11] WARNING[2409]: res_format_attr_siren7.c:52 siren7_parse_sdp_fmtp: Got Siren7 offer at 24000 bps, but only 32000 bps supported; ignoring.
    -- Executing [200@sets:1] Answer("PJSIP/0000f30B0B02-00000004", "") in new stack
       > 0x7f6484017520 -- Strict RTP learning after remote address set to: <INTERNAL IP CLIENT>:4000
[Mar 26 10:40:11] WARNING[2409]: res_format_attr_siren7.c:52 siren7_parse_sdp_fmtp: Got Siren7 offer at 24000 bps, but only 32000 bps supported; ignoring.
    -- Executing [200@sets:2] Playback("PJSIP/0000f30B0B02-00000004", "hello-world") in new stack
    -- <PJSIP/0000f30B0B02-00000004> Playing 'hello-world.slin' (language 'en')
       > 0x7f6484017520 -- Strict RTP qualifying stream type: audio
       > 0x7f6484017520 -- Strict RTP switching source address to <EXTERNAL IP CLIENT>:4000
    -- Executing [200@sets:3] Hangup("PJSIP/0000f30B0B02-00000004", "") in new stack
  == Spawn extension (sets, 200, 3) exited non-zero on 'PJSIP/0000f30B0B02-00000004'

I was wondering if you had any suggestions on which troubleshooting steps I should take or what logs with what log level I should be taking a look at to fix this issue. Thanks in advance for your answer!

Kind regards,
Tim

What is the actual configuration for the endpoint? If it is behind NAT then there is additional configuration required.

Hello, thanks for your reply. I’m going to assume there’s no NAT in place, due to it being a VPS with a public IP attached to it and having only one network interface. Here is the configuration of my endpoints.

 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:  0000f30A0A01                                         Unavailable   0 of inf
     InAuth:  0000f30A0A01/0000f30A0A01
        Aor:  0000f30A0A01                                       1
  Transport:  transport-udp             udp      0      0  0.0.0.0:5060

 Endpoint:  0000f30B0B02                                         Unavailable   0 of inf
     InAuth:  0000f30B0B02/0000f30B0B02
        Aor:  0000f30B0B02                                       1
  Transport:  transport-udp             udp      0      0  0.0.0.0:5060

 Endpoint:  SOFTPHONE_A                                          Unavailable   0 of inf
     InAuth:  SOFTPHONE_A/SOFTPHONE_A
        Aor:  SOFTPHONE_A                                        2
  Transport:  transport-tls             tls      0      0  0.0.0.0:5061

 Endpoint:  SOFTPHONE_B                                          Unavailable   0 of inf
     InAuth:  SOFTPHONE_B/SOFTPHONE_B
        Aor:  SOFTPHONE_B                                        2
  Transport:  transport-tls             tls      0      0  0.0.0.0:5061

Output of select id,transport,aors,auth,context,disallow,allow from asterisk.ps_endpoints;

+--------------+---------------+--------------+--------------+---------+----------+-------+
| id           | transport     | aors         | auth         | context | disallow | allow |
+--------------+---------------+--------------+--------------+---------+----------+-------+
| 0000f30A0A01 | transport-udp | 0000f30A0A01 | 0000f30A0A01 | sets    | all      | ulaw  |
| 0000f30B0B02 | transport-udp | 0000f30B0B02 | 0000f30B0B02 | sets    | all      | ulaw  |
| SOFTPHONE_A  | transport-tls | SOFTPHONE_A  | SOFTPHONE_A  | sets    | all      | ulaw  |
| SOFTPHONE_B  | transport-tls | SOFTPHONE_B  | SOFTPHONE_B  | sets    | all      | ulaw  |
+--------------+---------------+--------------+--------------+---------+----------+-------+

select id from asterisk.ps_aors;

+--------------+
| id           |
+--------------+
| 0000f30A0A01 |
| 0000f30B0B02 |
| SOFTPHONE_A  |
| SOFTPHONE_B  |
+--------------+

select id,auth_type,username from asterisk.ps_auths;

+--------------+-----------+--------------+
| id           | auth_type | username     |
+--------------+-----------+--------------+
| 0000f30A0A01 | userpass  | 0000f30A0A01 |
| 0000f30B0B02 | userpass  | 0000f30B0B02 |
| SOFTPHONE_A  | userpass  | SOFTPHONE_A  |
| SOFTPHONE_B  | userpass  | SOFTPHONE_B  |
+--------------+-----------+--------------+

And for good measure, the configuration of my extensions.conf.


[general]

[globals]

[sets]
exten => 100,1,Dial(PJSIP/0000f30A0A01)

exten => 101,1,Dial(PJSIP/0000f30B0B02)

exten => 102,1,Dial(PJSIP/SOFTPHONE_A)

exten => 103,1,Dial(PJSIP/SOFTPHONE_B)

exten => 200,1,Answer()
        same => n,Playback(hello-world)
        same => n,Hangup()

If you need any other specific information, please let me know.

There’s two places where NAT can take place. The server where Asterisk runs, and the location where the endpoints are. Each of these situations require their own specific configuration. If the endpoint is behind NAT and Asterisk is not configured to know the endpoint is behind NAT, then you will see no audio and can have other places.

The options to set to yes would be “rewrite_contact”, “rtp_symmetric”, and “force_rport” if the endpoint itself is behind NAT.

1 Like

That was indeed the solution. Thanks for helping a beginner out!

For other people who end up here due to Google that are following along with the same book as I am. If your endpoints (Softphone/phones) are behind a NAT (which is most likely if you’re just testing in your home network), please make sure that in the asterisk.ps_endpoints table of your SQL you set the properties listed above (rewrite_contact, rtp_symmetric and force_rport) to “yes”.