SRTP问题:PJSIP初始化媒体频道时出错:此处不可接受[status = 170488]

时间:2017-02-12 02:20:53

标签: ios ssl asterisk rtp pjsip

我正在尝试使用PJSIP在我的iOS应用程序中使用SRTP。我有TLS工作,没有SRTP,我可以拨打和接听电话。但是对于SRTP,我在INVITE上得到了这个奇怪的488错误。它无法初始化媒体。

我读过其他提及编解码器的文章。但我已经确保我的Asterisk服务器使用的代码和我的iOS应用程序中使用PJSIP库编译的代码是相同的。我在这里看到的唯一一件事就是我启用了加密,而PJSIP并不喜欢它。有什么想法吗?

INVITE sip:[REDACTED]@[REDACTED]:47229;transport=TLS;ob SIP/2.0

Via: SIP/2.0/TLS [REDACTED]:5161;rport;branch=z9hG4bKPj8ea1a332-0748-438f-ae74-5d17b038891d;alias

From: "Test" <sip:asterisk@172.31.18.138>;tag=7c3663cb-b5f5-4762-8526-8425d18b2466

To: <sip:[REDACTED]@[REDACTED];ob>

Contact: <sip:asterisk@[REDACTED]:5161;transport=TLS>

Call-ID: f454ef36-01ea-4f29-9482-4a10768bf1b7

CSeq: 24942 INVITE

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

Supported: 100rel, timer, replaces, norefersub, path

Session-Expires: 1800

Min-SE: 90

Max-Forwards: 70

User-Agent: FPBX-AsteriskNOW-13.0.190.12(13.13.1)

Content-Type: application/sdp

Content-Length:   398



v=0

o=- 1582453973 1582453973 IN IP4 172.31.18.138

s=Asterisk

c=IN IP4 [REDACTED]

t=0 0

m=audio 11410 RTP/AVP 3 110 9 97 101

a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:84m7hqGvMjTU21xzkhBS3RQpQQjJ+aep0VwSlhx+

a=rtpmap:3 GSM/8000

a=rtpmap:110 speex/8000

a=rtpmap:9 G722/8000

a=rtpmap:97 iLBC/8000

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-16

a=ptime:20

a=maxptime:60

a=sendrecv


--end msg--
19:10:11.601   pjsua_call.c  .Incoming Request msg INVITE/cseq=24942 (rdata0x1421f0540)
19:10:11.603 tsx0x1421fe0a8  ...Transaction created for Request msg INVITE/cseq=24942 (rdata0x1421f0540)
19:10:11.603 tsx0x1421fe0a8  ..Incoming Request msg INVITE/cseq=24942 (rdata0x1421f0540) in state Null
19:10:11.603 tsx0x1421fe0a8  ...State changed from Null to Trying, event=RX_MSG
19:10:11.603 dlg0x1421fd8a8  ....Transaction tsx0x1421fe0a8 state changed to Trying
19:10:11.603 dlg0x1421fd8a8  ..UAS dialog created
19:10:11.603 dlg0x1421fd8a8  ..Module mod-invite added as dialog usage, data=0x141de7588
19:10:11.603 dlg0x1421fd8a8  ...Session count inc to 3 by mod-invite
19:10:11.603 inv0x1421fd8a8  ..UAS invite session created for dialog dlg0x1421fd8a8
19:10:11.603 dlg0x1421fd8a8  ...Session count inc to 3 by mod-pjsua
19:10:11.603  pjsua_media.c  ..Call 0: initializing media..
19:10:11.603   pjsua_call.c  ..Error initializing media channel: Not Acceptable Here [status=170488]
19:10:11.604       endpoint  ..Response msg 488/INVITE/cseq=24942 (tdta0x1421fe800) created
19:10:11.604 dlg0x1421fd8a8  ...Sending Response msg 488/INVITE/cseq=24942 (tdta0x1421fe800)
19:10:11.606 tsx0x1421fe0a8  ...Sending Response msg 488/INVITE/cseq=24942 (tdta0x1421fe800) in state Trying
19:10:11.606   pjsua_core.c  ....TX 429 bytes Response msg 488/INVITE/cseq=24942 (tdta0x1421fe800) to TLS [REDACTED]:5161:
SIP/2.0 488 Not Acceptable Here

Via: SIP/2.0/TLS [REDACTED]:5161;rport=5161;received=[REDACTED];branch=z9hG4bKPj8ea1a332-0748-438f-ae74-5d17b038891d;alias

Call-ID: f454ef36-01ea-4f29-9482-4a10768bf1b7

From: "Test" <sip:asterisk@172.31.18.138>;tag=7c3663cb-b5f5-4762-8526-8425d18b2466

To: <sip:[REDACTED]@[REDACTED];ob>;tag=5oFGceZO4ZaKpLFEg7piOrM7IV2yeDLT

CSeq: 24942 INVITE

Content-Length:  0




--end msg--

3 个答案:

答案 0 :(得分:1)

如果有其他人有这个问题。我会告诉你是什么解决了这个问题。

在我的端点(pjsip show endpoint myendpoint)设置中的Asterisk上,我将 media_encryption_optimistic 设置为true。当我将其设置为 false 时,一切都开始有效。

我不知道为什么星号如何声明打开它。但我确认所有流量确实是通过使用wireshark检查实际语音数据加密的。

如果有人知道为什么会出现这种情况需要将其设置为false,这将有助于我更好地理解这一点。但是现在我已经开始运作了。

答案 1 :(得分:1)

我在PJSIP ios上遇到此错误,并且在禁用“ SRTP”或“ S-RTP”或“安全RTP”或“安全传输”后终于解决了。我将其删除以进行TLS配置。

    //acc_cfg.srtp_secure_signaling = 1;
    //acc_cfg.use_srtp = PJMEDIA_SRTP_MANDATORY;

答案 2 :(得分:0)

488 /此处不可接受

  

我的服务器也遇到了同样的问题,我找到了解决方案   通过了解它是因为编解码器,使用正确的编解码器或   禁用编解码器非常适合您。