SRTP: Unable to create media session: No active media stream after negotiation

Анцев Александр
Wed, Oct 5, 2016 10:57 AM

Hello!

I'm trying to enable media encryption:
acc_cfg.mediaConfig.srtpUse = PJMEDIA_SRTP_MANDATORY;

But when I'm calling from one client to another, I receive an error
I pjsua  : 13:43:04.491  pjsua_call.c  .....Unable to create media session: No active media stream after negotiation (PJMEDIA_SDPNEG_ENOMEDIA) [status=220048]

I have an android app, running on two smartphones.

From phone A I'm starting to INVITE phone B:

I/pjsua  (31621): 13:43:04.926  pjsua_core.c  ....TX 1540 bytes Request msg INVITE/cseq=9968 (tdta0xb7d13ba0) to TLS myserver:5061:
I/pjsua  (31621): INVITE sips:45@myserver SIP/2.0
I/pjsua  (31621): Via: SIP/2.0/TLS myip:60120;rport;branch=z9hG4bKPja07658da-f36c-41b0-8bc7-a1bee8283227;alias
I/pjsua  (31621): Max-Forwards: 70
I/pjsua  (31621): From: sips:42@myserver;tag=5f41ec30-416d-40f7-9d10-b4256c8aadff
I/pjsua  (31621): To: sips:45@myserver
I/pjsua  (31621): Contact: sips:42@myip:60120;transport=TLS;ob
I/pjsua  (31621): Call-ID: 99a8e63b-8948-471b-b211-31618c80f085
I/pjsua  (31621): CSeq: 9968 INVITE
I/pjsua  (31621): Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
I/pjsua  (31621): Supported: replaces, 100rel, timer, norefersub
I/pjsua  (31621): Session-Expires: 1800
I/pjsua  (31621): Min-SE: 90
I/pjsua  (31621): Content-Type: application/sdp
I/pjsua  (31621): Content-Length:  906
I/pjsua  (31621):
I/pjsua  (31621): v=0
I/pjsua  (31621): o=- 3684652984 3684652984 IN IP4 myip
I/pjsua  (31621): s=pjmedia
I/pjsua  (31621): b=AS:84
I/pjsua  (31621): t=0 0
I/pjsua  (31621): a=X-nat:8
I/pjsua  (31621): m=audio 4000 RTP/SAVP 98 97 99 104 3 0 8 9 96
I/pjsua  (31621): c=IN IP4 myip
I/pjsua  (31621): b=TIAS:64000
I/pjsua  (31621): a=rtcp:4001 IN IP4 myip
I/pjsua  (31621): a=sendrecv
I/pjsua  (31621): a=rtpmap:98 speex/16000
I/pjsua  (31621): a=rtpmap:97 speex/8000
I/pjsua  (31621): a=rtpmap:99 speex/32000
I/pjsua  (31621): a=rtpmap:104 iLBC/8000
I/pjsua  (31621): a=fmtp:104 mode=30
I/pjsua  (31621): a=rtpmap:3 GSM/8000
I/pjsua  (31621): a=rtpmap:0 PCMU/8000
I/pjsua  (31621): a=rtpmap:8 PCMA/8000
I/pjsua  (31621): a=rtpmap:9 G722/8000
I/pjsua  (31621): a=rtpmap:96 telephone-event/8000
I/pjsua  (31621): a=fmtp:96 0-16
I/pjsua  (31621): a=crypto:1 AES_256_CM_HMAC_SHA1_80 inline:clSUiIxVT3tNJxxQta+KqFycGav78gsHiMs87ik0110Hv/FF8buyY/8JsBgxsQ==
I/pjsua  (31621): a=crypto:2 AES_256_CM_HMAC_SHA1_32 inline:v/bMtGdzu7pDKm5sA4Tbvu6Nq0zP9Ngjh94+JIwsRFxnitXBN/DhmJ+AWZskig==
I/pjsua  (31621): a=crypto:3 AES_CM_128_HMAC_SHA1_80 inline:bOo8w4oN73Y5ulMSeMy51IH3g5U5te5hwmfsqvoK
I/pjsua  (31621): a=crypto:4 AES_CM_128_HMAC_SHA1_32 inline:HdfycY3lOufoSP1cDj4HBslePQWNqOur6S3q+KIe
I/pjsua  (31621): m=video 0 RTP/AVP 31
I/pjsua  (31621): c=IN IP4 127.0.0.1
I/pjsua  (31621):
I/pjsua  (31621): --end msg--

Phone B receives an INVITE
I pjsua  : 13:43:04.452  pjsua_core.c  .RX 968 bytes Request msg INVITE/cseq=102 (rdata0x9e25c9e0) from TLS myserver:5061:
I pjsua  : INVITE sips:45@myip:49917;transport=TLS;ob SIP/2.0
I pjsua  : Via: SIP/2.0/TLS myserver:5061;branch=z9hG4bK68790288;rport
I pjsua  : Max-Forwards: 10
I pjsua  : From: sip:42@myserver;tag=as4ff57dfd
I pjsua  : To: sips:45@myip:49917;transport=TLS;ob
I pjsua  : Contact: sip:42@myserver:5061;transport=TLS
I pjsua  : Call-ID: 57d01bd456ea5bf4452ed6c305e61774@myserver:5061
I pjsua  : CSeq: 102 INVITE
I pjsua  : User-Agent: sips
I pjsua  : Date: Wed, 05 Oct 2016 10:42:51 GMT
I pjsua  : Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
I pjsua  : Supported: replaces, timer
I pjsua  : Content-Type: application/sdp
I pjsua  : Content-Length: 331
10-05 13:43:04.452  6003  6151 I pjsua  :
I pjsua  : v=0
I pjsua  : o=root 1458186628 1458186628 IN IP4 myserver
I pjsua  : s=sips
I pjsua  : c=IN IP4 myserver
I pjsua  : t=0 0
I pjsua  : m=audio 13966 RTP/SAVP 0 8 101
I pjsua  : a=rtpmap:0 PCMU/8000
I pjsua  : a=rtpmap:8 PCMA/8000
I pjsua  : a=rtpmap:101 telephone-event/8000
I pjsua  : a=fmtp:101 0-16
I pjsua  : a=ptime:20
I pjsua  : a=sendrecv
I pjsua  : a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:uYnyLtDU1V+Al5ozvqrfbfg6dD6lhvOic6cwZcKo
10-05 13:43:04.452  6003  6151 I pjsua  :
I pjsua  : --end msg--

So phone B is trying to answer:
I pjsua  : 13:43:04.452  pjsua_call.c  .Incoming Request msg INVITE/cseq=102 (rdata0x9e25c9e0)
I pjsua  : 13:43:04.461  pjsua_media.c  ..Call 0: initializing media..
I pjsua  : 13:43:04.480  pjsua_media.c  ...RTP socket reachable at myip:1031
I pjsua  : 13:43:04.480  pjsua_media.c  ...RTCP socket reachable at myip:1032
I pjsua  : 13:43:04.481  pjsua_media.c  ...Media index 0 selected for audio call 0
I pjsua  : 13:43:04.481  pjsua_call.c  ...Answering call 0: code=200
I pjsua  : 13:43:04.481  pjsua_call.c  ....Pending answering call 0 upon completion of media transport
I pjsua  : 13:43:04.487  pjsua_core.c  .....TX 310 bytes Response msg 100/INVITE/cseq=102 (tdta0x9d203000) to TLS myserver:5061:
I pjsua  : SIP/2.0 100 Trying

And after that something is going wrong:
I pjsua  : 13:43:04.489  pjsua_call.c  ..Answering call 0: code=200
I pjsua  : 13:43:04.490  pjsua_media.c  .....Call 0: updating media..
I pjsua  : 13:43:04.490  pjsua_media.c  ......Audio updated, stream #0:  (inactive)
I pjsua  : 13:43:04.491  pjsua_call.c  .....Unable to create media session: No active media stream after negotiation (PJMEDIA_SDPNEG_ENOMEDIA) [status=220048]
I pjsua  : 13:43:04.491  pjsua_core.c  ........TX 510 bytes Response msg 488/INVITE/cseq=102 (tdta0x9d203000) to TLS myserver:5061:
I pjsua  : SIP/2.0 488 Not Acceptable Here

Can anyone help me to figure it out?

--
С уважением,
Александр Анцев

Hello! I'm trying to enable media encryption: acc_cfg.mediaConfig.srtpUse = PJMEDIA_SRTP_MANDATORY; But when I'm calling from one client to another, I receive an error I pjsua : 13:43:04.491 pjsua_call.c .....Unable to create media session: No active media stream after negotiation (PJMEDIA_SDPNEG_ENOMEDIA) [status=220048] I have an android app, running on two smartphones. >From phone A I'm starting to INVITE phone B: I/pjsua (31621): 13:43:04.926 pjsua_core.c ....TX 1540 bytes Request msg INVITE/cseq=9968 (tdta0xb7d13ba0) to TLS myserver:5061: I/pjsua (31621): INVITE sips:45@myserver SIP/2.0 I/pjsua (31621): Via: SIP/2.0/TLS myip:60120;rport;branch=z9hG4bKPja07658da-f36c-41b0-8bc7-a1bee8283227;alias I/pjsua (31621): Max-Forwards: 70 I/pjsua (31621): From: sips:42@myserver;tag=5f41ec30-416d-40f7-9d10-b4256c8aadff I/pjsua (31621): To: sips:45@myserver I/pjsua (31621): Contact: <sips:42@myip:60120;transport=TLS;ob> I/pjsua (31621): Call-ID: 99a8e63b-8948-471b-b211-31618c80f085 I/pjsua (31621): CSeq: 9968 INVITE I/pjsua (31621): Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS I/pjsua (31621): Supported: replaces, 100rel, timer, norefersub I/pjsua (31621): Session-Expires: 1800 I/pjsua (31621): Min-SE: 90 I/pjsua (31621): Content-Type: application/sdp I/pjsua (31621): Content-Length: 906 I/pjsua (31621): I/pjsua (31621): v=0 I/pjsua (31621): o=- 3684652984 3684652984 IN IP4 myip I/pjsua (31621): s=pjmedia I/pjsua (31621): b=AS:84 I/pjsua (31621): t=0 0 I/pjsua (31621): a=X-nat:8 I/pjsua (31621): m=audio 4000 RTP/SAVP 98 97 99 104 3 0 8 9 96 I/pjsua (31621): c=IN IP4 myip I/pjsua (31621): b=TIAS:64000 I/pjsua (31621): a=rtcp:4001 IN IP4 myip I/pjsua (31621): a=sendrecv I/pjsua (31621): a=rtpmap:98 speex/16000 I/pjsua (31621): a=rtpmap:97 speex/8000 I/pjsua (31621): a=rtpmap:99 speex/32000 I/pjsua (31621): a=rtpmap:104 iLBC/8000 I/pjsua (31621): a=fmtp:104 mode=30 I/pjsua (31621): a=rtpmap:3 GSM/8000 I/pjsua (31621): a=rtpmap:0 PCMU/8000 I/pjsua (31621): a=rtpmap:8 PCMA/8000 I/pjsua (31621): a=rtpmap:9 G722/8000 I/pjsua (31621): a=rtpmap:96 telephone-event/8000 I/pjsua (31621): a=fmtp:96 0-16 I/pjsua (31621): a=crypto:1 AES_256_CM_HMAC_SHA1_80 inline:clSUiIxVT3tNJxxQta+KqFycGav78gsHiMs87ik0110Hv/FF8buyY/8JsBgxsQ== I/pjsua (31621): a=crypto:2 AES_256_CM_HMAC_SHA1_32 inline:v/bMtGdzu7pDKm5sA4Tbvu6Nq0zP9Ngjh94+JIwsRFxnitXBN/DhmJ+AWZskig== I/pjsua (31621): a=crypto:3 AES_CM_128_HMAC_SHA1_80 inline:bOo8w4oN73Y5ulMSeMy51IH3g5U5te5hwmfsqvoK I/pjsua (31621): a=crypto:4 AES_CM_128_HMAC_SHA1_32 inline:HdfycY3lOufoSP1cDj4HBslePQWNqOur6S3q+KIe I/pjsua (31621): m=video 0 RTP/AVP 31 I/pjsua (31621): c=IN IP4 127.0.0.1 I/pjsua (31621): I/pjsua (31621): --end msg-- Phone B receives an INVITE I pjsua : 13:43:04.452 pjsua_core.c .RX 968 bytes Request msg INVITE/cseq=102 (rdata0x9e25c9e0) from TLS myserver:5061: I pjsua : INVITE sips:45@myip:49917;transport=TLS;ob SIP/2.0 I pjsua : Via: SIP/2.0/TLS myserver:5061;branch=z9hG4bK68790288;rport I pjsua : Max-Forwards: 10 I pjsua : From: <sip:42@myserver>;tag=as4ff57dfd I pjsua : To: <sips:45@myip:49917;transport=TLS;ob> I pjsua : Contact: <sip:42@myserver:5061;transport=TLS> I pjsua : Call-ID: 57d01bd456ea5bf4452ed6c305e61774@myserver:5061 I pjsua : CSeq: 102 INVITE I pjsua : User-Agent: sips I pjsua : Date: Wed, 05 Oct 2016 10:42:51 GMT I pjsua : Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE I pjsua : Supported: replaces, timer I pjsua : Content-Type: application/sdp I pjsua : Content-Length: 331 10-05 13:43:04.452 6003 6151 I pjsua : I pjsua : v=0 I pjsua : o=root 1458186628 1458186628 IN IP4 myserver I pjsua : s=sips I pjsua : c=IN IP4 myserver I pjsua : t=0 0 I pjsua : m=audio 13966 RTP/SAVP 0 8 101 I pjsua : a=rtpmap:0 PCMU/8000 I pjsua : a=rtpmap:8 PCMA/8000 I pjsua : a=rtpmap:101 telephone-event/8000 I pjsua : a=fmtp:101 0-16 I pjsua : a=ptime:20 I pjsua : a=sendrecv I pjsua : a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:uYnyLtDU1V+Al5ozvqrfbfg6dD6lhvOic6cwZcKo 10-05 13:43:04.452 6003 6151 I pjsua : I pjsua : --end msg-- So phone B is trying to answer: I pjsua : 13:43:04.452 pjsua_call.c .Incoming Request msg INVITE/cseq=102 (rdata0x9e25c9e0) I pjsua : 13:43:04.461 pjsua_media.c ..Call 0: initializing media.. I pjsua : 13:43:04.480 pjsua_media.c ...RTP socket reachable at myip:1031 I pjsua : 13:43:04.480 pjsua_media.c ...RTCP socket reachable at myip:1032 I pjsua : 13:43:04.481 pjsua_media.c ...Media index 0 selected for audio call 0 I pjsua : 13:43:04.481 pjsua_call.c ...Answering call 0: code=200 I pjsua : 13:43:04.481 pjsua_call.c ....Pending answering call 0 upon completion of media transport I pjsua : 13:43:04.487 pjsua_core.c .....TX 310 bytes Response msg 100/INVITE/cseq=102 (tdta0x9d203000) to TLS myserver:5061: I pjsua : SIP/2.0 100 Trying And after that something is going wrong: I pjsua : 13:43:04.489 pjsua_call.c ..Answering call 0: code=200 I pjsua : 13:43:04.490 pjsua_media.c .....Call 0: updating media.. I pjsua : 13:43:04.490 pjsua_media.c ......Audio updated, stream #0: (inactive) I pjsua : 13:43:04.491 pjsua_call.c .....Unable to create media session: No active media stream after negotiation (PJMEDIA_SDPNEG_ENOMEDIA) [status=220048] I pjsua : 13:43:04.491 pjsua_core.c ........TX 510 bytes Response msg 488/INVITE/cseq=102 (tdta0x9d203000) to TLS myserver:5061: I pjsua : SIP/2.0 488 Not Acceptable Here Can anyone help me to figure it out? -- С уважением, Александр Анцев