Unable to avoid direct media

Hello everyone! I am here because I need help… Maybe one charitable soul (or many) can help me out.

I have an installation of FreePBX 14.0.3.13 on CentOS Linux release 7.5.1804 (Core), working on Asterisk Asterisk 14.7.7. Now, I want for the Asterisk to always stay in between the extensions, hence, no directmedia, no reinvite, etc. However, I can’t manage for this to happen.

SIP canrenivite (directmedia) setting in Advanced Settings is set to no, and I’ve added the following lines in sip.conf (even if I believe I shouldn’t need them):

canreinvite=no
directmediadeny=0.0.0.0/0
directmedia=no

Also, I will mention that despite enabling TCP support in PJSIP in the SIP Settings section and having the transport set to auto in the extensions settings, I can’t connect to TCP. So maybe there’s something wrong with the config that overwrites the settings I choose in the UI, but I don’t know what. These might be related to the other point or not, I don’t know but it felt worth mentioning.

The installation was made according to the installation guide in the wiki Installing+FreePBX+14+on+CentOS+7 and this is the output of sip show settings:

Global Settings:

UDP Bindaddress: 0.0.0.0:5060
TCP SIP Bindaddress: Disabled
TLS SIP Bindaddress: Disabled
RTP Bindaddress: Disabled
Videosupport: No
Textsupport: No
Ignore SDP sess. ver.: No
AutoCreate Peer: Off
Match Auth Username: No
Allow unknown access: Yes
Allow subscriptions: Yes
Allow overlap dialing: Yes
Allow promisc. redir: No
Enable call counters: No
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: Asterisk PBX 14.7.7
SDP Session Name: Asterisk PBX 14.7.7
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: No
T.38 EC mode: Unknown
T.38 MaxDtgrm: 4294967295
SIP realtime: Disabled
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: Disabled, no localnet list
Externhost:
Externaddr: (null)
Externrefresh: 10

Global Signalling Settings:

Codecs: (ulaw|alaw|gsm|h263)
Relax DTMF: No
RFC2833 Compensation: No
Symmetric RTP: No
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: Yes
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: No
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
Outbound transport: UDP
Context: default
Record on feature: automon
Record off feature: automon
Force rport: Auto (No)
DTMF: rfc2833
Qualify: 0
Keepalive: 0
Use ClientCode: No
Progress inband: No
Language:
Tone zone:
MOH Interpret: default
MOH Suggest:
Voice Mail Extension: asterisk
RTCP Multiplexing: No


I must say everything but TCP and no direct media is working fine (audio, extensions, etc) but I would like to keep the server in the calls (and no direct media) because of some limitations with our local 4G provider.

If anyone has any ideas as to what should I try, I’d be very thankful. Now, if anyone need more info, I’d be glad to provide it.

Cheers!

In fact direct media is not enabled by default, unless you specifically configure it. Are you sure that your freepbx is operating in direct media mode?

1 Like

The audio is trying to go from one extension directly to the other, which is where I have issues with the 4G network, and not flowing through the server. I can provide the packet capture if it helps.

I might be wrong, but that is extremely strange, given that the distro is by default configured in such a way that direct media is not enabled unless some changes are made. Is your installation a freepbx distro?

1 Like

I have an installation of FreePBX 14.0.3.13 on CentOS Linux release 7.5.1804 (Core), working on Asterisk Asterisk 14.7.7. The installation was made according to the installation guide in the wiki Installing+FreePBX+14+on+CentOS+7 (I would link it, but I can’t since I’m new around here).

There is a setting called Asterisk dial commands that must be completely empty in order for direct media to work, any option there will stop direct media from working. Given that the default install populates that setting, that is why I was thinking that it is extremely strange that your freepbx is using direct media.

It is not empty, however, some settings, such as the TCP option I mentioned, do not seem to be taking into account. That is why I mentioned it and why I’m a bit confused as to what is happening…

As a temporary workaround, you could maybe force call recording on the routes/extensions? Call recording forces media flow through the PBX…

If the dial command is not empty, there is almost no way that direct media is enabled.
If canreinvite=no is set for the extensions, then there is definitely no way that direct media is enabled.

OK, so I’ve made a deeper digging into this, and realized that you’re probably right, and Media IS going through the server. However, I still can’t get any actual call established. as I’ve mentioned before, the 4G provider is not routing some packets properly, so one side never realizes the call is supposed to be on… Maybe TCP will help this work better? This is where I wonder why TCP is still disabled within asterisk, even if I’ve enabled it in the FreePBX GUI…

The packet capture that lead me to this conclusion (that you’re right):
15:24:31.893052 IP (tos 0x20, ttl 38, id 39342, offset 0, flags [none], proto UDP (17), length 1616)
(Ext A IP).37766 > (Server IP).5060: SIP, length: 1588
INVITE sip:38830001@(Server IP) SIP/2.0
Via: SIP/2.0/UDP (Ext A IP):37766;branch=z9hG4bKPjf9.A8DJu8s6DDgRZheTLNne561oDD86W
Max-Forwards: 70
From: sip:38831001@(Server IP);tag=UDM4MeXwGZrdNSrxOaxD85tnWNAIkaVs
To: sip:38830001@(Server IP)
Contact: <sip:38831001@(Ext A IP):37766;ob>
Call-ID: wu8k7Wpv9H-KBVNLfsIiLZhfRFUQLwRV
CSeq: 22204 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
Content-Type: application/sdp
Content-Length: 953

v=0
o=- 3745841070 3745841070 IN IP4 (Ext A IP)
s=pjmedia
b=AS:352
t=0 0
a=X-nat:0
m=audio 37762 RTP/AVP 98 97 99 104 3 0 8 9 113 114 115 116 117 96
c=IN IP4 (Ext A IP)
b=TIAS:64000
a=rtcp:4001 IN IP4 10.175.22.166
a=sendrecv
a=rtpmap:98 speex/16000
a=rtpmap:97 speex/8000
a=rtpmap:99 speex/32000
a=rtpmap:104 iLBC/8000
a=fmtp:104 mode=30
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:113 G7221/16000
a=fmtp:113 bitrate=24000
a=rtpmap:114 G7221/16000
a=fmtp:114 bitrate=32000
a=rtpmap:115 G7221/32000
a=fmtp:115 bitrate=24000
a=rtpmap:116 G7221/32000
a=fmtp:116 bitrate=32000
a=rtpmap:117 G7221/32000
a=fmtp:117 bitrate=48000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-16
m=video 37760 RTP/AVP 97
c=IN IP4 (Ext A IP)
b=TIAS:256000
a=rtcp:4003 IN IP4 10.175.22.166
a=sendrecv
a=rtpmap:97 H264/90000
a=fmtp:97 profile-level-id=42e01e; packetization-mode=1

15:24:31.893457 IP (tos 0x60, ttl 64, id 62975, offset 0, flags [DF], proto UDP (17), length 619)
(Server IP).5060 > (Ext A IP).37766: SIP, length: 591
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP (Ext A IP):37766;rport=37766;received=(Ext A IP);branch=z9hG4bKPjf9.A8DJu8s6DDgRZheTLNne561oDD86W
Call-ID: wu8k7Wpv9H-KBVNLfsIiLZhfRFUQLwRV
From: <sip:38831001@(Server IP)>;tag=UDM4MeXwGZrdNSrxOaxD85tnWNAIkaVs
To: <sip:38830001@(Server IP)>;tag=z9hG4bKPjf9.A8DJu8s6DDgRZheTLNne561oDD86W
CSeq: 22204 INVITE
WWW-Authenticate: Digest realm=“asterisk”,nonce=“1536852271/a5798ee4699ec52a572bad301142f594”,opaque=“666e812c19faf4c7”,algorithm=md5,qop=“auth”
Server: FPBX-14.0.3.13(14.7.7)
Content-Length: 0

15:24:32.113501 IP (tos 0x20, ttl 39, id 39345, offset 0, flags [DF], proto UDP (17), length 440)
(Ext A IP).37766 > (Server IP).5060: SIP, length: 412
ACK sip:38830001@(Server IP) SIP/2.0
Via: SIP/2.0/UDP (Ext A IP):37766;branch=z9hG4bKPjf9.A8DJu8s6DDgRZheTLNne561oDD86W
Max-Forwards: 70
From: sip:38831001@(Server IP);tag=UDM4MeXwGZrdNSrxOaxD85tnWNAIkaVs
To: sip:38830001@(Server IP);tag=z9hG4bKPjf9.A8DJu8s6DDgRZheTLNne561oDD86W
Call-ID: wu8k7Wpv9H-KBVNLfsIiLZhfRFUQLwRV
CSeq: 22204 ACK
Content-Length: 0

15:24:32.152225 IP (tos 0x20, ttl 38, id 39346, offset 0, flags [none], proto UDP (17), length 1929)
(Ext A IP).37766 > (Server IP).5060: SIP, length: 1901
INVITE sip:38830001@(Server IP) SIP/2.0
Via: SIP/2.0/UDP (Ext A IP):37766;branch=z9hG4bKPj3uNAKAExL3RG3nE8LDJTe5lLBLpzTlow
Max-Forwards: 70
From: sip:38831001@(Server IP);tag=UDM4MeXwGZrdNSrxOaxD85tnWNAIkaVs
To: sip:38830001@(Server IP)
Contact: <sip:38831001@(Ext A IP):37766;ob>
Call-ID: wu8k7Wpv9H-KBVNLfsIiLZhfRFUQLwRV
CSeq: 22205 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
Authorization: Digest username=“38831001”, realm=“asterisk”, nonce=“1536852271/a5798ee4699ec52a572bad301142f594”, uri=“sip:38830001@(Server IP)”, response=“e17a85f90f9cfdf41381d27cecdedb7f”, algorithm=md5, cnonce=“T9NOJHmmC9DpjOO72dS-AR8CYWec08JA”, opaque=“666e812c19faf4c7”, qop=auth, nc=00000001
Content-Type: application/sdp
Content-Length: 953

v=0
o=- 3745841070 3745841070 IN IP4 (Ext A IP)
s=pjmedia
b=AS:352
t=0 0
a=X-nat:0
m=audio 37762 RTP/AVP 98 97 99 104 3 0 8 9 113 114 115 116 117 96
c=IN IP4 (Ext A IP)
b=TIAS:64000
a=rtcp:4001 IN IP4 10.175.22.166
a=sendrecv
a=rtpmap:98 speex/16000
a=rtpmap:97 speex/8000
a=rtpmap:99 speex/32000
a=rtpmap:104 iLBC/8000
a=fmtp:104 mode=30
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:113 G7221/16000
a=fmtp:113 bitrate=24000
a=rtpmap:114 G7221/16000
a=fmtp:114 bitrate=32000
a=rtpmap:115 G7221/32000
a=fmtp:115 bitrate=24000
a=rtpmap:116 G7221/32000
a=fmtp:116 bitrate=32000
a=rtpmap:117 G7221/32000
a=fmtp:117 bitrate=48000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-16
m=video 37760 RTP/AVP 97
c=IN IP4 (Ext A IP)
b=TIAS:256000
a=rtcp:4003 IN IP4 10.175.22.166
a=sendrecv
a=rtpmap:97 H264/90000
a=fmtp:97 profile-level-id=42e01e; packetization-mode=1

15:24:32.153006 IP (tos 0x60, ttl 64, id 63143, offset 0, flags [DF], proto UDP (17), length 420)
(Server IP).5060 > (Ext A IP).37766: SIP, length: 392
SIP/2.0 100 Trying
Via: SIP/2.0/UDP (Ext A IP):37766;rport=37766;received=(Ext A IP);branch=z9hG4bKPj3uNAKAExL3RG3nE8LDJTe5lLBLpzTlow
Call-ID: wu8k7Wpv9H-KBVNLfsIiLZhfRFUQLwRV
From: <sip:38831001@(Server IP)>;tag=UDM4MeXwGZrdNSrxOaxD85tnWNAIkaVs
To: <sip:38830001@(Server IP)>
CSeq: 22205 INVITE
Server: FPBX-14.0.3.13(14.7.7)
Content-Length: 0

15:24:32.191575 IP (tos 0x60, ttl 64, id 63169, offset 0, flags [DF], proto UDP (17), length 691)
(Server IP).5060 > (Ext A IP).37766: SIP, length: 663
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP (Ext A IP):37766;rport=37766;received=(Ext A IP);branch=z9hG4bKPj3uNAKAExL3RG3nE8LDJTe5lLBLpzTlow
Call-ID: wu8k7Wpv9H-KBVNLfsIiLZhfRFUQLwRV
From: <sip:38831001@(Server IP)>;tag=UDM4MeXwGZrdNSrxOaxD85tnWNAIkaVs
To: <sip:38830001@(Server IP)>;tag=3f07172a-138d-4de2-b3da-944b7b8dc4e1
CSeq: 22205 INVITE
Server: FPBX-14.0.3.13(14.7.7)
Contact: <sip:(Server IP):5060>
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
15:24:32.192638 IP (tos 0x60, ttl 64, id 35848, offset 0, flags [DF], proto UDP (17), length 1084)
(Server IP).5060 > (Ext B IP).5060: SIP, length: 1056
INVITE sip:38830001@(Ext B IP):5060 SIP/2.0
Via: SIP/2.0/UDP (Server IP):5060;rport;branch=z9hG4bKPj44d38e36-39b6-435c-973c-94a7de1d71a1
From: “10A” <sip:38831001@(Server IP)>;tag=7201d810-683e-4f01-b262-edc5ea1c2769
To: <sip:38830001@(Ext B IP)>
Contact: <sip:asterisk@(Server IP):5060>
Call-ID: b70e0de5-d284-4ba7-b15c-807043beaf9f
CSeq: 26808 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
P-Asserted-Identity: “10A” <sip:38831001@(Server IP)>
Max-Forwards: 70
User-Agent: FPBX-14.0.3.13(14.7.7)
Content-Type: application/sdp
Content-Length: 335

v=0
o=- 1200674576 1200674576 IN IP4 (Server IP)
s=Asterisk
c=IN IP4 (Server IP)
t=0 0
m=audio 19582 RTP/AVP 0 8 3 111 9 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:9 G722/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

15:24:32.359286 IP (tos 0x17,CE, ttl 232, id 22250, offset 0, flags [none], proto UDP (17), length 521)
(Ext B IP).5060 > (Server IP).5060: SIP, length: 493
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP (Server IP):5060;rport;branch=z9hG4bKPj44d38e36-39b6-435c-973c-94a7de1d71a1
Contact: <sip:38830001@(Server IP):5060>
To: <sip:38830001@(Ext B IP):5060>;tag=2830065664
From: “10A” <sip:38831001@(Server IP)>;tag=7201d810-683e-4f01-b262-edc5ea1c2769
Call-ID: b70e0de5-d284-4ba7-b15c-807043beaf9f
CSeq: 26808 INVITE
User-Agent:SURiX iP Entrix V3.5.25 16-M3
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, NOTIFY
Accept: application/sdp
Content-Length: 0

15:24:32.359924 IP (tos 0x60, ttl 64, id 63257, offset 0, flags [DF], proto UDP (17), length 691)
(Server IP).5060 > (Ext A IP).37766: SIP, length: 663
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP (Ext A IP):37766;rport=37766;received=(Ext A IP);branch=z9hG4bKPj3uNAKAExL3RG3nE8LDJTe5lLBLpzTlow
Call-ID: wu8k7Wpv9H-KBVNLfsIiLZhfRFUQLwRV
From: <sip:38831001@(Server IP)>;tag=UDM4MeXwGZrdNSrxOaxD85tnWNAIkaVs
To: <sip:38830001@(Server IP)>;tag=3f07172a-138d-4de2-b3da-944b7b8dc4e1
CSeq: 22205 INVITE
Server: FPBX-14.0.3.13(14.7.7)
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Contact: <sip:(Server IP):5060>
15:24:34.426692 IP (tos 0x17,CE, ttl 232, id 22253, offset 0, flags [none], proto UDP (17), length 820)
(Ext B IP).5060 > (Server IP).5060: SIP, length: 792
SIP/2.0 200 OK
Via: SIP/2.0/UDP (Server IP):5060;rport;branch=z9hG4bKPj44d38e36-39b6-435c-973c-94a7de1d71a1
Contact: <sip:38830001@(Server IP):5060>
To: <sip:38830001@(Ext B IP):5060>;tag=2830065664
From: “10A” <sip:38831001@(Server IP)>;tag=7201d810-683e-4f01-b262-edc5ea1c2769
Call-ID: b70e0de5-d284-4ba7-b15c-807043beaf9f
CSeq: 26808 INVITE
User-Agent:SURiX iP Entrix V3.5.25 16-M3
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, NOTIFY
Accept: application/sdp
Supported: replaces
Content-Type: application/sdp
Content-Length: 250

v=0
o=- 4546474849 5556575859 IN IP4 (Ext B IP)
s=SURiX iP Entrix V3.5.25
c=IN IP4 (Ext B IP)
t=0 0
m=audio 55000 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv

15:24:34.427158 IP (tos 0x60, ttl 64, id 36266, offset 0, flags [DF], proto UDP (17), length 435)
(Server IP).5060 > (Ext B IP).5060: SIP, length: 407
ACK sip:38830001@(Ext B IP):5060 SIP/2.0
Via: SIP/2.0/UDP (Server IP):5060;rport;branch=z9hG4bKPje93dac29-5756-4a7f-aed1-05a17f7ab6fc
From: “10A” <sip:38831001@(Server IP)>;tag=7201d810-683e-4f01-b262-edc5ea1c2769
To: <sip:38830001@(Ext B IP)>;tag=2830065664
Call-ID: b70e0de5-d284-4ba7-b15c-807043beaf9f
CSeq: 26808 ACK
Max-Forwards: 70
User-Agent: FPBX-14.0.3.13(14.7.7)
Content-Length: 0

15:24:34.427891 IP (tos 0x60, ttl 64, id 64316, offset 0, flags [DF], proto UDP (17), length 1179)
(Server IP).5060 > (Ext A IP).37766: SIP, length: 1151
SIP/2.0 200 OK
Via: SIP/2.0/UDP (Ext A IP):37766;rport=37766;received=(Ext A IP);branch=z9hG4bKPj3uNAKAExL3RG3nE8LDJTe5lLBLpzTlow
Call-ID: wu8k7Wpv9H-KBVNLfsIiLZhfRFUQLwRV
From: <sip:38831001@(Server IP)>;tag=UDM4MeXwGZrdNSrxOaxD85tnWNAIkaVs
To: <sip:38830001@(Server IP)>;tag=3f07172a-138d-4de2-b3da-944b7b8dc4e1
CSeq: 22205 INVITE
Server: FPBX-14.0.3.13(14.7.7)
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Contact: <sip:(Server IP):5060>
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800;refresher=uac
Require: timer
15:24:34.928523 IP (tos 0x60, ttl 64, id 64622, offset 0, flags [DF], proto UDP (17), length 1179)
(Server IP).5060 > (Ext A IP).37766: SIP, length: 1151
SIP/2.0 200 OK
Via: SIP/2.0/UDP (Ext A IP):37766;rport=37766;received=(Ext A IP);branch=z9hG4bKPj3uNAKAExL3RG3nE8LDJTe5lLBLpzTlow
Call-ID: wu8k7Wpv9H-KBVNLfsIiLZhfRFUQLwRV
From: <sip:38831001@(Server IP)>;tag=UDM4MeXwGZrdNSrxOaxD85tnWNAIkaVs
To: <sip:38830001@(Server IP)>;tag=3f07172a-138d-4de2-b3da-944b7b8dc4e1
CSeq: 22205 INVITE
Server: FPBX-14.0.3.13(14.7.7)
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Contact: <sip:(Server IP):5060>
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800;refresher=uac
Require: timer
15:24:35.928918 IP (tos 0x60, ttl 64, id 65182, offset 0, flags [DF], proto UDP (17), length 1179)
(Server IP).5060 > (Ext A IP).37766: SIP, length: 1151
SIP/2.0 200 OK
Via: SIP/2.0/UDP (Ext A IP):37766;rport=37766;received=(Ext A IP);branch=z9hG4bKPj3uNAKAExL3RG3nE8LDJTe5lLBLpzTlow
Call-ID: wu8k7Wpv9H-KBVNLfsIiLZhfRFUQLwRV
From: <sip:38831001@(Server IP)>;tag=UDM4MeXwGZrdNSrxOaxD85tnWNAIkaVs
To: <sip:38830001@(Server IP)>;tag=3f07172a-138d-4de2-b3da-944b7b8dc4e1
CSeq: 22205 INVITE
Server: FPBX-14.0.3.13(14.7.7)
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Contact: <sip:(Server IP):5060>
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800;refresher=uac
Require: timer
15:24:37.929624 IP (tos 0x60, ttl 64, id 720, offset 0, flags [DF], proto UDP (17), length 1179)
(Server IP).5060 > (Ext A IP).37766: SIP, length: 1151
SIP/2.0 200 OK
Via: SIP/2.0/UDP (Ext A IP):37766;rport=37766;received=(Ext A IP);branch=z9hG4bKPj3uNAKAExL3RG3nE8LDJTe5lLBLpzTlow
Call-ID: wu8k7Wpv9H-KBVNLfsIiLZhfRFUQLwRV
From: <sip:38831001@(Server IP)>;tag=UDM4MeXwGZrdNSrxOaxD85tnWNAIkaVs
To: <sip:38830001@(Server IP)>;tag=3f07172a-138d-4de2-b3da-944b7b8dc4e1
CSeq: 22205 INVITE
Server: FPBX-14.0.3.13(14.7.7)
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Contact: <sip:(Server IP):5060>
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800;refresher=uac
Require: timer
15:24:41.929268 IP (tos 0x60, ttl 64, id 2810, offset 0, flags [DF], proto UDP (17), length 1179)
(Server IP).5060 > (Ext A IP).37766: SIP, length: 1151
SIP/2.0 200 OK
Via: SIP/2.0/UDP (Ext A IP):37766;rport=37766;received=(Ext A IP);branch=z9hG4bKPj3uNAKAExL3RG3nE8LDJTe5lLBLpzTlow
Call-ID: wu8k7Wpv9H-KBVNLfsIiLZhfRFUQLwRV
From: <sip:38831001@(Server IP)>;tag=UDM4MeXwGZrdNSrxOaxD85tnWNAIkaVs
To: <sip:38830001@(Server IP)>;tag=3f07172a-138d-4de2-b3da-944b7b8dc4e1
CSeq: 22205 INVITE
Server: FPBX-14.0.3.13(14.7.7)
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Contact: <sip:(Server IP):5060>
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800;refresher=uac
Require: timer
15:24:45.929845 IP (tos 0x60, ttl 64, id 4999, offset 0, flags [DF], proto UDP (17), length 1179)
(Server IP).5060 > (Ext A IP).37766: SIP, length: 1151
SIP/2.0 200 OK
Via: SIP/2.0/UDP (Ext A IP):37766;rport=37766;received=(Ext A IP);branch=z9hG4bKPj3uNAKAExL3RG3nE8LDJTe5lLBLpzTlow
Call-ID: wu8k7Wpv9H-KBVNLfsIiLZhfRFUQLwRV
From: <sip:38831001@(Server IP)>;tag=UDM4MeXwGZrdNSrxOaxD85tnWNAIkaVs
To: <sip:38830001@(Server IP)>;tag=3f07172a-138d-4de2-b3da-944b7b8dc4e1
CSeq: 22205 INVITE
Server: FPBX-14.0.3.13(14.7.7)
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Contact: <sip:(Server IP):5060>
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800;refresher=uac
Require: timer

Remember that VoIP is very sensitive to network status. Mobile networks are not always well suited for VoIP. In fact, many mobile providers interfere with SIP packets in order to “protect” their own voice services.
TCP is not enabled by default, but I doubt that your issue is related to that.
What are the limitations that you mention about your 4g provider?

The limitation is that the UDP packets the server is sending to the extension are not getting there. They are sent to the 4G device (Ext A in the example packets) public IP, but the device is actually behind a NAT and the packets are not getting there. I wonder if using TCP will allow for the packets to be correctly routed, but I can’t seem to enable TCP in the server from the UI (The UI has TCP configured, but it doesn’t seem to be enabled in the Asterisk whe I run show options, as I showed in the first post of this topic).

These are the contents of my pjsip.conf file:

;--------------------------------------------------------------------------------;
;          Do NOT edit this file as it is auto-generated by FreePBX.             ;
;--------------------------------------------------------------------------------;
; For information on adding additional paramaters to this file, please visit the ;
; FreePBX.org wiki page, or ask on IRC. This file was created by the new FreePBX ;
; BMO - Big Module Object. Any similarity in naming with BMO from Adventure Time ;
; is totally deliberate.                                                         ;
;--------------------------------------------------------------------------------;
#include pjsip_custom.conf
#include pjsip.transports.conf
#include pjsip.transports_custom_post.conf
#include pjsip.endpoint.conf
#include pjsip.endpoint_custom_post.conf
#include pjsip.aor.conf
#include pjsip.aor_custom_post.conf
#include pjsip.auth.conf
#include pjsip.auth_custom_post.conf
#include pjsip.registration.conf
#include pjsip.registration_custom_post.conf
#include pjsip.identify.conf
#include pjsip.identify_custom_post.conf


[global]
type=global
user_agent=FPBX-14.0.3.13(14.7.7)
default_outbound_endpoint=dpma_endpoint
#include pjsip_custom_post.conf

Notice how everything is commented out! Should I uncomment this? That’s obviously not what the file itself says…

The only thing in there that’s commented out are the comments… The thing with a hash on the front is called an Include Directive.

I think you might be facing this issue in the wrong way. If your issue is caused by an incomplete NAT configuration, you need to fix that first. Going from udp to tcp is not going to fix that.
On the other hand, if your issue is just caused by lost packets in the provider’s network, tcp is not going to fix that either.

This shows my ignorance! But according to my ignorance, I also ignore why sip show settings shows TCP SIP Bindaddress: Disabled

You need to fix your NAT issues with UDP. A bad network isn’t going to change if you switch from UDP to TCP.

The NAT issues are happening in a network outside of my reach, the phone company’s 4G network, so I wanted to try TCP to see if it helped, since maybe they treat UDP and TCP differently…

The phone company is doing everything they can to not help me with this issue… That’s why I’m looking for a workaround

First, you need to redo this debug that you originally posted. You have it via a tcpdump, which is great and all but you need to do it via Asterisk’s command console so you can see if and how the packets are hitting Asterisk itself.

Second, DO NOT edit things out of the file. You’re having call/audio issues and you are MASKING the IPs that are being used. We have no idea if the right IPs or information is being sent via this because you’ve removed it.

Third, go actually configure your softphone client that you are testing with or whatever phone you are using so it’s not sending 12 codecs that aren’t being used at all as options to the PBX. Specially when some of those options are at the top of this list and probably not even enabled on the PBX.