# ----------- global configuration parameters ------------------------
debug=2
fork=yes
log_stderror=no
children=1
disable_tcp=yes
listen=udp:127.0.0.1:5060
auto_aliases=no
alias=example.invalid
# ------------------ module loading ----------------------------------
loadmodule "sl.so"
loadmodule "pv.so"
loadmodule "textops.so"
loadmodule "textopsx.so"
loadmodule "sdpops.so"
loadmodule "app_lua.so"
modparam("sl", "bind_tm", 0)
modparam("app_lua", "register", "sdpops")

request_route {
	if ( is_present_hf("X-Case") ) {
		if ( $hdr(X-Case) == '61-test0') {
			if( !lua_dostring("sr.sdpops.sdp_remove_line_by_prefix([[a=rtcp]])") ) {
				sl_send_reply(500,"Lua call failed retcode=$retcode ($hdr(X-Case))");
				exit;
			}
		} else if ( $hdr(X-Case) == '61-test1') {
			if( !lua_dostring("sr.sdpops.sdp_remove_line_by_prefix([[a=rtcp]], [[audio]])") ) {
				sl_send_reply(500,"Lua call failed retcode=$retcode ($hdr(X-Case))");
				exit;
			}
		} else if ( $hdr(X-Case) == '61-test2') {
			if( !lua_dostring("sr.sdpops.sdp_remove_line_by_prefix([[a=rtcp]], [[video]])") ) {
				sl_send_reply(500,"Lua call failed retcode=$retcode ($hdr(X-Case))");
				exit;
			}
		} else {
			sl_send_reply(500,"Unknown test case");
			exit;
		}

 		msg_apply_changes();
		set_reply_body($rb,"application/sdp");
		sl_send_reply(200,"OK");
		exit;
	}
	sl_send_reply(500,"X-Case missing");
	exit;
}