你如何编写一个 Asterisk 拨号盘来暂停 180-Ringing 直到 chan_sip 中的 183-progress 之后?

How do you write an Asterisk Dialpan to suspend 180-Ringing until after 183-progress in chan_sip?

我正在尝试编写一个 Asterisk 拨号方案来暂停 180-Ringing 直到 183-progress 之后。拨号方案中需要做什么来防止这种情况?

您可以在下面看到跟踪:chan_sip 驱动程序发送“180 振铃”,然后在上游中继(下一跳)发送 503 时立即得到 503,但这让运营商感到不安。他们不想看到振铃,除非可以取得进展,所以我想抑制发送“180 振铃”,直到上游中继发送“183 进度”之后。

我查看了 Dial(SIP/117/X) function reference/flags 但没有看到任何有用的信息。这是 chan_sip,但我也愿意接受 chan_pjsip 拨号计划函数调用或分支测试。

想法?

(仅供参考:这是一个拨号方案编程问题,而不是配置问题,所以根据 SE asterisk tag 规则,我认为它属于 Whosebug 而不是超级用户。)

22:29:02.539741 IP (tos 0x68, ttl 57, id 36866, offset 0, flags [none], proto UDP (17), length 1405)
    10.0.0.101.5062 > 10.0.0.201.5060: SIP, length: 1377
    "INVITE sip:117@10.0.0.201 SIP/2.0"

22:29:02.541085 IP (tos 0x60, ttl 64, id 22099, offset 0, flags [none], proto UDP (17), length 538)
    10.0.0.201.5060 > 10.0.0.101.5062: SIP, length: 510
    "SIP/2.0 100 Trying"
    
22:29:02.546553 IP (tos 0x60, ttl 64, id 22102, offset 0, flags [none], proto UDP (17), length 554)
    10.0.0.201.5060 > 10.0.0.101.5062: SIP, length: 526
    "SIP/2.0 180 Ringing" # but this is too early!
    
22:29:02.770970 IP (tos 0x60, ttl 64, id 22111, offset 0, flags [none], proto UDP (17), length 526)
    10.0.0.201.5060 > 10.0.0.101.5062: SIP, length: 498
    "SIP/2.0 503 Service Unavailable"

Asterisk 是 PBX,其设计方式无法控制 channel-level 应答。 chan_sip 中也没有针对此的黑客攻击。仅仅因为 chan_sip 的设计方式几乎是不可能的。

您可以使用 kamailio/opensips(代理类型),它可以 100% 控制 sip 数据包。

您可以尝试使用以下选项(仅此而已)。

;prematuremedia=no              ; Some ISDN links send empty media frames before
                                ; the call is in ringing or progress state. The SIP
                                ; channel will then send 183 indicating early media
                                ; which will be empty - thus users get no ring signal.
                                ; Setting this to "yes" will stop any media before we have
                                ; call progress (meaning the SIP channel will not send 183 Session
                                ; Progress for early media). Default is "yes". Also make sure that
                                ; the SIP peer is configured with progressinband=never.
                                ;
                                ; In order for "noanswer" applications to work, you need to run
                                ; the progress() application in the priority before the app.

;progressinband=no              ; If we should generate in-band ringing. Always
                                ; use 'never' to never use in-band signalling, even in cases
                                ; where some buggy devices might not render it
                                ; Valid values: yes, no, never Default: no

另一种选择是重写 chan_sip 并硬编码您所需的行为。