788 | | /* Close upper entry of transport stack */ |
789 | | if (call->med_orig && (call->med_tp != call->med_orig)) { |
790 | | pjmedia_transport_close(call->med_tp); |
791 | | call->med_tp = call->med_orig; |
792 | | } |
| 791 | /* Check if SRTP requires secure signaling */ |
| 792 | if (acc->cfg.use_srtp != PJMEDIA_SRTP_DISABLED) { |
| 793 | if (security_level < acc->cfg.srtp_secure_signaling) { |
| 794 | if (sip_err_code) |
| 795 | *sip_err_code = PJSIP_SC_NOT_ACCEPTABLE; |
| 796 | return PJSIP_ESESSIONINSECURE; |
| 797 | } |
| 798 | } |
794 | | #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) |
795 | | /* Check if SRTP requires secure signaling */ |
796 | | if (acc->cfg.use_srtp != PJMEDIA_SRTP_DISABLED) { |
797 | | if (security_level < acc->cfg.srtp_secure_signaling) { |
| 800 | /* Always create SRTP adapter */ |
| 801 | pjmedia_srtp_setting_default(&srtp_opt); |
| 802 | srtp_opt.close_member_tp = PJ_FALSE; |
| 803 | srtp_opt.use = acc->cfg.use_srtp; |
| 804 | status = pjmedia_transport_srtp_create(pjsua_var.med_endpt, |
| 805 | call->med_tp, |
| 806 | &srtp_opt, &srtp); |
| 807 | if (status != PJ_SUCCESS) { |
804 | | /* Always create SRTP adapter */ |
805 | | pjmedia_srtp_setting_default(&srtp_opt); |
806 | | srtp_opt.close_member_tp = PJ_FALSE; |
807 | | srtp_opt.use = acc->cfg.use_srtp; |
808 | | status = pjmedia_transport_srtp_create(pjsua_var.med_endpt, |
809 | | call->med_tp, |
810 | | &srtp_opt, &srtp); |
811 | | if (status != PJ_SUCCESS) { |
812 | | if (sip_err_code) |
813 | | *sip_err_code = PJSIP_SC_INTERNAL_SERVER_ERROR; |
814 | | return status; |
| 813 | /* Set SRTP as current media transport */ |
| 814 | call->med_orig = call->med_tp; |
| 815 | call->med_tp = srtp; |