[Home]

Summary:ASTERISK-16562: Asterisk with SRTP Record and Playback Issue
Reporter:Hemanshu Patel (hemanshurpatel)Labels:
Date Opened:2010-08-13 01:25:13Date Closed:2010-09-09 12:19:50
Priority:BlockerRegression?No
Status:Closed/CompleteComponents:Resources/res_srtp
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:I am using asterisk successfully with SRTP for Calling.
I havent tested my installation for record and playback since i added SRTP support to it.
i have configured extention 999 for record task:

exten => 999,1,Set(_SIPSRTP_CRYPTO=enable)
exten => 999,n,Set(_SIPSRTP=1)
exten => 999,n,Answer
exten => 999,n,Record(hemu.ulaw)
exten => 999,n,Hangup


When i call 999, application receives INVITE packet with crypto tag in SDP. I am using Grandstream GVX3410 phone which supports SRTP.Apllication process the message, Process_crypto function call and call is established. I mean asterisk starts recording, but while recording in rtp_recvfrom function, rtp->srtp == NULL and so it doesnt decrypt the packets. Stores packet as it is.

and same happens while playback, and so packet which asterisk sends while playback are encyrpted with tags of recording call, so its just blank screen and Noise on speakers.

What extra happens in normal call is that asterisk also processes 200 OK with crypto header and so it calls process_crypto function two times while in record and playback function it calls those function one time only.

Anyone has got same problem?

regards
Hemanshu Patel

****** ADDITIONAL INFORMATION ******

Have anyone else tried record and playback functions with asterisk SRTP patch.


Here is the log with some more additional debugging information for your reference.

                                                                                                                                 
*PANSC>                                                                                                                                    
*PANSC> [Aug 13 10:34:06] WARNING[3515]: chan_sip.c:13717 handle_request_invite: Hemanshu: handle_request_invite sip_pvt : b2e004d8        
[Aug 13 10:34:06] WARNING[3515]: chan_sip.c:13717 handle_request_invite: Hemanshu: handle_request_invite sip_pvt : b2e004d8                
[Aug 13 10:34:06] DEBUG[3515]: chan_sip.c:1882 process_crypto: Hemanshu: Calling Setup_crypto from process_crypto                          
[Aug 13 10:34:06] ERROR[3515]: chan_sip.c:1632 setup_crypto: base64 encode/decode bad len 40 != 30                                        
[Aug 13 10:34:06] WARNING[3515]: chan_sip.c:1633 setup_crypto: Hemanshu:  local_key64 wztXUJZEgPHYENFJsnTK4Eg76n+4ltvGhNnCwlYt len 40      
[Aug 13 10:34:06] ERROR[3515]: chan_sip.c:1647 setup_crypto: base64 encode/decode bad len 40 != 30                                        
[Aug 13 10:34:06] WARNING[3515]: chan_sip.c:1648 setup_crypto: Hemanshu:  local_key641 hbgVRLHBOv+WE8I+BXGkXz+LPEFjF3pB/xAYVm9j len 40    
[Aug 13 10:34:06] DEBUG[3515]: chan_sip.c:1921 process_crypto: Hemanshu: a_crypto: a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:CIsazUbEwIncXpCLrfrckVtTdTbDwiRufboxC19L                                                                                                                
[Aug 13 10:34:06] DEBUG[3515]: chan_sip.c:1934 process_crypto: Hemanshu: v_crypto: a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:3z36oesLGYMS3UfXivRIG4bunOy0RQKAwc/xLtI+                                                                                                                
[Aug 13 10:34:06] WARNING[3515]: chan_sip.c:1818 process_crypto:  crypto already accepted                                                  
[Aug 13 10:34:06] DEBUG[3515]: chan_sip.c:4266 sip_new: Hemanshu: channel id:b2e07a08 jointcapability:200004 capability:20110c global_capability:20110c nativeformat:200004 chanjointcapability:0                                                                                    
   -- Executing [999@hemu_default:1] Set("SIP/1000-b2e004d8", "_SIPSRTP_CRYPTO=enable") in new stack                                      
[Aug 13 10:34:06] WARNING[3975]: pbx.c:493 pbx_exec: Hemanshu: Inside pbx_exex function                                                    
   -- Executing [999@hemu_default:2] Set("SIP/1000-b2e004d8", "_SIPSRTP=1") in new stack                                                  
[Aug 13 10:34:06] WARNING[3975]: pbx.c:493 pbx_exec: Hemanshu: Inside pbx_exex function                                                    
   -- Executing [999@hemu_default:3] Answer("SIP/1000-b2e004d8", "") in new stack                                                        
[Aug 13 10:34:06] WARNING[3975]: pbx.c:493 pbx_exec: Hemanshu: Inside pbx_exex function                                                    
[Aug 13 10:34:06] WARNING[3975]: channel.c:1666 ast_answer: Hemanshu: ast_answer Debug 1                                                  
[Aug 13 10:34:06] WARNING[3975]: channel.c:1672 ast_answer: Hemanshu: ast_answer Debug 2                                                  
[Aug 13 10:34:06] WARNING[3975]: channel.c:1678 ast_answer: Hemanshu: ast_answer Debug 3                                                  
[Aug 13 10:34:06] WARNING[3975]: channel.c:1682 ast_answer: Hemanshu: ast_answer Debug 3.1                                                
[Aug 13 10:34:06] WARNING[3975]: chan_sip.c:3911 sip_answer: Hemanshu: sip_answer debug 2                                                  
[Aug 13 10:34:06] ERROR[3975]: chan_sip.c:6801 add_sdp: No SRTP found for the other party                                                  
[Aug 13 10:34:06] WARNING[3975]: channel.c:1685 ast_answer: Hemanshu: ast_answer Debug 3.2                                                
[Aug 13 10:34:06] WARNING[3975]: channel.c:1689 ast_answer: Hemanshu: ast_answer Debug 3.3                                                
      > ::Disconnected form Oracle, trying to connect again..                                                                            
      > ::Tried a lot, not getting connected..                                                                                            
[Aug 13 10:34:06] WARNING[3975]: channel.c:1702 ast_answer: Hemanshu: ast_answer Debug 4                                                  
[Aug 13 10:34:06] WARNING[3975]: channel.c:1704 ast_answer: Hemanshu: ast_answer Debug 5                                                  
   -- Executing [999@hemu_default:4] Record("SIP/1000-b2e004d8", "hemu.ulaw") in new stack                                                
[Aug 13 10:34:06] WARNING[3975]: pbx.c:493 pbx_exec: Hemanshu: Inside pbx_exex function                                                    
[Aug 13 10:34:06] DEBUG[3975]: chan_sip.c:4129 sip_indicate: Hemanshu: Sip_indicate called with condition: 18                              
[Aug 13 10:34:06] WARNING[3975]: rtp.c:3810 rtp_recvfrom: Hemanshu rtp_>srtp is NULL                                                      
[Aug 13 10:34:06] DEBUG[3975]: file.c:159 ast_writestream: Opened video output file                                                        
[Aug 13 10:34:06] WARNING[3975]: rtp.c:3810 rtp_recvfrom: Hemanshu rtp_>srtp is NULL                                                      
[Aug 13 10:34:06] WARNING[3975]: rtp.c:3810 rtp_recvfrom: Hemanshu rtp_>srtp is NULL                                                      
[Aug 13 10:34:06] WARNING[3975]: rtp.c:3810 rtp_recvfrom: Hemanshu rtp_>srtp is NULL                                                      
[Aug 13 10:34:06] WARNING[3975]: rtp.c:3810 rtp_recvfrom: Hemanshu rtp_>srtp is NULL  

Comments:By: Leif Madsen (lmadsen) 2010-08-16 13:57:59

I'm acknowledging this issue, but it might be worth it to ask on the asterisk-users mailing list if anyone else is having this issue to make sure it's not a configuration problem. If it is indeed a bug and others are experiencing it it'd be good to have them report that issue here.

Thanks!

By: Russell Bryant (russell) 2010-08-19 11:01:35

What version of Asterisk are you using?  Are you using 1.8 or trunk, or some other version with a patch applied?

By: Hemanshu Patel (hemanshurpatel) 2010-08-20 08:36:58

I am using older version of asterisk, where i had myself patched all SRTP changes.

Meanwhile i applied some changes with and not with record and playback as well SRTP works.
i will scrutinise those changes and will post those here

By: Terry Wilson (twilson) 2010-09-01 13:10:30

Please try using the 1.8 branch or trunk and then apply the patch attached to the srtp.diff on issue 17563 (also posted to reviewboard at https://reviewboard.asterisk.org/r/878/). The combination of newer code and that patch should fix the issue that you are experiencing.

I'm going to go ahead and close this as a duplicate of 17563. We can discuss there as it is kind of a merge of a couple of SRTP issues that should be adressed now.