星号:PJSIP_标题和Websocket

星号:PJSIP_标题和Websocket,websocket,header,asterisk,pjsip,Websocket,Header,Asterisk,Pjsip,我需要在调用客户端的webrtc时添加自定义头。由星号13+siphtml5使用。 拨号计划: exten => 198,1,Answer() same => n,Set(PJSIP_HEADER(add,X-DRP)=71234567890) same => n,DIAL(PJSIP/${EXTEN}) 星号日志: Connected to Asterisk 13.17.2 currently running on ubuntu-xenial (pid = 8895)

我需要在调用客户端的webrtc时添加自定义头。由星号13+siphtml5使用。 拨号计划:

exten => 198,1,Answer()
same => n,Set(PJSIP_HEADER(add,X-DRP)=71234567890)
same => n,DIAL(PJSIP/${EXTEN})
星号日志:

Connected to Asterisk 13.17.2 currently running on ubuntu-xenial (pid = 8895)
  == WebSocket connection from '192.168.0.44:58096' forcefully closed due to fatal write error
  == WebSocket connection from '192.168.0.44:58595' for protocol 'sip' accepted using version '13'
    -- Added contact 'sip:a9gn89sg@192.168.0.44:58595;transport=ws' to AOR '199' with expiration of 450 seconds
  == Contact 199/sip:a9gn89sg@192.168.0.44:58595;transport=ws has been created
  == Contact 199/sip:3qogi2fo@192.168.0.44:58096;transport=ws has been deleted
    -- Contact 199/sip:a9gn89sg@192.168.0.44:58595;transport=ws is now Unknown.  RTT: 0.000 msec
  == Setting global variable 'SIPDOMAIN' to 'aster13'
  == DTLS ECDH initialized (automatic), faster PFS enabled
    -- Executing [198@default:1] Answer("PJSIP/199-00000008", "") in new stack
       > 0x7f0ea0071960 -- Strict RTP learning after remote address set to: 123.135.239.111:58827
[Oct 23 16:02:31] ERROR[8943]: pjproject:0 <?>:            icess0x7f0ea000ce18 ..Error sending STUN request: Network is unreachable
[Oct 23 16:02:31] ERROR[8943]: pjproject:0 <?>:            icess0x7f0ea000ce18 ..Error sending STUN request: Network is unreachable
       > 0x7f0ea0071960 -- Strict RTP learning after ICE completion
       > 0x7f0ea0071960 -- Strict RTP switching to RTP target address 192.168.100.97:58827 as source
    -- Executing [198@default:2] SIPAddHeader("PJSIP/199-00000008", "X-DRP: 79161234567") in new stack
    -- Executing [198@default:3] Set("PJSIP/199-00000008", "PJSIP_HEADER(add,X-DRP)=79161234567") in new stack
    -- Executing [198@default:4] Verbose("PJSIP/199-00000008", "Set(OldContact="199" <sips:199@192.168.100.97:54514;transport=ws;rtcweb-breaker=no;click2call=no>;+g.oma.sip-im;language="en,fr")") in new stack
Set(OldContact=199 <sips:199@192.168.100.97:54514;transport=ws;rtcweb-breaker=no;click2call=no>;+g.oma.sip-im;language=en,fr)
    -- Executing [198@default:5] Dial("PJSIP/199-00000008", "PJSIP/198") in new stack
    -- Called PJSIP/198
    -- PJSIP/199-00000008 requested media update control 26, passing it to PJSIP/198-00000009
  == DTLS ECDH initialized (automatic), faster PFS enabled
    -- PJSIP/198-00000009 is ringing
       > 0x7f0ea0071960 -- Strict RTP learning complete - Locking on source address 192.168.100.97:58827
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [198@default:7] Hangup("PJSIP/199-00000008", "") in new stack
  == Spawn extension (default, 198, 7) exited non-zero on 'PJSIP/199-00000008'
    -- Added contact 'sips:199@192.168.100.97:54514;transport=ws;rtcweb-breaker=no' to AOR '199' with expiration of 200 seconds
  == Contact 199/sips:199@192.168.100.97:54514;transport=ws;rtcweb-breaker=no has been created
  == Contact 199/sip:a9gn89sg@192.168.0.44:58595;transport=ws has been deleted
    -- Contact 199/sips:199@192.168.100.97:54514;transport=ws;rtcweb-breaker=no is now Unknown.  RTT: 0.000 msec
连接到当前在ubuntu xenial上运行的Asterisk 13.17.2(pid=8895)
==由于致命的写入错误,来自“192.168.0.44:58096”的WebSocket连接被强制关闭
==使用版本“13”接受协议“sip”的来自“192.168.0.44:58595”的WebSocket连接
--增加了联系人的sip:a9gn89sg@192.168.0.44:58595;传输=ws'到AOR'199',过期450秒
==联系199/sip:a9gn89sg@192.168.0.44:58595;transport=ws已创建
==联系199/sip:3qogi2fo@192.168.0.44:58096;transport=ws已被删除
--联络199/sip:a9gn89sg@192.168.0.44:58595;transport=ws现在是未知的。RTT:0.000毫秒
==将全局变量“SIPDOMAIN”设置为“aster13”
==DTLS ECDH已初始化(自动),启用更快的PFS
--执行[198@default:1]在新堆栈中回答(“PJSIP/199-00000008”,”)
>0x7f0ea0071960--远程地址设置为:123.135.239.111:58827后的严格RTP学习
[Oct 23 16:02:31]错误[8943]:PJ项目:0:icess0x7f0ea000ce18..发送STUN请求时出错:无法访问网络
[Oct 23 16:02:31]错误[8943]:PJ项目:0:icess0x7f0ea000ce18..发送STUN请求时出错:无法访问网络
>0x7f0ea0071960——ICE完成后的严格RTP学习
>0x7f0ea0071960—严格RTP切换到RTP目标地址192.168.100.97:58827作为源
--执行[198@default:2]新堆栈中的SIPAddHeader(“PJSIP/199-00000008”,“X-DRP:79161234567”)
--执行[198@default:3]在新堆栈中设置(“PJSIP/199-00000008”,“PJSIP_头(添加,X-DRP)=79161234567”)
--执行[198@default:4]新堆栈中的详细(“PJSIP/199-00000008”,“Set(OldContact=“199”+g.oma.sip im;language=“en,fr”))
设置(OldContact=199;+g.oma.sip im;语言=en,fr)
--执行[198@default:5]在新堆栈中拨号(“PJSIP/199-00000008”,“PJSIP/198”)
--称为PJSIP/198
--PJSIP/199-0000000 8请求媒体更新控制26,并将其传递给PJSIP/198-0000000 9
==DTLS ECDH已初始化(自动),启用更快的PFS
--PJSIP/198-00000009正在响
>0x7f0ea0071960--严格RTP学习完成-锁定源地址192.168.100.97:58827
==此时每个人都很忙/拥挤(1:0/0/1)
--执行[198@default:7]在新堆栈中挂起(“PJSIP/199-0000000 8”,“”)
==在'PJSIP/199-0000000 8'上,繁殖扩展(默认值198,7)退出非零
--增加了联系人的SIP:199@192.168.100.97:54514;传输=ws;rtcweb breaker=no'to AOR'199',过期时间为200秒
==联系199/sips:199@192.168.100.97:54514;传输=ws;rtcweb breaker=未创建
==联系199/sip:a9gn89sg@192.168.0.44:58595;transport=ws已被删除
--联系199/sips:199@192.168.100.97:54514;传输=ws;rtcweb breaker=否现在未知。RTT:0.000毫秒
在我的浏览器的调试日志中找不到标题X-DRP:

recv=INVITE sips:198@192.168.100.97:54445;transport=ws;rtcweb-breaker=no SIP/2.0

Via: SIP/2.0/WSS 192.168.100.97:54445;rport;branch=z9hG4bKPja4ca4b5b-62c2-4953-a761-d13d34696007;alias

From: "199"<sip:199@ubuntu-xenial>;tag=a1b0c71d-f89b-4226-a84e-82e7db8b2b21

To: <sips:198@192.168.100.97;rtcweb-breaker=no>

Contact: <sips:asterisk@ubuntu-xenial:5060;transport=ws>

Call-ID: a47911b2-c6d4-4222-961b-f0418a4e00c0

CSeq: 30108 INVITE

Content-Type: application/sdp

Content-Length: 1085

Allow: OPTIONS,SUBSCRIBE,NOTIFY,PUBLISH,INVITE,ACK,BYE,CANCEL,UPDATE,PRACK,REGISTER,MESSAGE,REFER

Supported: 100rel,timer,replaces,norefersub

Session-Expires: 1800;refresher=uac

Min-SE: 90

Max-Forwards: 70

User-Agent: Asterisk PBX 13.17.2



v=0

o=- 780155122 780155122 IN IP4 192.168.49.32

s=Asterisk

c=IN IP4 192.168.49.32

t=0 0

m=audio 15018 UDP/TLS/RTP/SAVPF 0 101

a=connection:new

a=setup:actpass

a=fingerprint:SHA-256 AA:94:9A:8F:24:9A:BD:C2:6B:BA:57:4D:E2:D3:1F:1E:B1:F9:87:B1:96:C7:29:93:B8:75:16:D6:73:9D:1E:3E

a=ice-ufrag:3e3de33532c2fcdc32d71b2f086be032

a=ice-pwd:78e4b4b93a861933107a205a10cac6dd

a=candidate:Hc92a8000 1 UDP 2130706431 fe80::14:68ff:fe3e:8447 15018 typ host

a=candidate:H6893915f 1 UDP 2130706431 fe80::a00:27ff:feeb:a9e 15018 typ host

a=candidate:Ha00020f 1 UDP 2130706431 10.0.2.15 15018 typ host

a=candidate:Hc0a83120 1 UDP 2130706431 192.168.49.32 15018 typ host

a=candidate:Hc92a8000 2 UDP 2130706430 fe80::14:68ff:fe3e:8447 15019 typ host

a=candidate:H6893915f 2 UDP 2130706430 fe80::a00:27ff:feeb:a9e 15019 typ host

a=candidate:Ha00020f 2 UDP 2130706430 10.0.2.15 15019 typ host

a=candidate:Hc0a83120 2 UDP 2130706430 192.168.49.32 15019 typ host

a=rtpmap:0 PCMU/8000

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-16

a=ptime:20

a=maxptime:150

a=sendrecv

a=rtcp-mux
recv=邀请SIP:198@192.168.100.97:54445;传输=ws;rtcweb断路器=无SIP/2.0
Via:SIP/2.0/WSS 192.168.100.97:54445;rport;分支机构=z9hG4bKPja4ca4b5b-62c2-4953-a761-d13d34696007;别名
从:“199”;标签=a1b0c71d-f89b-4226-a84e-82e7db8b2b21
致:
联系人:
呼叫ID:a47911b2-c6d4-4222-961b-f0418a4e00c0
CSeq:30108邀请
内容类型:应用程序/sdp
内容长度:1085
允许:选项、订阅、通知、发布、邀请、确认、再见、取消、更新、恶作剧、注册、消息、引用
支持:100rel、计时器、替换、norefersub
届会结束:1800;复习者=uac
Min SE:90
最大前锋:70
用户代理:星号PBX 13.17.2
v=0
o=IP4 192.168.49.32中的-780155122 780155122
s=星号
c=在IP4 192.168.49.32中
t=0
m=音频15018 UDP/TLS/RTP/SAVPF 0 101
a=连接:新
a=设置:actpass
a=指纹:SHA-256 AA:94:9A:8F:24:9A:BD:C2:6B:BA:57:4D:E2:D3:1F:1E:B1:F9:87:B1:96:C7:29:93:B8:75:16:D6:73:9D:1E:3E
a=冰ufrag:3E3DE33532C2FCD32D71B2F086BE032
a=冰pwd:78e4b4b93a861933107a205a10cac6dd
a=候选:Hc92a8000 1 UDP 2130706431 fe80::14:68ff:fe3e:8447 15018典型主机
a=候选:H6893915f 1 UDP 2130706431 fe80::a00:27ff:feeb:a9e 15018典型主机
a=候选:Ha00020f 1 UDP 2130706431 10.0.2.15 15018典型主机
a=候选:Hc0a83120 1 UDP 2130706431 192.168.49.32 15018典型主机
a=候选:Hc92a8000 2 UDP 2130706430 fe80::14:68ff:fe3e:8447 15019典型主机
a=候选:H6893915f 2 UDP 2130706430 fe80::a00:27ff:feeb:a9e 15019典型主机
a=候选:Ha00020f 2 UDP 2130706430 10.0.2.15 15019典型主机
a=候选:Hc0a83120 2 UDP 2130706430 192.168.49.32 15019典型主机
a=rtpmap:0 PCMU/8000
a=rtpmap:101电话事件/8000
a=fmtp:101 0-16
a=时间:20
a=最大时间:150
a=sendrecv
a=rtcp多路复用器
PJSIP是否支持WebSocket的PJSIP_头?是否有其他方法可以将自定义标头添加到webrtc客户端的INVOTE


我使用星号13和siphtml5 web客户端。此外,我还使用wireshark检查wss流量,对其进行解密,但仍然找不到X-DRP标头。

在星号集标头中使用:

same => n,SIPAddHeader(HEADERNAME: ${SOMEVAR})
您需要在客户机中使用更更新的库,如jsSip。在这种情况下,您无法获得如下服务器头:

phone.on('newRTCSession', function(e){
   if (e.originator == 'remote') {
       console.log(e.request.headers);
   }
});
SIPAddHeader
SIPRemoveHeader
用于
chan\u sip
模块。对于PJSIP,您应该使用
PJSIP\u头
dialplan应用程序。这正是你看起来在做的。所以我不太确定这里的问题是什么。尝试使用更新版本的库和星号,看看这个问题是否得到解决。