Administrator
发布于 2026-11-09 / 0 阅读
0
0

FreeSWITCH configuration lab 12: Media paths and inactivity timeouts

English
中文

An observable media test

Extension 7101 will dial the isolated test number 7812 and FreeSWITCH will bridge it to 7102. Verify normal media through FreeSWITCH, then observe what happens when one endpoint stops sending RTP. Use 30 seconds for active-call inactivity and 90 seconds for hold inactivity as lab values. Choose production thresholds according to endpoints, trunks and business waiting requirements.

Reuse episode 11's profile, directory domain and common codec. Put both phones on a mutually reachable test LAN. Have configuration backups, capture access and a way to control one test media flow. The example was checked against v1.11.2 templates, media source and current documentation, without running it on an instance. Agents, queues and tiers retain their existing objects. This route calls a directory extension directly.

What each mode exposes on the server

In normal mode, FreeSWITCH terminates RTP on both legs and can process audio. Codec conversion and features such as recording or playback require suitable server media processing. With proxy_media, RTP still passes through the server, primarily as forwarded media packets, without normal transcoding. With bypass_media, SDP directs the endpoints to exchange media directly while FreeSWITCH continues signaling.

Use the SDP addresses and ports to predict the path, then verify actual packets. Both normal and proxy modes can show RTP on the server interface, so that observation alone cannot distinguish them. Bypass can establish SIP while audio fails if endpoints cannot reach each other through NAT. For public paths, retain the verified media routing from episode 10 first.

Add an isolated test destination

In fs_cli, use eval $${conf_dir} to locate the configuration root. Confirm that authenticated 7101 enters default, or use its existing controlled context. Save the complete example as dialplan/default/00_training_media_12.xml. Verify that default.xml includes the directory, and inspect existing 7812 matches and earlier broad rules. A 00 prefix alone cannot guarantee the first match. Verify actual include order and route execution.

Check training-internal for inbound-proxy-media or inbound-bypass-media, and check applications that overwrite variables before bridge. Preserve the normal media assumptions from the previous lab before using this route.

<include>
  <extension name="fs_media_lab_12">
    <condition field="destination_number" expression="^7812$">
      <!-- 本实验使用普通媒体,先关闭两种特殊模式 -->
      <action application="set" data="bypass_media=false"/>
      <action application="set" data="proxy_media=false"/>
      <!-- 当前腿与随后建立的被叫腿都使用毫秒单位 -->
      <action application="export" data="media_timeout=30000"/>
      <!-- 保持时的实验值为90秒,实际处理还受协商影响 -->
      <action application="export" data="media_hold_timeout=90000"/>
      <!-- 接通后的被叫腿结束后,结束本次主叫通话 -->
      <action application="set" data="hangup_after_bridge=true"/>
      <!-- 复用现有目录里的7102,域沿用本次认证呼叫 -->
      <action application="bridge" data="user/7102@${domain_name}"/>
    </condition>
  </extension>
</include>

7812 is the dialed lab destination and 7102 is the actual called extension. domain_name must match the directory domain. Use the established lookup method on a multi-domain instance. Existing authentication and routing continue to control access.

The two set actions select the current call's media mode and are false in the baseline. export applies timeout values to the current leg and propagates them to the subsequent outbound leg. Check reception on each leg. 30000 milliseconds is 30 seconds, and 90000 is 90 seconds. hangup_after_bridge=true ends the caller leg after the called leg ends normally.

Load, inspect and interrupt one media flow

Run the following in fs_cli. After reloadxml, make a new call from 7101 to 7812. Replace UUID with its identifier from show channels, querying the last four variables on both legs. Audio-specific media_timeout_audio and media_hold_timeout_audio can affect the generic values. Record unset values as well.

reloadxml
show channels
uuid_getvar UUID media_timeout
uuid_getvar UUID media_hold_timeout
uuid_getvar UUID media_timeout_audio
uuid_getvar UUID media_hold_timeout_audio

After answering, exchange speech and capture the RTP tuples at FreeSWITCH. Make only one test endpoint stop sending media toward FreeSWITCH while keeping SIP online. Use an endpoint test feature or temporarily filter the confirmed individual RTP flow in an isolated environment. Record its five-tuple and the recovery procedure before acting. Disconnecting the whole network also affects signaling and other calls.

A normally flowing call should not end merely because its age exceeds 30 seconds. After reception stops for the threshold, inspect termination and its cause, such as MEDIA_TIMEOUT. Record the interval from the last received media packet. Scheduling and check paths affect the observed time, so an exact 30.000-second result is not required. If it does not trigger, verify actual inactivity, effective settings and media mode before inspecting logs.

Phone mute commonly leaves RTP flowing, and silence can include comfort-noise packets. Verify packets rather than treating silence as inactivity. Restore any temporary filter immediately after the test and place a fresh call to confirm two-way audio.

Verify hold independently

After restoring normal calling, start a separate hold test. Capture the re-INVITE SDP when the phone enters hold, then resume. RFC 3264 defines sendonly, recvonly and inactive direction attributes. Endpoint behavior differs, including whether media continues.

media_hold_timeout is an inactivity threshold while on hold, rather than a fixed lifetime for every held call. Some direction-negotiation paths in v1.11.2 adjust or clear audio timeouts. A configured 90000 does not guarantee termination at 90 seconds. Compare both SDPs, the state identified by FreeSWITCH and the audio-specific variables. Confirm two-way audio returns after resume.

Compare proxy and bypass

Replace the mode actions only in this recoverable test route and establish new calls for each mode. Start with a shared single codec on both phones. For proxy media, replace the existing actions before bridge with the following.

<!-- 仅在独立实验路由的bridge之前使用 -->
<action application="set" data="bypass_media=false"/>
<!-- 与上面的普通媒体配置二选一 -->
<action application="set" data="proxy_media=true"/>

Verify that both legs send media to FreeSWITCH, check codec compatibility and inspect forwarded packets. Restore normal media before trying bypass. The following comparison requires direct endpoint media reachability and excludes recording or server playback functions.

<!-- 仅在两台测试终端媒体可直达时使用 -->
<action application="set" data="proxy_media=false"/>
<!-- 与代理媒体配置二选一,替换原有同名设置 -->
<action application="set" data="bypass_media=true"/>

Capture at both endpoints to confirm direct media. Ordinary server RTP receive timeouts cannot replace end-to-end monitoring for a bypassed path. Profile media-option values such as resume-media-on-hold, bypass-media-after-hold and bypass-media-after-att-xfer can move media during hold, resume or attended transfer. Capture and listen through those stages when the project uses these options.

Troubleshooting and rollback

  • Calls end almost immediately. Check units: media_timeout uses milliseconds, while the legacy profile rtp-timeout-sec uses seconds.
  • Legacy rtp-timeout-sec and rtp-hold-timeout-sec remain in a template. v1.11.2 logs deprecation warnings while parsing them. Use media_timeout and media_hold_timeout for the new test, check overrides and plan migration of old values.
  • A mode edit has no effect. Verify the route match, profile and application overrides, then compare fresh calls. Check variables against actual packet paths.
  • Audio fails or recordings lose segments after hold. Compare SDP before and after hold, whether media returned to FreeSWITCH, and hold or transfer options. Choose the mode needed by server audio features.

Wait for lab calls to end, move the new XML out of the include path and restore profile settings, application variables and endpoint settings changed for this test. Run reloadxml. If profile-level modes changed, restart that profile in the test window using the earlier procedure. Remove temporary filter entries and repeat the original 7101/7102 calls plus hold/resume.

Sources


评论