Asterisk does not send telephone-event in 200 OK SDP (offer)

Hi community,

We make a call from a Cisco video endpoint towards Asterisk (Cisco SIP-cabaple video endpoint-> CUCM → Cisco VCS → Asterisk external SIP interface (chan_sip)).

  • Cisco VCS initiates the SIP session with slow start INVITE (without SDP).
  • Asterisk responds with 200 OK SDP (offer) including the list of codecs enabled in general SIP settings, however this 200 OK SDP (offer) does not include “telephone-event”.
  • Now that telephone-event is missing, we are not able to make DTMF (RFC2833) work.

Is there a way to make Asterisk include the telephone-event in 200 OK SDP (offer)?

  • Asterisk version: FPBX-15.0.17.67(16.17.0)

  • DTMF mode in default SIP settings is RFC2833.

  • DTMF mode is set to RFC2833 in “dtmf_mode=rfc2833” in “sip_general_additional.conf” (chan_sip settings).

Below you can find the SIP trace from Asterisk console:

<--- SIP read from TCP:X.X.X.X:27339 --->
INVITE sip:bob@X.X.X.X SIP/2.0
Via: SIP/2.0/TCP X.X.X.X:5060;egress-zone=DNS1;branch=z9hG4bK1a78e818d37bd4c6dfff6471516aa90d60535;proxy-call-id=363d641e-4ec9-4f70-afcd-605479c5fa7a;rport
Call-ID: 50b38100-21817ab3-35f954-1a46de0a@X.X.X.X
CSeq: 101 INVITE
Remote-Party-ID: "C102" <sip:alice@X.X.X.X>;privacy=off;screen=no;party=calling
Contact: <sip:X.X.X.X:5073;transport=tcp>
From: "C102" <sip:alice@X.X.X.X>;tag=55477354~a8c47ddd-95c1-4495-8516-36aa922eb5fd-45076815
To: <sip:bob@X.X.X.X>
Max-Forwards: 14
Allow: INVITE,ACK,BYE,CANCEL,INFO,OPTIONS,REFER,SUBSCRIBE,NOTIFY
User-Agent: TANDBERG/4352 (X8.10.4-b2bua-1.0)
Supported: X-cisco-srtp-fallback,replaces,timer
Session-Expires: 1800;refresher=uac
Min-SE: 500
P-Asserted-Identity: "C102" <sip:alice@X.X.X.X>
X-TAATag: 1ed3ee20-f8b0-4a34-8d25-e816bf1fa658
Session-ID: c9b0fc5179dd99ac59250faa55477353;remote=00000000000000000000000000000000
Content-Length: 0


<------------->
--- (24 headers 0 lines) ---
Sending to X.X.X.X:27339 (NAT)
Using INVITE request as basis request - 50b38100-21817ab3-35f954-1a46de0a@X.X.X.X
No matching peer for 'alice' from 'X.X.X.X:27339'
Looking for bob in from-sip-external (domain X.X.X.X)
sip_route_dump: route/path hop: <sip:proxy-call-id=363d641e-4ec9-4f70-afcd-605479c5fa7a@X.X.X.X:5060;transport=tcp;lr>

<--- Transmitting (NAT) to X.X.X.X:27339 --->
SIP/2.0 100 Trying
Via: SIP/2.0/TCP X.X.X.X:5060;egress-zone=DNS1;branch=z9hG4bK1a78e818d37bd4c6dfff6471516aa90d60535;proxy-call-id=363d641e-4ec9-4f70-afcd-605479c5fa7a;received=X.X.X.X;rport=27339
From: "C102" <sip:alice@X.X.X.X;tag=55477354~a8c47ddd-95c1-4495-8516-36aa922eb5fd-45076815
To: <sip:bob@X.X.X.X>
Call-ID: 50b38100-21817ab3-35f954-1a46de0a@X.X.X.X
CSeq: 101 INVITE
Server: FPBX-15.0.17.67(16.17.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 1800;refresher=uac
Contact: <sip:bob@X.X.X.X:5060;transport=tcp>
Content-Length: 0


<------------>
Audio is at 14960
Video is at X.X.X.X:14354
Adding codec opus to SDP
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding codec g722 to SDP
Adding codec g729 to SDP
Adding video codec h264 to SDP

<--- Reliably Transmitting (NAT) to X.X.X.X:27339 --->
SIP/2.0 200 OK
Via: SIP/2.0/TCP X.X.X.X:5060;egress-zone=DNS1;branch=z9hG4bK1a78e818d37bd4c6dfff6471516aa90d60535;proxy-call-id=363d641e-4ec9-4f70-afcd-605479c5fa7a;received=X.X.X.X;rport=27339
From: "C102" <sip:alice@X.X.X.X>;tag=55477354~a8c47ddd-95c1-4495-8516-36aa922eb5fd-45076815
To: <sip:bob@X.X.X.X>;tag=as2337c223
Call-ID: 50b38100-21817ab3-35f954-1a46de0a@X.X.X.X
CSeq: 101 INVITE
Server: FPBX-15.0.17.67(16.17.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 1800;refresher=uac
Contact: <sip:bob@X.X.X.X:5060;transport=tcp>
Content-Type: application/sdp
Require: timer
Content-Length: 411

v=0
o=root 1865105692 1865105692 IN IP4 X.X.X.X
s=Asterisk PBX 16.17.0
c=IN IP4 X.X.X.X
b=CT:6000
t=0 0
m=audio 14960 RTP/AVP 107 0 8 9 18
a=rtpmap:107 opus/48000/2
a=fmtp:107 useinbandfec=1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=maxptime:20
a=sendrecv
m=video 14354 RTP/AVP 99
a=rtpmap:99 H264/90000
a=sendrecv

<------------>

<--- SIP read from TCP:X.X.X.X:27339 --->
ACK sip:bob@X.X.X.X:5060;transport=tcp SIP/2.0
Via: SIP/2.0/TCP X.X.X.X:5060;egress-zone=DNS1;branch=z9hG4bKb988232f6956c0af3c1e22d35b9db41260537;proxy-call-id=363d641e-4ec9-4f70-afcd-605479c5fa7a;rport
Call-ID: 50b38100-21817ab3-35f954-1a46de0a@X.X.X.X
CSeq: 101 ACK
From: "C102" <sip:alice@X.X.X.X>;tag=55477354~a8c47ddd-95c1-4495-8516-36aa922eb5fd-45076815
To: <sip:bob@X.X.X.X>;tag=as2337c223
Max-Forwards: 70
User-Agent: TANDBERG/4352 (X8.10.4-b2bua-1.0)
X-TAATag: 1ed3ee20-f8b0-4a34-8d25-e816bf1fa658
Session-ID: c9b0fc5179dd99ac59250faa55477353;remote=b1c6339a00255000a00002e48a000000
Content-Type: application/sdp
Content-Length: 641

v=0
o=tandberg 0 1 IN IP4 X.X.X.X
s=-
c=IN IP4 X.X.X.X
b=AS:6000
t=0 0
m=audio 51960 RTP/AVP 9 0 8 18 101
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=rtcp:51961 IN X.X.X.X
m=video 51464 RTP/AVP 97
b=TIAS:5936000
a=rtpmap:97 H264/90000
a=fmtp:97 profile-level-id=420016;max-mbps=245000;max-fs=9000;max-cpb=200;max-br=5000;max-smbps=245000;max-fps=6000;packetization-mode=0;max-rcmd-nalu-size=3456000;sar-supported=16
a=sendrecv
a=label:11
a=rtcp:51465 IN IP4 X.X.X.X
<------------->
--- (13 headers 23 lines) ---
Got SDP version 1 and unique parts [tandberg 0 IN IP4 X.X.X.X]
Found RTP audio format 9
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 18
Found RTP audio format 101
Found audio description format G722 for ID 9
Found audio description format PCMU for ID 0
Found audio description format PCMA for ID 8
Found audio description format G729 for ID 18
Found audio description format telephone-event for ID 101
Found RTP video format 97
Found video description format H264 for ID 97
Capabilities: us - (opus|ulaw|alaw|g722|g729|h264), peer - audio=(ulaw|alaw|g722|g729)/video=(h264)/text=(nothing), combined - (ulaw|alaw|g722|g729|h264)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)

You need to include this file in sip.conf. Asterisk does not do this out of the box, although I believe FreePBX does it.

There is no option called dtmf_mode (with an underscore) for chan_sip. There is a dtmfmode option.

chan_sip is deprecated, effectively unsupported, and will removed in the Autumn 2023 version of Asterisk.

Hi david551,

it is actually FreePBX (I am new to FreePBX and Asterisk; I am not really very knowledgeable about these applications).

We were adivsed to use chan_sip to work around a media problem (calling side is behind NAT & FreePBX is behind NAT; FreePBX sends the media to local IP of the calling side).

I tried adding “dtmfmode=rfc2833” to sip.conf. Nothing has changed. 200 OK SDP Offer from FreePBX does not include telephone-event.

Attached you can also find our SIP settings.

`<------------>
Audio is at 12090
Video is at X.X.X.X:15238
Adding codec opus to SDP
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding codec g722 to SDP
Adding codec g729 to SDP
Adding video codec h264 to SDP

<— Reliably Transmitting (NAT) to X.X.X.X:18383 —>

v=0
o=root 472674657 472674657 IN IP4 X.X.X.X
s=Asterisk PBX 16.17.0
c=IN IP4 86.108.187.13
b=CT:6000
t=0 0
m=audio 12090 RTP/AVP 107 0 8 9 18
a=rtpmap:107 opus/48000/2
a=fmtp:107 useinbandfec=1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=maxptime:20
a=sendrecv
m=video 15238 RTP/AVP 99
a=rtpmap:99 H264/90000
a=sendrecv`

Global Settings:
----------------
  UDP Bindaddress:        0.0.0.0:5060
  TCP SIP Bindaddress:    0.0.0.0:5060
  TLS SIP Bindaddress:    Disabled
  RTP Bindaddress:        Disabled
  Videosupport:           Yes
  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:             FPBX-15.0.17.67(16.17.0)
  SDP Session Name:       Asterisk PBX 16.17.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:              Unknown
  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:             CS3
  IP ToS RTP audio:       EF
  IP ToS RTP video:       AF41
  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:             <none>
  Externaddr:             X.X.X.X:0
  Externrefresh:          10
  Localnet:               X.X.X.X/255.255.255.0
                          X.X.X.X/255.255.255.255

Global Signalling Settings:
---------------------------
  Codecs:                 (opus|ulaw|alaw|g722|g729|h264)
  Relax DTMF:             No
  RFC2833 Compensation:   No
  Symmetric RTP:          Yes
  Compact SIP headers:    No
  RTP Keepalive:          0 (Disabled)
  RTP Timeout:            30 
  RTP Hold Timeout:       300 
  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:       6000 kbps
  Auto-Framing:           No
  Outb. proxy:            <not set> 
  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:                from-sip-external
  Record on feature:      automon
  Record off feature:     automon
  Force rport:            Yes
  DTMF:                   rfc2833
  Qualify:                0
  Keepalive:              0
  Use ClientCode:         No
  Progress inband:        No
  Language:               tr
  Tone zone:              <Not set>
  MOH Interpret:          default
  MOH Suggest:            
  Voice Mail Extension:   *97
  RTCP Multiplexing:      No```

I don’t believe these all apply to the same address.

chan_sip used to be able to offer telephony events in a late offer INVITE. If it has broken since, it isn’t going to get fixed.

chan_pjsip supports external addresses to handle this regarding Asterisk behind NAT, and RTP symmetric (equivalent of chan_sip nat=comedia) to cope with the far side being behind NAT.

The Cisco firmware is intended to be used on a corporate intranet, not in a NAT environment. The expected way of handling NAT is with VPNs.

Hi david551,

I don’t believe these all apply to the same address.

These are not the same addresses, I just intended to hide our addresses.

chan_pjsip supports external addresses to handle this regarding Asterisk behind NAT, and RTP symmetric (equivalent of chan_sip nat=comedia) to cope with the far side being behind NAT.

Could you please advise where to set this configuration (which conf file)? We could not make this work with chan_pjsip. Our external address is configured under both FreePBX General SIP Settings and SIP settings.

Generally, when obfuscating, you should ensure that the addresses remain distinct and unique, and that the distinction between public, shared and private ranges is maintained.

may help.

There is this parameter “rtp_symmetric”. However, if I am not wrong this parameter applies to endpoints only.
How are we supposed to handle guest calls coming from sides that are behind NAT?

Firstly you shouldn’t use guest mode, if at all possible, and I don’t see why you need guest mode here.

Secondly guest mode still uses endpoints, just ones with an endpoint identifier of “anonymous”, in the identify section.

(It is possibly important to understand that SIP has no concept of a difference between extensions and trunks. The specification uses neither term. Also Asterisk defines extension as something appearing in extensions.conf, not a piece of hardware that you put on your desk.)

We use guest mode as we’d like to be able to receive anonymous calls (I realize that this is not safe).

So, I guess adding rtp_symmetric=yes to this section will suffice:

[anonymous]
type=endpoint
context=from-sip-external
allow=all

The usage of “allow=all” doesn’t currently work either, you need to explicitly disallow and then allow specific codecs.

Hi again,

we reverted to chan_pjsip as you recommended.

anonymous section in pjsip.endpoint.conf looks like this:
[anonymous]
type=endpoint
context=from-sip-external
allow=all

As I understand it, it is not recommended to change this file.

So, we added the following to pjsip.endpoint_custom.conf (without changing pjsip.endpoint.conf*):
[anonymous]
type=endpoint
context=from-sip-external
disallow=all
allow=opus,ulaw,alaw,g722,g729,g726,h264
rtp_symmetric=yes

However, FreePBX returns 401 Unathorized to incoming INVITE, somehow rejects anonymous calls.

Then we tried adding only the parameters pjsip.endpoint_custom.conf:
[anonymous]
disallow=all
allow=opus,ulaw,alaw,g722,g729,g726,h264
rtp_symmetric=yes

In this case,

  • INVITE with SDP (fast start): no RTP
  • INVITE without SDP (slowstart): FreePBX sends 200 OK without SDP offer, and then terminates the call with BYE.

We are probably not editing this file properly. Could you please advice how to add these parameters in a proper way?

You are asking about configuration files that are only consulted by FreePBX, and whose use requires knowledge of what FreePBX puts in the files it controls This is the wrong place to ask. You need a FreePBX forum,

I appreciate your help and guidance.

I created the same topic at the FreePBX forum as well, no-one has responded yet. There is just a link referring back to this topic at this forum.

I thought that chan_sip configuration would be done in a similar fashion in both FreePBX and Asterisk.

I understand that there might be some differences in the way they approach things and in the way they populate and handle the config files etc, but is this difference so much drastic that it cannot be helped with? I am just looking into changing some basic out-of-the-box behavior of chan_sip that I believed could be done easily and it is just a matter of proper configuration; just need guidance on this.

The out-of-the-box behavior of chan_sip seems to be (for anonymous calls):

  • rtp_symmetric is not enabled
  • chan_sip responds to slow-start INVITE with 200 OK without SDP and terminates the call.

FreePBX manipulates the configuration using the mechanisms provided by Asterisk, but FreePBX is much more than a tool for managing Asterisk configuration files. It uses Asterisk to create things like ring groups, inbound routes, trunks, etc. which are not concepts known to Asterisk. In the current context, Asterisk just has pjsip.conf, all of which may be edited by the end user (and must be, as apart from some sample code, mostly commented out, it doesn’t contain anything as supplied.

FreePBX includes lots of other files, some with fixed contents, some with user provided contents, and some with contents controlled by the GUI. It uses various mechanism that are present in Asterisk but rarely used by people working directly with Asterisk, to allow one file to override parts of another.

Thanks. I get the idea.

I just thought that using the pjsip.endpoint_custom.conf (user provided content) I could override or amend things in pjsip.endpoint.conf which is not allowed to be modified. How else are you supposed to modify parameters for “anonymous” endpoint which is part of pjsip.endpoint.conf? Anyway, I hope I can somehow figure it out.

That is a question about FreePBX, as it is the FreePBX GUI that makes it unsafe to edit that file, not Asterisk. Out of the box, Asterisk doesn’t even read any of the files you have listed.

Thanks to the guys in FreePBX community, this is how to do it.

To make changes to pjsip endpoints using conf files in FreePBX, you use the file pjsip.endpoint_custom_post.conf and this format:

[anonymous](+type=endpoint)
rtp_symmetric=yes
disallow=all
allow=opus,ulaw,alaw,g722,g729,g726,h264

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.