400_fmtp_g7221_with_bitrate.py 786 B

123456789101112131415161718192021222324252627282930313233
  1. import inc_sip as sip
  2. import inc_sdp as sdp
  3. # Answer for codec G722.1 should contain fmtp bitrate
  4. sdp = \
  5. """
  6. v=0
  7. o=- 3428650655 3428650655 IN IP4 192.168.1.9
  8. s=pjmedia
  9. c=IN IP4 192.168.1.9
  10. t=0 0
  11. a=X-nat:0
  12. m=audio 4000 RTP/AVP 99 100 101
  13. a=rtcp:4001 IN IP4 192.168.1.9
  14. a=rtpmap:99 G7221/16000
  15. a=fmtp:99 bitrate=24000
  16. a=rtpmap:100 G7221/16000
  17. a=fmtp:100 bitrate=32000
  18. a=sendrecv
  19. a=rtpmap:101 telephone-event/8000
  20. a=fmtp:101 0-15
  21. """
  22. pjsua_args = "--null-audio --auto-answer 200 --add-codec G7221"
  23. extra_headers = ""
  24. include = ["fmtp:[\d]+ bitrate="] # response must include fmtp bitrate
  25. exclude = []
  26. sendto_cfg = sip.SendtoCfg("Answer should contain fmtp bitrate for codec G722.1", pjsua_args, sdp, 200,
  27. extra_headers=extra_headers,
  28. resp_inc=include, resp_exc=exclude)