You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

liblinphone是否支持SIP紧凑头?Android IPv6场景问题求助

Liblinphone SIP Compact Headers Support & Troubleshooting Your Presence Subscription Issue

First off, liblinphone does support SIP compact headers—the expand_name method you found in message.c is exactly the code path responsible for translating short compact header names to their full counterparts. The issue you're seeing (where the o compact header maps to Event but isn't being processed correctly) likely stems from either disabled compact header parsing or a version-specific gap in the header mappings.

Key Background

The expand_name function is called automatically during SIP message parsing whenever a header name is detected that matches one of the defined compact-to-full mappings. For your case, the mapping o → Event should exist in this function's lookup table—if it's missing or not being triggered, that's why your NOTIFY message (with o: presence) is being rejected with a 400 Bad Request (the app can't find the required Event header because it's not expanding o properly).

How to Enable Compact Header Support

1. Compile-Time Configuration (if building liblinphone from source)

Ensure the compact headers feature is enabled in your CMake configuration:

  • Check for the ENABLE_COMPACT_HEADERS flag in your build setup, and set it to ON if it's not already.
  • Verify that the header mappings in message.c include the entry for o:
    {"o", "Event"},
    
    If this line is missing, add it to the compact header lookup array, then recompile liblinphone and your Android app.

2. Runtime Configuration (for pre-built liblinphone or existing apps)

Enable compact header parsing at runtime via the liblinphone API:

  • In your Android app code, after initializing the LinphoneCore, set the following configuration:
    LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
    if (lc != null) {
        lc.setConfigInt("sip", "enable_compact_headers", 1);
    }
    
  • Alternatively, you can add this line to your linphonerc configuration file:
    [sip]
    enable_compact_headers=1
    

Troubleshooting Your Specific Presence Subscription Issue

  1. Verify liblinphone Version: Older versions of liblinphone had incomplete compact header support. Upgrade to the latest stable release (4.5.x or newer) to ensure full compatibility with all SIP compact headers, including o for Event.
  2. Inspect SIP Message Logs: Enable debug-level logging to confirm if the o: presence header is being expanded correctly:
    LinphoneCoreFactory.instance().setLogLevel(LinphoneLogLevel.LinphoneLogLevelDebug);
    
    Look for log lines showing the parsed headers of the incoming NOTIFY—you should see Event: presence instead of the raw o: presence if expansion is working.
  3. Check Server-Side Behavior: Ensure FreeSWITCH is sending the compact headers correctly (your provided NOTIFY message looks valid, but double-check that the o header is properly formatted without typos).

Example Incoming NOTIFY Message (Your Provided Packet)

NOTIFY sip:[2405:205:C92B:4DA4:CD75:7761:F807:892B]:47880;transport=udp;pb-pt=47880 SIP/2.0
Record-Route: <sip:[****:****:*:*:*:*:*:**];r2=on;lr>
Record-Route: <sip:***.***.***.***;r2=on;lr>
Via: SIP/2.0/UDP [2607:F900:1:1:0:0:0:10];branch=z9hG4bK966c.e48cd18cfad7a93f173d651fac1bb56d.0
v:SIP/2.0/UDP 10.100.147.205:5071;received=10.100.147.205;rport=5071;branch=z9hG4bK3ptDHry599DXK
Max-Forwards:70
f:sip:address@hidden;tag=0KWo7fUeCNnU
t:<sip:address@hidden>;tag=TzUqiY4Tw
i:RAi8DkMzBE
CSeq:550422005 NOTIFY
m:sip:address@hidden:5071
User-Agent:FreeSWITCH-mod_sofia/1.6.17~64bit
Supported: path, replaces
o:presence
Subscription-State:active;expires=300
c:application/pidf+xml
l:440
<?xml version="1.0" encoding="ISO-8859-1"?>
<presence xmlns='urn:ietf:params:xml:ns:pidf' xmlns:dm='urn:ietf:params:xml:ns:pidf:data-model' xmlns:rpid='urn:ietf:params:xml:ns:pidf:rpid' xmlns:c='urn:ietf:params:xml:ns:pidf:cipid' entity='sip:address@hidden'>
  <tuple id='t6a5ed77e'>
    <status>
      <basic>open</basic>
    </status>
  </tuple>
  <dm:person id='p06360c4a'>
    <dm:note>Available</dm:note>
  </dm:person>
</presence>

内容的提问来源于stack exchange,提问作者Zeeshan Saiyed

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 06:35:10