330_srtp_prefer_rtp_savp.py 798 B

1234567891011121314151617181920212223242526272829
  1. import inc_sip as sip
  2. import inc_sdp as sdp
  3. # When SRTP is enabled in pjsua, it should prefer to use
  4. # RTP/SAVP media line if there are multiple m=audio lines
  5. sdp = \
  6. """
  7. v=0
  8. o=- 0 0 IN IP4 127.0.0.1
  9. s=-
  10. c=IN IP4 127.0.0.1
  11. t=0 0
  12. m=audio 4000 RTP/AVP 0
  13. a=rtpmap:0 pcmu/8000
  14. m=audio 4000 RTP/SAVP 0
  15. a=crypto:1 aes_cm_128_hmac_sha1_80 inline:WnD7c1ksDGs+dIefCEo8omPg4uO8DYIinNGL5yxQ
  16. """
  17. pjsua_args = "--null-audio --auto-answer 200 --use-srtp 1 --srtp-secure 0"
  18. extra_headers = ""
  19. include = ["Content-Type: application/sdp", # response must include SDP
  20. "m=audio 0 RTP/AVP[\\s\\S]+m=audio [1-9]+[0-9]* RTP/SAVP[\\s\\S]+a=crypto"
  21. ]
  22. exclude = []
  23. sendto_cfg = sip.SendtoCfg("Prefer RTP/SAVP", pjsua_args, sdp, 200,
  24. extra_headers=extra_headers,
  25. resp_inc=include, resp_exc=exclude)