python sip request header srtp and rtp
samsomlw opened this issue · 4 comments
i have this part of my sip invite request for srtp
sdp = '\r\n'
sdp += 'v=0\r\n'
sdp += 'o=anonymous 1312841870 1312841870 IN IP4 %s\r\n' % contactdomain
sdp += 's=SIP Call\r\n'
sdp += 'c=IN IP4 %s\r\n' % contactdomain
sdp += 't=0 0\r\n'
sdp += 'm=audio 2362 RTP/AVP 0\r\n'
sdp += 'a=sendrecv\r\n'
sdp += 'a=rtpmap:18 G729/8000\r\n'
sdp += 'a=fmtp:18 annexb=no\r\n'
sdp += 'a=ptime:20\r\n'
sdp += 'a=rtpmap:0 PCMU/8000\r\n'
sdp += 'a=rtpmap:8 PCMA/8000\r\n'
sdp += 'a=rtpmap:4 G723/8000\r\n'
sdp += 'a=rtpmap:9 G722/8000\r\n'
sdp += 'a=rtpmap:97 iLBC/8000\r\n'
sdp += 'a=rtpmap:3 GSM/8000\r\n'
sdp += 'a=fmtp:97 mode=30\r\n'
sdp += 'a=rtpmap:2 G726-32/8000\r\n'
sdp += 'a=rtpmap:123 opus/48000/2\r\n'
sdp += 'a=rtpmap:101 telephone-event/8000\r\n'
sdp += 'a=fmtp:101 0-15\r\n'
sdp += 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:4EvYRd22P8n36wRrlWCMZIWegovyv7iWm464D4Pt\r\n'
sdp += 'a=crypto:2 AES_CM_128_HMAC_SHA1_32 inline:mWQ4cakWKOnfH9Tji2pEF87JtVFUqBAMPqub9roe\r\n'
i was add
sdp += 'a=rtpmap:3 GSM/8000\r\n'
sdp += 'a=rtpmap:0 PCMU/8000\r\n'
sdp += 'a=rtpmap:8 PCMA/8000\r\n'
and this is part of my rtp
sdp = '\r\n'
sdp += 'v=0\r\n'
sdp += 'o=anonymous 1312841870 1312841870 IN IP4 %s\r\n' % contactdomain
sdp += 's=session\r\n'
sdp += 'c=IN IP4 %s\r\n' % contactdomain
sdp += 't=0 0\r\n'
sdp += 'm=audio 2362 RTP/AVP 0\r\n'
sdp += 'a=rtpmap:18 G729/8000\r\n'
sdp += 'a=rtpmap:0 PCMU/8000\r\n'
sdp += 'a=rtpmap:8 PCMA/8000\r\n'
sdp += 'a=rtpmap:97 iLBC/8000\r\n'
sdp += 'a=rtpmap:3 GSM/8000\r\n'
sdp += 'a=rtpmap:101 telephone-event/8000\r\n'
i was add
sdp += 'a=rtpmap:3 GSM/8000\r\n'
sdp += 'a=rtpmap:101 telephone-event/8000\r\n'
1 - what is AES_CM_128_HMAC_SHA1_32 and AES_CM_128_HMAC_SHA1_80 encription type to encrypt it in python or how i encrypt it in python
2- If i set my program settings to work on srtp . Will this be more comprehensive? meaning. Are all sip accounts working on rtp Will it work on srtp ?
-3 on srtp or rtp i was support many of codecs . Could this conflict occur? Meaning a connection error occurred. If it is multiple. I want my program to work with all kinds of codecs automatically
4- What modifications do I need from your point of view to make my request better
after the experiment. My connection was very successful. But my questions are to make the program better
Hi
I've added your suggestions for RTP and SRTP, but it is not important because this is not a softphone and the goal in not to make a call. The purpose of this scripts are to make requests and to check the responses.
The crypto values that appear using -srtp parameter is only to simulate a SDES into the SDP, i.e. to offer SRTP (crypted RTP). If you are testing a server that only works with SRTP maybe if you send and INVITE message it is possible that the response will be any error because SRTP is forced and you are sending RTP. Using -srtp the script will send a well formed SDES inside the SDP. But this is only for test. This is not a softphone :)
Cheers
Frankly, I am developing my own graduation project at the university. I could not find easier than your codes to read and understand. That's why I try to use it and create soft phone
As I said you, this is an audit tool and not a softphone. It can be useful sipsend script to check requests and responses, but I think you can not make a softphone in python. Maybe you can download CSipSimple or Linphone for that
Thank you very much